9
9
#ifndef LLVM_DEMANGLE_DEMANGLE_H
10
10
#define LLVM_DEMANGLE_DEMANGLE_H
11
11
12
+ #include " llvm/Demangle/Visibility.h"
12
13
#include < cstddef>
13
14
#include < optional>
14
15
#include < string>
@@ -33,7 +34,7 @@ enum : int {
33
34
// / Returns a non-NULL pointer to a NUL-terminated C style string
34
35
// / that should be explicitly freed, if successful. Otherwise, may return
35
36
// / nullptr if mangled_name is not a valid mangling or is nullptr.
36
- char *itaniumDemangle (std::string_view mangled_name, bool ParseParams = true );
37
+ DEMANGLE_ABI char *itaniumDemangle (std::string_view mangled_name, bool ParseParams = true );
37
38
38
39
enum MSDemangleFlags {
39
40
MSDF_None = 0 ,
@@ -52,87 +53,87 @@ enum MSDemangleFlags {
52
53
// / bytes of the input string were consumed.
53
54
// / status receives one of the demangle_ enum entries above if it's not nullptr.
54
55
// / Flags controls various details of the demangled representation.
55
- char *microsoftDemangle (std::string_view mangled_name, size_t *n_read,
56
+ DEMANGLE_ABI char *microsoftDemangle (std::string_view mangled_name, size_t *n_read,
56
57
int *status, MSDemangleFlags Flags = MSDF_None);
57
58
58
- std::optional<size_t >
59
+ DEMANGLE_ABI std::optional<size_t >
59
60
getArm64ECInsertionPointInMangledName (std::string_view MangledName);
60
61
61
62
// Demangles a Rust v0 mangled symbol.
62
- char *rustDemangle (std::string_view MangledName);
63
+ DEMANGLE_ABI char *rustDemangle (std::string_view MangledName);
63
64
64
65
// Demangles a D mangled symbol.
65
- char *dlangDemangle (std::string_view MangledName);
66
+ DEMANGLE_ABI char *dlangDemangle (std::string_view MangledName);
66
67
67
68
// / Attempt to demangle a string using different demangling schemes.
68
69
// / The function uses heuristics to determine which demangling scheme to use.
69
70
// / \param MangledName - reference to string to demangle.
70
71
// / \returns - the demangled string, or a copy of the input string if no
71
72
// / demangling occurred.
72
- std::string demangle (std::string_view MangledName);
73
+ DEMANGLE_ABI std::string demangle (std::string_view MangledName);
73
74
74
- bool nonMicrosoftDemangle (std::string_view MangledName, std::string &Result,
75
+ DEMANGLE_ABI bool nonMicrosoftDemangle (std::string_view MangledName, std::string &Result,
75
76
bool CanHaveLeadingDot = true ,
76
77
bool ParseParams = true );
77
78
78
79
// / "Partial" demangler. This supports demangling a string into an AST
79
80
// / (typically an intermediate stage in itaniumDemangle) and querying certain
80
81
// / properties or partially printing the demangled name.
81
82
struct ItaniumPartialDemangler {
82
- ItaniumPartialDemangler ();
83
+ DEMANGLE_ABI ItaniumPartialDemangler ();
83
84
84
- ItaniumPartialDemangler (ItaniumPartialDemangler &&Other);
85
- ItaniumPartialDemangler &operator =(ItaniumPartialDemangler &&Other);
85
+ DEMANGLE_ABI ItaniumPartialDemangler (ItaniumPartialDemangler &&Other);
86
+ DEMANGLE_ABI ItaniumPartialDemangler &operator =(ItaniumPartialDemangler &&Other);
86
87
87
88
// / Demangle into an AST. Subsequent calls to the rest of the member functions
88
89
// / implicitly operate on the AST this produces.
89
90
// / \return true on error, false otherwise
90
- bool partialDemangle (const char *MangledName);
91
+ DEMANGLE_ABI bool partialDemangle (const char *MangledName);
91
92
92
93
// / Just print the entire mangled name into Buf. Buf and N behave like the
93
94
// / second and third parameters to __cxa_demangle.
94
- char *finishDemangle (char *Buf, size_t *N) const ;
95
+ DEMANGLE_ABI char *finishDemangle (char *Buf, size_t *N) const ;
95
96
96
97
// / See \ref finishDemangle
97
98
// /
98
99
// / \param[in] OB A llvm::itanium_demangle::OutputBuffer that the demangled
99
100
// / name will be printed into.
100
101
// /
101
- char *finishDemangle (void *OB) const ;
102
+ DEMANGLE_ABI char *finishDemangle (void *OB) const ;
102
103
103
104
// / Get the base name of a function. This doesn't include trailing template
104
105
// / arguments, ie for "a::b<int>" this function returns "b".
105
- char *getFunctionBaseName (char *Buf, size_t *N) const ;
106
+ DEMANGLE_ABI char *getFunctionBaseName (char *Buf, size_t *N) const ;
106
107
107
108
// / Get the context name for a function. For "a::b::c", this function returns
108
109
// / "a::b".
109
- char *getFunctionDeclContextName (char *Buf, size_t *N) const ;
110
+ DEMANGLE_ABI char *getFunctionDeclContextName (char *Buf, size_t *N) const ;
110
111
111
112
// / Get the entire name of this function.
112
- char *getFunctionName (char *Buf, size_t *N) const ;
113
+ DEMANGLE_ABI char *getFunctionName (char *Buf, size_t *N) const ;
113
114
114
115
// / Get the parameters for this function.
115
- char *getFunctionParameters (char *Buf, size_t *N) const ;
116
- char *getFunctionReturnType (char *Buf, size_t *N) const ;
116
+ DEMANGLE_ABI char *getFunctionParameters (char *Buf, size_t *N) const ;
117
+ DEMANGLE_ABI char *getFunctionReturnType (char *Buf, size_t *N) const ;
117
118
118
119
// / If this function has any cv or reference qualifiers. These imply that
119
120
// / the function is a non-static member function.
120
- bool hasFunctionQualifiers () const ;
121
+ DEMANGLE_ABI bool hasFunctionQualifiers () const ;
121
122
122
123
// / If this symbol describes a constructor or destructor.
123
- bool isCtorOrDtor () const ;
124
+ DEMANGLE_ABI bool isCtorOrDtor () const ;
124
125
125
126
// / If this symbol describes a function.
126
- bool isFunction () const ;
127
+ DEMANGLE_ABI bool isFunction () const ;
127
128
128
129
// / If this symbol describes a variable.
129
- bool isData () const ;
130
+ DEMANGLE_ABI bool isData () const ;
130
131
131
132
// / If this symbol is a <special-name>. These are generally implicitly
132
133
// / generated by the implementation, such as vtables and typeinfo names.
133
- bool isSpecialName () const ;
134
+ DEMANGLE_ABI bool isSpecialName () const ;
134
135
135
- ~ItaniumPartialDemangler ();
136
+ DEMANGLE_ABI ~ItaniumPartialDemangler ();
136
137
137
138
private:
138
139
void *RootNode;
0 commit comments