[lld] r257685 - Update comment for __cxa_demangle again to make it precise.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 14:09:09 PST 2016


Author: ruiu
Date: Wed Jan 13 16:09:09 2016
New Revision: 257685

URL: http://llvm.org/viewvc/llvm-project?rev=257685&view=rev
Log:
Update comment for __cxa_demangle again to make it precise.

Thanks for Ed Maste for the suggestion.

Modified:
    lld/trunk/ELF/Symbols.cpp

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=257685&r1=257684&r2=257685&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Wed Jan 13 16:09:09 2016
@@ -146,10 +146,11 @@ std::string elf2::demangle(StringRef Nam
   if (!Config->Demangle)
     return Name;
 
-  // Don't call __cxa_demangle if the name does not look like a C++
-  // symbol name. We need this check because some implementations of the
-  // function try to demangle a name as something different (e.g. type name)
-  // if it is not a mangled symbol name.
+  // __cxa_demangle can be used to demangle strings other than symbol
+  // names which do not necessarily start with "_Z". Name can be
+  // either a C or C++ symbol. Don't call __cxa_demangle if the name
+  // does not look like a C++ symbol name to avoid getting unexpected
+  // result for a C symbol that happens to match a mangled type name.
   if (!Name.startswith("_Z"))
     return Name;
 




More information about the llvm-commits mailing list