File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ char *dlangDemangle(std::string_view MangledName);
67
67
// / demangling occurred.
68
68
std::string demangle (std::string_view MangledName);
69
69
70
+ // / demangle a string to get the function name.
71
+ std::string demangleGetFunctionName (std::string_view MangledName);
72
+
70
73
bool nonMicrosoftDemangle (std::string_view MangledName, std::string &Result);
71
74
72
75
// / "Partial" demangler. This supports demangling a string into an AST
Original file line number Diff line number Diff line change 17
17
18
18
using llvm::itanium_demangle::starts_with;
19
19
20
+ // / demangle a string to get the function name.
21
+ std::string llvm::demangleGetFunctionName (std::string_view MangledName) {
22
+ std::string DemangledStr = llvm::demangle (MangledName);
23
+ size_t StartIndex = DemangledStr.find (" (" );
24
+ if (StartIndex != std::string::npos) {
25
+ size_t EndIndex = DemangledStr.rfind (" " , StartIndex);
26
+ if (EndIndex != std::string::npos) {
27
+ DemangledStr =
28
+ DemangledStr.substr (EndIndex + 1 , StartIndex - EndIndex - 1 );
29
+ }
30
+ }
31
+ return DemangledStr;
32
+ }
33
+
20
34
std::string llvm::demangle (std::string_view MangledName) {
21
35
std::string Result;
22
36
You can’t perform that action at this time.
0 commit comments