[PATCH] D34668: llvm-nm: Add suport for symbol demangling (-C/--demangle)

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 12:03:21 PDT 2017


sbc100 added inline comments.


================
Comment at: llvm/trunk/tools/llvm-nm/llvm-nm.cpp:667
 
+static Optional<std::string> demangle(StringRef Name, bool StripUnderscore) {
+  if (StripUnderscore && Name.size() > 0 && Name[0] == '_')
----------------
ruiu wrote:
> This may be a dumb question, but does MachO use the Itanium mangling scheme?
> 
> Does it use both "__Z" and "_Z" as prefixes?
The macho files that llvm generates certainly seem too (see the tests code in this CL). 

It seems they always add the "_", so you either get "__Z" of MachO and "_Z" on Elf.  One or the other, not both.  Based purely on the empirical behaviour of llvm today.


Repository:
  rL LLVM

https://reviews.llvm.org/D34668





More information about the llvm-commits mailing list