forked from OSchip/llvm-project
				
			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
This commit is contained in:
		
							parent
							
								
									adb58e7598
								
							
						
					
					
						commit
						8f687f71fb
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue