[PATCH] D23793: [ELF] - Cleanup of scanVersionScript(): do not change local Demangled variable.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 02:37:58 PDT 2016


grimar updated the summary for this revision.
grimar updated this revision to Diff 69217.
grimar added a comment.

- Do not make Demangled to be const (that reduces amount of changes). Since main aim of the patch is stop

modifying Demangled for correctness of futher patches, this change is itself enough.


https://reviews.llvm.org/D23793

Files:
  ELF/SymbolTable.cpp

Index: ELF/SymbolTable.cpp
===================================================================
--- ELF/SymbolTable.cpp
+++ ELF/SymbolTable.cpp
@@ -613,6 +613,14 @@
   return false;
 }
 
+static SymbolBody *findDemangled(const std::map<std::string, SymbolBody *> &D,
+                                 StringRef Name) {
+  auto I = D.find(Name);
+  if (I != D.end())
+    return I->second;
+  return nullptr;
+}
+
 // This function processes the --version-script option by marking all global
 // symbols with the VersionScriptGlobal flag, which acts as a filter on the
 // dynamic symbol table.
@@ -647,8 +655,9 @@
     for (SymbolVersion Sym : V.Globals) {
       if (hasWildcard(Sym.Name))
         continue;
-      SymbolBody *B = Sym.IsExternCpp ? Demangled[Sym.Name] : find(Sym.Name);
-      setVersionId(B, V.Name, Sym.Name, V.Id);
+      StringRef N = Sym.Name;
+      SymbolBody *B = Sym.IsExternCpp ? findDemangled(Demangled, N) : find(N);
+      setVersionId(B, V.Name, N, V.Id);
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23793.69217.patch
Type: text/x-patch
Size: 1027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160825/1efc49ba/attachment.bin>


More information about the llvm-commits mailing list