diff options
Diffstat (limited to 'externals/demangle/llvm/Demangle/Demangle.h')
| -rw-r--r-- | externals/demangle/llvm/Demangle/Demangle.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/externals/demangle/llvm/Demangle/Demangle.h b/externals/demangle/llvm/Demangle/Demangle.h index 5b673e4e1..1552a501a 100644 --- a/externals/demangle/llvm/Demangle/Demangle.h +++ b/externals/demangle/llvm/Demangle/Demangle.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <cstddef> | 13 | #include <cstddef> |
| 14 | #include <string> | 14 | #include <string> |
| 15 | #include <string_view> | ||
| 15 | 16 | ||
| 16 | namespace llvm { | 17 | namespace llvm { |
| 17 | /// This is a llvm local version of __cxa_demangle. Other than the name and | 18 | /// This is a llvm local version of __cxa_demangle. Other than the name and |
| @@ -29,9 +30,10 @@ enum : int { | |||
| 29 | demangle_success = 0, | 30 | demangle_success = 0, |
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n, | 33 | /// Returns a non-NULL pointer to a NUL-terminated C style string |
| 33 | int *status); | 34 | /// that should be explicitly freed, if successful. Otherwise, may return |
| 34 | 35 | /// nullptr if mangled_name is not a valid mangling or is nullptr. | |
| 36 | char *itaniumDemangle(std::string_view mangled_name); | ||
| 35 | 37 | ||
| 36 | enum MSDemangleFlags { | 38 | enum MSDemangleFlags { |
| 37 | MSDF_None = 0, | 39 | MSDF_None = 0, |
| @@ -40,10 +42,34 @@ enum MSDemangleFlags { | |||
| 40 | MSDF_NoCallingConvention = 1 << 2, | 42 | MSDF_NoCallingConvention = 1 << 2, |
| 41 | MSDF_NoReturnType = 1 << 3, | 43 | MSDF_NoReturnType = 1 << 3, |
| 42 | MSDF_NoMemberType = 1 << 4, | 44 | MSDF_NoMemberType = 1 << 4, |
| 45 | MSDF_NoVariableType = 1 << 5, | ||
| 43 | }; | 46 | }; |
| 44 | char *microsoftDemangle(const char *mangled_name, char *buf, size_t *n, | 47 | |
| 48 | /// Demangles the Microsoft symbol pointed at by mangled_name and returns it. | ||
| 49 | /// Returns a pointer to the start of a null-terminated demangled string on | ||
| 50 | /// success, or nullptr on error. | ||
| 51 | /// If n_read is non-null and demangling was successful, it receives how many | ||
| 52 | /// bytes of the input string were consumed. | ||
| 53 | /// status receives one of the demangle_ enum entries above if it's not nullptr. | ||
| 54 | /// Flags controls various details of the demangled representation. | ||
| 55 | char *microsoftDemangle(std::string_view mangled_name, size_t *n_read, | ||
| 45 | int *status, MSDemangleFlags Flags = MSDF_None); | 56 | int *status, MSDemangleFlags Flags = MSDF_None); |
| 46 | 57 | ||
| 58 | // Demangles a Rust v0 mangled symbol. | ||
| 59 | char *rustDemangle(std::string_view MangledName); | ||
| 60 | |||
| 61 | // Demangles a D mangled symbol. | ||
| 62 | char *dlangDemangle(std::string_view MangledName); | ||
| 63 | |||
| 64 | /// Attempt to demangle a string using different demangling schemes. | ||
| 65 | /// The function uses heuristics to determine which demangling scheme to use. | ||
| 66 | /// \param MangledName - reference to string to demangle. | ||
| 67 | /// \returns - the demangled string, or a copy of the input string if no | ||
| 68 | /// demangling occurred. | ||
| 69 | std::string demangle(std::string_view MangledName); | ||
| 70 | |||
| 71 | bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result); | ||
| 72 | |||
| 47 | /// "Partial" demangler. This supports demangling a string into an AST | 73 | /// "Partial" demangler. This supports demangling a string into an AST |
| 48 | /// (typically an intermediate stage in itaniumDemangle) and querying certain | 74 | /// (typically an intermediate stage in itaniumDemangle) and querying certain |
| 49 | /// properties or partially printing the demangled name. | 75 | /// properties or partially printing the demangled name. |
| @@ -59,7 +85,7 @@ struct ItaniumPartialDemangler { | |||
| 59 | bool partialDemangle(const char *MangledName); | 85 | bool partialDemangle(const char *MangledName); |
| 60 | 86 | ||
| 61 | /// Just print the entire mangled name into Buf. Buf and N behave like the | 87 | /// Just print the entire mangled name into Buf. Buf and N behave like the |
| 62 | /// second and third parameters to itaniumDemangle. | 88 | /// second and third parameters to __cxa_demangle. |
| 63 | char *finishDemangle(char *Buf, size_t *N) const; | 89 | char *finishDemangle(char *Buf, size_t *N) const; |
| 64 | 90 | ||
| 65 | /// Get the base name of a function. This doesn't include trailing template | 91 | /// Get the base name of a function. This doesn't include trailing template |
| @@ -95,6 +121,7 @@ struct ItaniumPartialDemangler { | |||
| 95 | bool isSpecialName() const; | 121 | bool isSpecialName() const; |
| 96 | 122 | ||
| 97 | ~ItaniumPartialDemangler(); | 123 | ~ItaniumPartialDemangler(); |
| 124 | |||
| 98 | private: | 125 | private: |
| 99 | void *RootNode; | 126 | void *RootNode; |
| 100 | void *Context; | 127 | void *Context; |