[PATCH] D139864: [llvm-cxxfilt] Not consider the prefix dot as part of the demangled symbol name.
Digger Lin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 1 10:59:50 PDT 2023
DiggerLin updated this revision to Diff 518451.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139864/new/
https://reviews.llvm.org/D139864
Files:
llvm/test/tools/llvm-cxxfilt/delimiters.test
llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
Index: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
===================================================================
--- llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
+++ llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
@@ -66,13 +66,21 @@
static std::string demangle(const std::string &Mangled) {
const char *DecoratedStr = Mangled.c_str();
+ std::string DotPrefix;
+
+ // Not consider the prefix dot as part of the demangled symbol name.
+ if (DecoratedStr[0] == '.') {
+ ++DecoratedStr;
+ DotPrefix = ".";
+ }
+
if (StripUnderscore)
if (DecoratedStr[0] == '_')
++DecoratedStr;
std::string Result;
if (nonMicrosoftDemangle(DecoratedStr, Result))
- return Result;
+ return DotPrefix + Result;
std::string Prefix;
char *Undecorated = nullptr;
@@ -85,7 +93,7 @@
Undecorated = itaniumDemangle(DecoratedStr + 6, nullptr, nullptr, nullptr);
}
- Result = Undecorated ? Prefix + Undecorated : Mangled;
+ Result = Undecorated ? DotPrefix + Prefix + Undecorated : Mangled;
free(Undecorated);
return Result;
}
Index: llvm/test/tools/llvm-cxxfilt/delimiters.test
===================================================================
--- llvm/test/tools/llvm-cxxfilt/delimiters.test
+++ llvm/test/tools/llvm-cxxfilt/delimiters.test
@@ -32,7 +32,10 @@
COM: Piping the echo output causes '⦙' to be converted to '?' in some
COM: builds/environments. Redirect echo output to and from %t to work
COM: around this. See D111072.
-RUN: '_Z3Foo$ ._Z3Foo' > %t
+RUN: '_Z3Foo$ _Z3f.0v' \
+## Show that the llvm-cxxfilt does not consider the prefix dot as part of the demangled symbol name.
+RUN: '._Z3Foo ._Z3f.0v' \
+RUN: '._ZL5func0v ._Z5func1i' > %t
RUN: llvm-cxxfilt -n < %t | FileCheck %s
CHECK: ,,Foo!
@@ -66,4 +69,7 @@
CHECK: Foo~,,
CHECK: Foo⦙Bar
CHECK: Foo,,Bar::Baz Foo,Bar:Baz
-CHECK: _Z3Foo$ ._Z3Foo
+CHECK: _Z3Foo$ f.0()
+CHECK: .Foo .f.0()
+CHECK: .func0()
+CHECK: .func1(int)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139864.518451.patch
Type: text/x-patch
Size: 1965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230501/c09811ce/attachment.bin>
More information about the llvm-commits
mailing list