[PATCH] D25646: Use CachedHashStringRef instead of CachedHash<StringRef>.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 11:00:01 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL284502: Use CachedHashStringRef instead of CachedHash<StringRef>. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D25646?vs=74774&id=75037#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25646

Files:
  lld/trunk/ELF/SymbolTable.cpp
  lld/trunk/ELF/SymbolTable.h


Index: lld/trunk/ELF/SymbolTable.cpp
===================================================================
--- lld/trunk/ELF/SymbolTable.cpp
+++ lld/trunk/ELF/SymbolTable.cpp
@@ -140,7 +140,7 @@
 // Set a flag for --trace-symbol so that we can print out a log message
 // if a new symbol with the same name is inserted into the symbol table.
 template <class ELFT> void SymbolTable<ELFT>::trace(StringRef Name) {
-  Symtab.insert({Name, {-1, true}});
+  Symtab.insert({CachedHashStringRef(Name), {-1, true}});
 }
 
 // Rename SYM as __wrap_SYM. The original symbol is preserved as __real_SYM.
@@ -201,7 +201,8 @@
 // Find an existing symbol or create and insert a new one.
 template <class ELFT>
 std::pair<Symbol *, bool> SymbolTable<ELFT>::insert(StringRef &Name) {
-  auto P = Symtab.insert({Name, SymIndex((int)SymVector.size(), false)});
+  auto P = Symtab.insert(
+      {CachedHashStringRef(Name), SymIndex((int)SymVector.size(), false)});
   SymIndex &V = P.first->second;
   bool IsNew = P.second;
 
@@ -461,7 +462,7 @@
 }
 
 template <class ELFT> SymbolBody *SymbolTable<ELFT>::find(StringRef Name) {
-  auto It = Symtab.find(Name);
+  auto It = Symtab.find(CachedHashStringRef(Name));
   if (It == Symtab.end())
     return nullptr;
   SymIndex V = It->second;
Index: lld/trunk/ELF/SymbolTable.h
===================================================================
--- lld/trunk/ELF/SymbolTable.h
+++ lld/trunk/ELF/SymbolTable.h
@@ -12,6 +12,7 @@
 
 #include "InputFiles.h"
 #include "LTO.h"
+#include "llvm/ADT/CachedHashString.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Regex.h"
 
@@ -21,7 +22,7 @@
 template <class ELFT> class OutputSectionBase;
 struct Symbol;
 
-typedef llvm::CachedHash<StringRef> SymName;
+typedef llvm::CachedHashStringRef SymName;
 
 // SymbolTable is a bucket of all known symbols, including defined,
 // undefined, or lazy symbols (the last one is symbols in archive


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25646.75037.patch
Type: text/x-patch
Size: 1919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161018/e7d79ed2/attachment.bin>


More information about the llvm-commits mailing list