[PATCH] D11785: [llvm-symbolizer] Remove underscores and other C mangling on Windows

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 17:52:27 PDT 2015


samsonov added inline comments.

================
Comment at: tools/llvm-symbolizer/LLVMSymbolize.cpp:92
@@ +91,3 @@
+  // Remove any '_' or '@' prefix.
+  char Front = SymbolName.empty() ? '\0' : SymbolName[0];
+  if (Front == '_' || Front == '@')
----------------
See below - if you make it a part of `DemangleName` , you can simplify the code with early-returns.

================
Comment at: tools/llvm-symbolizer/LLVMSymbolize.cpp:226
@@ -180,1 +225,3 @@
       }
+      if (Opts.Demangle && isWin32Module())
+        demangleCOFFExternCFunc(LineInfo);
----------------
rnk wrote:
> samsonov wrote:
> > This is not the place we demangle the function names - see `LLVMSymbolizer::DemangleName`. At that point we already lose the knowledge of whether the module was ELF, or COFF, or MachO, but is it that important? Also, why doesn't `::UnDecorateSymbolName` work for you?
> Yes, it's important that we only do this for 32-bit x86 symbols, which requires looking at the machine type of the module. See isWin32Module().
> 
> UnDecorateSymbolName only handles C++ symbols. This won't interfere because C++ symbols all start with '?'.
Still, let's keep all the demangling work in a single place - where we actually render DILineInfo entries. If you need to know smth. about the object file that produced these DILineInfo entries (which looks reasonable - demangling is obviously format-dependent) - just pass it down to printDILineInfo/DemangleName.


http://reviews.llvm.org/D11785





More information about the llvm-commits mailing list