LLVM: lib/Demangle/Demangle.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
15#include
16#include <string_view>
17
18using llvm::itanium_demangle::starts_with;
19
21 std::string Result;
22
24 return Result;
25
28 false))
29 return Result;
30
31 if (char *Demangled = microsoftDemangle(MangledName, nullptr, nullptr)) {
32 Result = Demangled;
33 std::free(Demangled);
34 } else {
35 Result = MangledName;
36 }
37 return Result;
38}
39
41
42 const size_t Pos = S.find_first_not_of('_');
43 return Pos > 0 && Pos <= 4 && S[Pos] == 'Z';
44}
45
47
49
51 std::string &Result, bool CanHaveLeadingDot,
52 bool ParseParams) {
53 char *Demangled = nullptr;
54
55
56 if (CanHaveLeadingDot && MangledName.size() > 0 && MangledName[0] == '.') {
57 MangledName.remove_prefix(1);
58 Result = ".";
59 }
60
67
68 if (!Demangled)
69 return false;
70
71 Result += Demangled;
72 std::free(Demangled);
73 return true;
74}
static bool isRustEncoding(std::string_view S)
Definition Demangle.cpp:46
static bool isDLangEncoding(std::string_view S)
Definition Demangle.cpp:48
static bool isItaniumEncoding(std::string_view S)
Definition Demangle.cpp:40
DEMANGLE_ABI bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result, bool CanHaveLeadingDot=true, bool ParseParams=true)
Definition Demangle.cpp:50
DEMANGLE_ABI char * itaniumDemangle(std::string_view mangled_name, bool ParseParams=true)
Returns a non-NULL pointer to a NUL-terminated C style string that should be explicitly freed,...
DEMANGLE_ABI char * dlangDemangle(std::string_view MangledName)
DEMANGLE_ABI char * rustDemangle(std::string_view MangledName)
DEMANGLE_ABI char * microsoftDemangle(std::string_view mangled_name, size_t *n_read, int *status, MSDemangleFlags Flags=MSDF_None)
Demangles the Microsoft symbol pointed at by mangled_name and returns it.
DEMANGLE_ABI std::string demangle(std::string_view MangledName)
Attempt to demangle a string using different demangling schemes.
Definition Demangle.cpp:20