99#ifndef LLVM_DEMANGLE_DEMANGLE_H
1010#define LLVM_DEMANGLE_DEMANGLE_H
1111
12+ #include " DemangleConfig.h"
1213#include < cstddef>
1314#include < optional>
1415#include < string>
@@ -33,7 +34,8 @@ enum : int {
3334// / Returns a non-NULL pointer to a NUL-terminated C style string
3435// / that should be explicitly freed, if successful. Otherwise, may return
3536// / 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,
38+ bool ParseParams = true );
3739
3840enum MSDemangleFlags {
3941 MSDF_None = 0 ,
@@ -52,87 +54,90 @@ enum MSDemangleFlags {
5254// / bytes of the input string were consumed.
5355// / status receives one of the demangle_ enum entries above if it's not nullptr.
5456// / Flags controls various details of the demangled representation.
55- char *microsoftDemangle (std::string_view mangled_name, size_t *n_read,
56- int *status, MSDemangleFlags Flags = MSDF_None);
57+ DEMANGLE_ABI char *microsoftDemangle (std::string_view mangled_name,
58+ size_t *n_read, int *status,
59+ MSDemangleFlags Flags = MSDF_None);
5760
58- std::optional<size_t >
61+ DEMANGLE_ABI std::optional<size_t >
5962getArm64ECInsertionPointInMangledName (std::string_view MangledName);
6063
6164// Demangles a Rust v0 mangled symbol.
62- char *rustDemangle (std::string_view MangledName);
65+ DEMANGLE_ABI char *rustDemangle (std::string_view MangledName);
6366
6467// Demangles a D mangled symbol.
65- char *dlangDemangle (std::string_view MangledName);
68+ DEMANGLE_ABI char *dlangDemangle (std::string_view MangledName);
6669
6770// / Attempt to demangle a string using different demangling schemes.
6871// / The function uses heuristics to determine which demangling scheme to use.
6972// / \param MangledName - reference to string to demangle.
7073// / \returns - the demangled string, or a copy of the input string if no
7174// / demangling occurred.
72- std::string demangle (std::string_view MangledName);
75+ DEMANGLE_ABI std::string demangle (std::string_view MangledName);
7376
74- bool nonMicrosoftDemangle (std::string_view MangledName, std::string &Result,
75- bool CanHaveLeadingDot = true ,
76- bool ParseParams = true );
77+ DEMANGLE_ABI bool nonMicrosoftDemangle (std::string_view MangledName,
78+ std::string &Result,
79+ bool CanHaveLeadingDot = true ,
80+ bool ParseParams = true );
7781
7882// / "Partial" demangler. This supports demangling a string into an AST
7983// / (typically an intermediate stage in itaniumDemangle) and querying certain
8084// / properties or partially printing the demangled name.
8185struct ItaniumPartialDemangler {
82- ItaniumPartialDemangler ();
86+ DEMANGLE_ABI ItaniumPartialDemangler ();
8387
84- ItaniumPartialDemangler (ItaniumPartialDemangler &&Other);
85- ItaniumPartialDemangler &operator =(ItaniumPartialDemangler &&Other);
88+ DEMANGLE_ABI ItaniumPartialDemangler (ItaniumPartialDemangler &&Other);
89+ DEMANGLE_ABI ItaniumPartialDemangler &
90+ operator =(ItaniumPartialDemangler &&Other);
8691
8792 // / Demangle into an AST. Subsequent calls to the rest of the member functions
8893 // / implicitly operate on the AST this produces.
8994 // / \return true on error, false otherwise
90- bool partialDemangle (const char *MangledName);
95+ DEMANGLE_ABI bool partialDemangle (const char *MangledName);
9196
9297 // / Just print the entire mangled name into Buf. Buf and N behave like the
9398 // / second and third parameters to __cxa_demangle.
94- char *finishDemangle (char *Buf, size_t *N) const ;
99+ DEMANGLE_ABI char *finishDemangle (char *Buf, size_t *N) const ;
95100
96101 // / See \ref finishDemangle
97102 // /
98103 // / \param[in] OB A llvm::itanium_demangle::OutputBuffer that the demangled
99104 // / name will be printed into.
100105 // /
101- char *finishDemangle (void *OB) const ;
106+ DEMANGLE_ABI char *finishDemangle (void *OB) const ;
102107
103108 // / Get the base name of a function. This doesn't include trailing template
104109 // / arguments, ie for "a::b<int>" this function returns "b".
105- char *getFunctionBaseName (char *Buf, size_t *N) const ;
110+ DEMANGLE_ABI char *getFunctionBaseName (char *Buf, size_t *N) const ;
106111
107112 // / Get the context name for a function. For "a::b::c", this function returns
108113 // / "a::b".
109- char *getFunctionDeclContextName (char *Buf, size_t *N) const ;
114+ DEMANGLE_ABI char *getFunctionDeclContextName (char *Buf, size_t *N) const ;
110115
111116 // / Get the entire name of this function.
112- char *getFunctionName (char *Buf, size_t *N) const ;
117+ DEMANGLE_ABI char *getFunctionName (char *Buf, size_t *N) const ;
113118
114119 // / Get the parameters for this function.
115- char *getFunctionParameters (char *Buf, size_t *N) const ;
116- char *getFunctionReturnType (char *Buf, size_t *N) const ;
120+ DEMANGLE_ABI char *getFunctionParameters (char *Buf, size_t *N) const ;
121+ DEMANGLE_ABI char *getFunctionReturnType (char *Buf, size_t *N) const ;
117122
118123 // / If this function has any cv or reference qualifiers. These imply that
119124 // / the function is a non-static member function.
120- bool hasFunctionQualifiers () const ;
125+ DEMANGLE_ABI bool hasFunctionQualifiers () const ;
121126
122127 // / If this symbol describes a constructor or destructor.
123- bool isCtorOrDtor () const ;
128+ DEMANGLE_ABI bool isCtorOrDtor () const ;
124129
125130 // / If this symbol describes a function.
126- bool isFunction () const ;
131+ DEMANGLE_ABI bool isFunction () const ;
127132
128133 // / If this symbol describes a variable.
129- bool isData () const ;
134+ DEMANGLE_ABI bool isData () const ;
130135
131136 // / If this symbol is a <special-name>. These are generally implicitly
132137 // / generated by the implementation, such as vtables and typeinfo names.
133- bool isSpecialName () const ;
138+ DEMANGLE_ABI bool isSpecialName () const ;
134139
135- ~ItaniumPartialDemangler ();
140+ DEMANGLE_ABI ~ItaniumPartialDemangler ();
136141
137142private:
138143 void *RootNode;
0 commit comments