Skip to content

Commit d3553f3

Browse files
committed
[llvm-cxxfilt] Apply PR review feedback
Thanks @jh7370
1 parent c2d7d4e commit d3553f3

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

llvm/docs/CommandGuide/llvm-cxxfilt.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ OPTIONS
5252

5353
Do not demangle function parameters or return types.
5454

55-
.. option:: --quote, -q
55+
.. option:: --quote
5656

57-
Add `"` `"` around demangled function symbols, typically to keep LLVM/MLIR
58-
assembly files with `@<symbols>` valid. Do not quote already quoted symbols.
57+
Add `"` `"` around demangled function symbols.
58+
Do not quote already quoted symbols.
5959

6060
.. option:: --no-strip-underscore, -n
6161

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
// Show that llvm-cxxfilt --quote can emit quoted demangled symbols but not
2-
// without double-quoting in the case they are already quoted
1+
// Show that llvm-cxxfilt --quote can emit quoted demangled symbols (even at the
2+
// end of a line) but not without double-quoting in the case they are already
3+
// quoted.
4+
RUN: echo _Z3barv '"_Z3barv"' > %t
5+
RUN: echo '"_Z3barv"' _Z3barv >> %t
6+
// This is not mangled, thus it should not be quoted
7+
RUN: echo 'log()' >> %t
8+
RUN: llvm-cxxfilt --quote < %t | FileCheck --match-full-lines --check-prefix=CHECK-FILE %s
9+
CHECK-FILE: "bar()" "bar()"
10+
CHECK-FILE-NEXT: "bar()" "bar()"
11+
CHECK-FILE-NEXT: log()
312

4-
RUN: llvm-cxxfilt --quote < %s | FileCheck %s
5-
cir.call @_ZN3aie4tileILi1ELi4EE7programIZ4mainE3$_0EEvOT_(%2, %7) : (!cir.ptr<!ty_aie3A3Atile3C12C_43E>, !cir.ptr<!ty_anon2E0_>) -> () loc(#loc74)
6-
cir.func lambda internal private @_ZZ4mainENK3$_1clEv(%arg0: !cir.ptr<!ty_anon2E1_> loc("example.cpp":31:26)) extra(#fn_attr) {
7-
module @"example.cpp" attributes {cir.global_annotations = #cir<global_annotations [["_ZN3aie6deviceILNS_3$_0E42EE4tileILi1ELi4EEENS_4tileIXT_EXT0_EEEv", #cir.annotation<name = "aie.device.tile", args = [1 : i32, 4 : i32, 42 : i8, 42 : i8]>]]}
8-
9-
CHECK: cir.call @"void aie::tile<1, 4>::program<main::$_0>(main::$_0&&)"(%2, %7)
10-
CHECK-NEXT: cir.func lambda internal private @"main::$_1::operator()() const"(%arg0: !cir.ptr<!ty_anon2E1_>
11-
// \todo Is there a simpler way to escape these [[ leading to "error: invalid variable name" otherwise?
12-
CHECK-NEXT: module @"example.cpp" attributes {cir.global_annotations = #cir<global_annotations {{[[]}}["aie::tile<1, 4> aie::device<(aie::$_0)42>::tile<1, 4>()", #cir.annotation<name = "aie.device.tile", args = [1 : i32, 4 : i32, 42 : i8, 42 : i8]>]]}
13+
// Check it works with cli symbols too. Since a quoted mangled name is not a
14+
// mangled name, it should be unchanged
15+
RUN: llvm-cxxfilt --quote _Z3firv '"_Z3barv"' 'saw()' | FileCheck --match-full-lines --check-prefix=CHECK-CLI %s
16+
CHECK-CLI: "fir()"
17+
CHECK-CLI: "_Z3barv"
18+
CHECK-CLI: saw()

llvm/tools/llvm-cxxfilt/Opts.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ multiclass Eq<string name, string help> {
1515
}
1616

1717
def help : FF<"help", "Display this help">;
18-
def quote : FF<"quote", "Quote demangled function names with \" \" if not already quoted. Useful for symbols appearing after an @ in MLIR/LLVM assembly">;
18+
def quote : FF<"quote", "Quote demangled function names with \" \" if not already quoted">;
1919
defm strip_underscore : BB<"strip-underscore", "Strip the leading underscore", "Don't strip the leading underscore">;
2020
def types : FF<"types", "Attempt to demangle types as well as function names">;
2121
def no_params : FF<"no-params", "Skip function parameters and return types">;
@@ -28,5 +28,4 @@ def : F<"_", "Alias for --strip-underscore">, Alias<strip_underscore>;
2828
def : F<"h", "Alias for --help">, Alias<help>;
2929
def : F<"n", "Alias for --no-strip-underscore">, Alias<no_strip_underscore>;
3030
def : F<"p", "Alias for --no-params">, Alias<no_params>;
31-
def : F<"q", "Alias for --quote">, Alias<quote>;
3231
def : F<"t", "Alias for --types">, Alias<types>;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "llvm/TargetParser/Triple.h"
2121
#include <cstdlib>
2222
#include <iostream>
23-
#include <string>
2423

2524
using namespace llvm;
2625

0 commit comments

Comments
 (0)