Skip to content

Commit 0ca7195

Browse files
committed
[llvm-cxxfilt] Make --quote to work with "import thunk for" prefix
1 parent d3553f3 commit 0ca7195

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/test/tools/llvm-cxxfilt/quote.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ RUN: echo _Z3barv '"_Z3barv"' > %t
55
RUN: echo '"_Z3barv"' _Z3barv >> %t
66
// This is not mangled, thus it should not be quoted
77
RUN: echo 'log()' >> %t
8+
// Check that an "import thunk for" prefix can be quoted along the demangled name
9+
RUN: echo __imp__ZSt6futureIvE >> %t
810
RUN: llvm-cxxfilt --quote < %t | FileCheck --match-full-lines --check-prefix=CHECK-FILE %s
911
CHECK-FILE: "bar()" "bar()"
1012
CHECK-FILE-NEXT: "bar()" "bar()"
1113
CHECK-FILE-NEXT: log()
14+
CHECK-FILE-NEXT: "import thunk for std::future<void>"
1215

1316
// Check it works with cli symbols too. Since a quoted mangled name is not a
1417
// mangled name, it should be unchanged

llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static void error(const Twine &Message) {
6666
}
6767

6868
// Quote Undecorated with "" if asked for and not already followed by a '"'
69-
static std::string optionalQuote(std::string Undecorated,
69+
static std::string optionalQuote(const std::string &Undecorated,
7070
StringRef Delimiters) {
7171
if (Quote && (Delimiters.empty() || Delimiters[0] != '"'))
7272
return '"' + Undecorated + '"';
@@ -99,7 +99,7 @@ static std::string demangle(const std::string &Mangled, StringRef Delimiters) {
9999
}
100100

101101
Result =
102-
Undecorated ? Prefix + optionalQuote(Undecorated, Delimiters) : Mangled;
102+
Undecorated ? optionalQuote(Prefix + Undecorated, Delimiters) : Mangled;
103103
free(Undecorated);
104104
return Result;
105105
}

0 commit comments

Comments
 (0)