[PATCH] D21930: [ELF] - Implement extern "c++" version script tag

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 14:06:09 PDT 2016


ruiu added a comment.

What I was trying to say is that the code did not look very straightforward. I think you have no choice other than demangle all symbols if "extern" directive is used, so why don't you create a map from demangled names to symbolbodies?


================
Comment at: ELF/SymbolTable.cpp:591
@@ -581,1 +590,3 @@
   //   matching version tag in the file).
+
+  // Handle exact matches and build a map of demangled externs for
----------------
Add

  DenseMap<StringRef, SymbolBody *> Demangled;
  if (hasExternCpp())
    Demangled = getDemangledSyms();

here and then

================
Comment at: ELF/SymbolTable.cpp:609
@@ -587,3 +608,3 @@
 
-      SymbolBody *B = find(Name);
+      SymbolBody *B = find(Sym.Name);
       if (!B || B->isUndefined()) {
----------------
replace this line with

  SymbolBody *B = Sym.IsExternCpp ? Demangled[Sym.Name] : find(Sym.Name);


http://reviews.llvm.org/D21930





More information about the llvm-commits mailing list