[lld] r287605 - Remove a parameter from getOutputLoc and rename for readability. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 17:10:35 PST 2016


Author: ruiu
Date: Mon Nov 21 19:10:34 2016
New Revision: 287605

URL: http://llvm.org/viewvc/llvm-project?rev=287605&view=rev
Log:
Remove a parameter from getOutputLoc and rename for readability. NFC.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=287605&r1=287604&r2=287605&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Mon Nov 21 19:10:34 2016
@@ -261,9 +261,8 @@ BuildIdSection<ELFT>::BuildIdSection()
 }
 
 // Returns the location of the build-id hash value in the output.
-template <class ELFT>
-uint8_t *BuildIdSection<ELFT>::getOutputLoc(uint8_t *Start) {
-  return Start + this->OutSec->Offset + this->OutSecOff + HeaderSize;
+template <class ELFT> size_t BuildIdSection<ELFT>::getOutputOffset() {
+  return this->OutSec->Offset + this->OutSecOff + HeaderSize;
 }
 
 template <class ELFT> size_t BuildIdSection<ELFT>::getHashSize() {
@@ -316,7 +315,7 @@ void BuildIdSection<ELFT>::computeHash(
   else
     std::for_each(Chunks.begin(), Chunks.end(), Fn);
 
-  HashFn(HashList, getOutputLoc(Data.begin()));
+  HashFn(HashList, Data.data() + getOutputOffset());
 }
 
 template <class ELFT>
@@ -344,11 +343,11 @@ void BuildIdSection<ELFT>::writeBuildId(
     });
     break;
   case BuildIdKind::Uuid:
-    if (getRandomBytes(getOutputLoc(Buf.data()), HashSize))
+    if (getRandomBytes(Buf.data() + getOutputOffset(), HashSize))
       error("entropy source failure");
     break;
   case BuildIdKind::Hexstring:
-    memcpy(this->getOutputLoc(Buf.data()), Config->BuildIdVector.data(),
+    memcpy(Buf.data() + getOutputOffset(), Config->BuildIdVector.data(),
            Config->BuildIdVector.size());
     break;
   default:

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=287605&r1=287604&r2=287605&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Mon Nov 21 19:10:34 2016
@@ -97,7 +97,7 @@ private:
   static const unsigned HeaderSize = 16;
 
   size_t getHashSize();
-  uint8_t *getOutputLoc(uint8_t *Start);
+  size_t getOutputOffset();
 
   void
   computeHash(llvm::MutableArrayRef<uint8_t> Buf,




More information about the llvm-commits mailing list