diff options
| author | 2023-01-23 01:51:12 +0100 | |
|---|---|---|
| committer | 2023-01-23 06:23:00 +0100 | |
| commit | 34b1ea9c1925d0da9377973d25e10e9b5ec40e94 (patch) | |
| tree | 0ada6de7ae81a250258a4243d5bd4d2cc1283aef /externals/demangle/llvm/Demangle/Demangle.h | |
| parent | Merge pull request #9555 from abouvier/catch2-update (diff) | |
| download | yuzu-34b1ea9c1925d0da9377973d25e10e9b5ec40e94.tar.gz yuzu-34b1ea9c1925d0da9377973d25e10e9b5ec40e94.tar.xz yuzu-34b1ea9c1925d0da9377973d25e10e9b5ec40e94.zip | |
cmake: prefer system llvm library
Diffstat (limited to 'externals/demangle/llvm/Demangle/Demangle.h')
| -rw-r--r-- | externals/demangle/llvm/Demangle/Demangle.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/externals/demangle/llvm/Demangle/Demangle.h b/externals/demangle/llvm/Demangle/Demangle.h new file mode 100644 index 000000000..5b673e4e1 --- /dev/null +++ b/externals/demangle/llvm/Demangle/Demangle.h | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | //===--- Demangle.h ---------------------------------------------*- C++ -*-===// | ||
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-FileCopyrightText: Part of the LLVM Project | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | |||
| 10 | #ifndef LLVM_DEMANGLE_DEMANGLE_H | ||
| 11 | #define LLVM_DEMANGLE_DEMANGLE_H | ||
| 12 | |||
| 13 | #include <cstddef> | ||
| 14 | #include <string> | ||
| 15 | |||
| 16 | namespace llvm { | ||
| 17 | /// This is a llvm local version of __cxa_demangle. Other than the name and | ||
| 18 | /// being in the llvm namespace it is identical. | ||
| 19 | /// | ||
| 20 | /// The mangled_name is demangled into buf and returned. If the buffer is not | ||
| 21 | /// large enough, realloc is used to expand it. | ||
| 22 | /// | ||
| 23 | /// The *status will be set to a value from the following enumeration | ||
| 24 | enum : int { | ||
| 25 | demangle_unknown_error = -4, | ||
| 26 | demangle_invalid_args = -3, | ||
| 27 | demangle_invalid_mangled_name = -2, | ||
| 28 | demangle_memory_alloc_failure = -1, | ||
| 29 | demangle_success = 0, | ||
| 30 | }; | ||
| 31 | |||
| 32 | char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n, | ||
| 33 | int *status); | ||
| 34 | |||
| 35 | |||
| 36 | enum MSDemangleFlags { | ||
| 37 | MSDF_None = 0, | ||
| 38 | MSDF_DumpBackrefs = 1 << 0, | ||
| 39 | MSDF_NoAccessSpecifier = 1 << 1, | ||
| 40 | MSDF_NoCallingConvention = 1 << 2, | ||
| 41 | MSDF_NoReturnType = 1 << 3, | ||
| 42 | MSDF_NoMemberType = 1 << 4, | ||
| 43 | }; | ||
| 44 | char *microsoftDemangle(const char *mangled_name, char *buf, size_t *n, | ||
| 45 | int *status, MSDemangleFlags Flags = MSDF_None); | ||
| 46 | |||
| 47 | /// "Partial" demangler. This supports demangling a string into an AST | ||
| 48 | /// (typically an intermediate stage in itaniumDemangle) and querying certain | ||
| 49 | /// properties or partially printing the demangled name. | ||
| 50 | struct ItaniumPartialDemangler { | ||
| 51 | ItaniumPartialDemangler(); | ||
| 52 | |||
| 53 | ItaniumPartialDemangler(ItaniumPartialDemangler &&Other); | ||
| 54 | ItaniumPartialDemangler &operator=(ItaniumPartialDemangler &&Other); | ||
| 55 | |||
| 56 | /// Demangle into an AST. Subsequent calls to the rest of the member functions | ||
| 57 | /// implicitly operate on the AST this produces. | ||
| 58 | /// \return true on error, false otherwise | ||
| 59 | bool partialDemangle(const char *MangledName); | ||
| 60 | |||
| 61 | /// Just print the entire mangled name into Buf. Buf and N behave like the | ||
| 62 | /// second and third parameters to itaniumDemangle. | ||
| 63 | char *finishDemangle(char *Buf, size_t *N) const; | ||
| 64 | |||
| 65 | /// Get the base name of a function. This doesn't include trailing template | ||
| 66 | /// arguments, ie for "a::b<int>" this function returns "b". | ||
| 67 | char *getFunctionBaseName(char *Buf, size_t *N) const; | ||
| 68 | |||
| 69 | /// Get the context name for a function. For "a::b::c", this function returns | ||
| 70 | /// "a::b". | ||
| 71 | char *getFunctionDeclContextName(char *Buf, size_t *N) const; | ||
| 72 | |||
| 73 | /// Get the entire name of this function. | ||
| 74 | char *getFunctionName(char *Buf, size_t *N) const; | ||
| 75 | |||
| 76 | /// Get the parameters for this function. | ||
| 77 | char *getFunctionParameters(char *Buf, size_t *N) const; | ||
| 78 | char *getFunctionReturnType(char *Buf, size_t *N) const; | ||
| 79 | |||
| 80 | /// If this function has any any cv or reference qualifiers. These imply that | ||
| 81 | /// the function is a non-static member function. | ||
| 82 | bool hasFunctionQualifiers() const; | ||
| 83 | |||
| 84 | /// If this symbol describes a constructor or destructor. | ||
| 85 | bool isCtorOrDtor() const; | ||
| 86 | |||
| 87 | /// If this symbol describes a function. | ||
| 88 | bool isFunction() const; | ||
| 89 | |||
| 90 | /// If this symbol describes a variable. | ||
| 91 | bool isData() const; | ||
| 92 | |||
| 93 | /// If this symbol is a <special-name>. These are generally implicitly | ||
| 94 | /// generated by the implementation, such as vtables and typeinfo names. | ||
| 95 | bool isSpecialName() const; | ||
| 96 | |||
| 97 | ~ItaniumPartialDemangler(); | ||
| 98 | private: | ||
| 99 | void *RootNode; | ||
| 100 | void *Context; | ||
| 101 | }; | ||
| 102 | } // namespace llvm | ||
| 103 | |||
| 104 | #endif | ||