-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm-cxxfilt] Add --quote option to quote demangled function names #111871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c2d7d4e
d3553f3
0ca7195
ecd1d77
2e070db
8867ce7
f4f4799
634979c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,10 +52,10 @@ OPTIONS | |
|
|
||
| Do not demangle function parameters or return types. | ||
|
|
||
| .. option:: --quote, -q | ||
| .. option:: --quote | ||
|
|
||
| Add `"` `"` around demangled function symbols, typically to keep LLVM/MLIR | ||
| assembly files with `@<symbols>` valid. Do not quote already quoted symbols. | ||
| Add `"` `"` around demangled function symbols. | ||
| Do not quote already quoted symbols. | ||
|
||
|
|
||
| .. option:: --no-strip-underscore, -n | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,12 +1,21 @@ | ||||||
| // Show that llvm-cxxfilt --quote can emit quoted demangled symbols but not | ||||||
| // without double-quoting in the case they are already quoted | ||||||
| // Show that llvm-cxxfilt --quote can emit quoted demangled symbols (even at the | ||||||
| // end of a line) but not without double-quoting in the case they are already | ||||||
| // quoted. | ||||||
keryell marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| RUN: echo _Z3barv '"_Z3barv"' > %t | ||||||
| RUN: echo '"_Z3barv"' _Z3barv >> %t | ||||||
| // This is not mangled, thus it should not be quoted | ||||||
| RUN: echo 'log()' >> %t | ||||||
| // Check that an "import thunk for" prefix can be quoted along the demangled name | ||||||
| RUN: echo __imp__ZSt6futureIvE >> %t | ||||||
|
||||||
| RUN: llvm-cxxfilt --quote < %t | FileCheck --match-full-lines --check-prefix=CHECK-FILE %s | ||||||
| CHECK-FILE: "bar()" "bar()" | ||||||
| CHECK-FILE-NEXT: "bar()" "bar()" | ||||||
| CHECK-FILE-NEXT: log() | ||||||
| CHECK-FILE-NEXT: "import thunk for std::future<void>" | ||||||
|
|
||||||
| RUN: llvm-cxxfilt --quote < %s | FileCheck %s | ||||||
| cir.call @_ZN3aie4tileILi1ELi4EE7programIZ4mainE3$_0EEvOT_(%2, %7) : (!cir.ptr<!ty_aie3A3Atile3C12C_43E>, !cir.ptr<!ty_anon2E0_>) -> () loc(#loc74) | ||||||
| cir.func lambda internal private @_ZZ4mainENK3$_1clEv(%arg0: !cir.ptr<!ty_anon2E1_> loc("example.cpp":31:26)) extra(#fn_attr) { | ||||||
| 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]>]]} | ||||||
|
|
||||||
| CHECK: cir.call @"void aie::tile<1, 4>::program<main::$_0>(main::$_0&&)"(%2, %7) | ||||||
| CHECK-NEXT: cir.func lambda internal private @"main::$_1::operator()() const"(%arg0: !cir.ptr<!ty_anon2E1_> | ||||||
| // \todo Is there a simpler way to escape these [[ leading to "error: invalid variable name" otherwise? | ||||||
| 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]>]]} | ||||||
| // Check it works with cli symbols too. Since a quoted mangled name is not a | ||||||
| // mangled name, it should be unchanged | ||||||
|
||||||
| // mangled name, it should be unchanged | |
| // mangled name, it should be unchanged. |
Nit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not addressed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like I messed up in conflict resolution when I rebased my commit on top of the one I made on GitHub UI with your suggestions.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-NEXT prefixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This should appear after
--no-strip-underscoreto maintain alphabetical order.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.