[lld] r284434 - [ADT] Move CachedHashString to its own header in ADT, and rename to CachedHashStringRef.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 15:24:37 PDT 2016


Author: jlebar
Date: Mon Oct 17 17:24:36 2016
New Revision: 284434

URL: http://llvm.org/viewvc/llvm-project?rev=284434&view=rev
Log:
[ADT] Move CachedHashString to its own header in ADT, and rename to CachedHashStringRef.

Summary:
Reclaiming the name 'CachedHashString' will let us add a type with that
name that owns its value.

Reviewers: timshen

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25644

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=284434&r1=284433&r2=284434&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Mon Oct 17 17:24:36 2016
@@ -700,7 +700,7 @@ template <class ELFT> void  MergeInputSe
       auto *OutSec = static_cast<MergeOutputSection<ELFT> *>(this->OutSec);
       ArrayRef<uint8_t> D = this->getData(Piece);
       StringRef S((const char *)D.data(), D.size());
-      CachedHashString V(S, Piece.Hash);
+      CachedHashStringRef V(S, Piece.Hash);
       Piece.OutputOff = OutSec->getOffset(V);
     }
     OffsetMap[Piece.InputOff] = Piece.OutputOff;

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=284434&r1=284433&r2=284434&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Mon Oct 17 17:24:36 2016
@@ -1244,7 +1244,7 @@ void MergeOutputSection<ELFT>::addSectio
     if (!Piece.Live)
       continue;
     StringRef Data = toStringRef(Sec->getData(Piece));
-    CachedHashString V(Data, Piece.Hash);
+    CachedHashStringRef V(Data, Piece.Hash);
     uintX_t OutputOffset = Builder.add(V);
     if (!shouldTailMerge())
       Piece.OutputOff = OutputOffset;
@@ -1252,7 +1252,7 @@ void MergeOutputSection<ELFT>::addSectio
 }
 
 template <class ELFT>
-unsigned MergeOutputSection<ELFT>::getOffset(CachedHashString Val) {
+unsigned MergeOutputSection<ELFT>::getOffset(CachedHashStringRef Val) {
   return Builder.getOffset(Val);
 }
 

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=284434&r1=284433&r2=284434&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Mon Oct 17 17:24:36 2016
@@ -430,7 +430,7 @@ public:
                      uintX_t Alignment);
   void addSection(InputSectionBase<ELFT> *S) override;
   void writeTo(uint8_t *Buf) override;
-  unsigned getOffset(llvm::CachedHashString Val);
+  unsigned getOffset(llvm::CachedHashStringRef Val);
   void finalize() override;
   void finalizePieces() override;
   bool shouldTailMerge() const;




More information about the llvm-commits mailing list