Remove a parameter from getOutputLoc and rename for readability. NFC.

llvm-svn: 287605
This commit is contained in:
Rui Ueyama 2016-11-22 01:10:34 +00:00
parent 0a4fc46321
commit ee18d95764
2 changed files with 6 additions and 7 deletions

View File

@ -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(MutableArrayRef<uint8_t> Buf) {
});
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:

View File

@ -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,