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);
6767// / demangling occurred.
6868std::string demangle (std::string_view MangledName);
6969
70+ // / demangle a string to get the function name.
71+ std::string demangleGetFunctionName (std::string_view MangledName);
72+
7073bool nonMicrosoftDemangle (std::string_view MangledName, std::string &Result);
7174
7275// / "Partial" demangler. This supports demangling a string into an AST
Original file line number Diff line number Diff line change 1717
1818using llvm::itanium_demangle::starts_with;
1919
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+
2034std::string llvm::demangle (std::string_view MangledName) {
2135 std::string Result;
2236
You can’t perform that action at this time.
0 commit comments