diff options
author | Rui Ueyama <ruiu@google.com> | 2016-12-19 03:14:16 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-12-19 03:14:16 +0000 |
commit | 8f687f71fb03147db3f752f55465bd7ac639fb8c (patch) | |
tree | e9f63d4943c46cfead0ce1db28d1d3142264ec4a /lld | |
parent | adb58e7598595c337d42b5636d78a8115ee4ef18 (diff) | |
download | bcm5719-llvm-8f687f71fb03147db3f752f55465bd7ac639fb8c.tar.gz bcm5719-llvm-8f687f71fb03147db3f752f55465bd7ac639fb8c.zip |
Remove inappropriate use of CachedHashStringRef.
Use of CachedHashStringRef makes sense only when we reuse hash values.
Sprinkling it to all DenseMap has no benefits and just complicates data types.
Basically we shouldn't use CachedHashStringRef unless there is a strong
reason to to do so.
llvm-svn: 290076
Diffstat (limited to 'lld')
-rw-r--r-- | lld/ELF/Config.h | 3 | ||||
-rw-r--r-- | lld/ELF/Driver.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/InputSection.h | 1 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 5 |
4 files changed, 5 insertions, 6 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index 890e33afbab..d8e78e0e25c 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -10,7 +10,6 @@ #ifndef LLD_ELF_CONFIG_H #define LLD_ELF_CONFIG_H -#include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ELF.h" @@ -72,7 +71,7 @@ struct VersionDefinition { struct Configuration { InputFile *FirstElf = nullptr; uint8_t OSABI = 0; - llvm::DenseMap<llvm::CachedHashStringRef, unsigned> SymbolOrderingFile; + llvm::DenseMap<llvm::StringRef, unsigned> SymbolOrderingFile; llvm::StringMap<uint64_t> SectionStartMap; llvm::StringRef DynamicLinker; llvm::StringRef Entry; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 521b6182e28..935da5dacc3 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -487,7 +487,7 @@ static void parseSymbolOrderingList(MemoryBufferRef MB) { SmallVector<StringRef, 0> Arr; MB.getBuffer().split(Arr, '\n'); for (StringRef S : Arr) - Config->SymbolOrderingFile.insert({CachedHashStringRef(S.trim()), I++}); + Config->SymbolOrderingFile.insert({S.trim(), I++}); } // Initializes Config members by the command line options. diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index 617ad7b4ba4..af22254ad05 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -14,6 +14,7 @@ #include "Relocations.h" #include "Thunks.h" #include "lld/Core/LLVM.h" +#include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/TinyPtrVector.h" #include "llvm/Object/ELF.h" diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index e8d517d211d..4c03e891030 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -770,8 +770,7 @@ static void sortBySymbolsOrder(ArrayRef<OutputSectionBase *> V) { auto *D = dyn_cast<DefinedRegular<ELFT>>(Body); if (!D || !D->Section) continue; - auto It = - Config->SymbolOrderingFile.find(CachedHashString(Body->getName())); + auto It = Config->SymbolOrderingFile.find(Body->getName()); if (It == Config->SymbolOrderingFile.end()) continue; @@ -782,7 +781,7 @@ static void sortBySymbolsOrder(ArrayRef<OutputSectionBase *> V) { } for (OutputSectionBase *Base : V) - if (OutputSection<ELFT> *Sec = dyn_cast<OutputSection<ELFT>>(Base)) + if (auto *Sec = dyn_cast<OutputSection<ELFT>>(Base)) Sec->sort([&](InputSection<ELFT> *S) { auto It = SectionsOrder.find(S); return It == SectionsOrder.end() ? UINT32_MAX : It->second; |