summaryrefslogtreecommitdiff
path: root/externals/demangle/llvm/Demangle/Demangle.h
diff options
context:
space:
mode:
authorGravatar bunnei2023-01-24 11:03:14 -0800
committerGravatar GitHub2023-01-24 11:03:14 -0800
commit44b981fd3eb3db5c15bcc24e61bae45607223ee6 (patch)
tree62d8081e018120505df0832ca9af1671be8e8d1f /externals/demangle/llvm/Demangle/Demangle.h
parentMerge pull request #9492 from german77/joycon_release (diff)
parentcmake: prefer system llvm library (diff)
downloadyuzu-44b981fd3eb3db5c15bcc24e61bae45607223ee6.tar.gz
yuzu-44b981fd3eb3db5c15bcc24e61bae45607223ee6.tar.xz
yuzu-44b981fd3eb3db5c15bcc24e61bae45607223ee6.zip
Merge pull request #9662 from abouvier/cmake-llvm
cmake: prefer system llvm library
Diffstat (limited to 'externals/demangle/llvm/Demangle/Demangle.h')
-rw-r--r--externals/demangle/llvm/Demangle/Demangle.h104
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
16namespace 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
24enum : 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
32char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n,
33 int *status);
34
35
36enum 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};
44char *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.
50struct 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();
98private:
99 void *RootNode;
100 void *Context;
101};
102} // namespace llvm
103
104#endif