From: Rafael Espindola Date: Thu, 10 Nov 2016 15:41:34 +0000 (+0000) Subject: Replace duplicated '16' with a named constant. X-Git-Tag: llvmorg-4.0.0-rc1~5031 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e876cfb2eb8f0fcedaecc3b0c0c65dcb9b70886;p=platform%2Fupstream%2Fllvm.git Replace duplicated '16' with a named constant. Thanks to Michael Spencer for the suggestion. llvm-svn: 286462 --- diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 51e0fc4..2e2fc73 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -217,7 +217,7 @@ BuildIdSection::BuildIdSection(size_t HashSize) HashSize(HashSize) { this->Live = true; - Buf.resize(16 + HashSize); + Buf.resize(HeaderSize + HashSize); const endianness E = ELFT::TargetEndianness; write32(Buf.data(), 4); // Name size write32(Buf.data() + 4, HashSize); // Content size @@ -229,8 +229,7 @@ BuildIdSection::BuildIdSection(size_t HashSize) // Returns the location of the build-id hash value in the output. template uint8_t *BuildIdSection::getOutputLoc(uint8_t *Start) const { - // First 16 bytes are a header. - return Start + this->OutSec->Offset + this->OutSecOff + 16; + return Start + this->OutSec->Offset + this->OutSecOff + HeaderSize; } // Split one uint8 array into small pieces of uint8 arrays. diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 4910293..4e204be 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -95,6 +95,8 @@ protected: std::function Arr, uint8_t *Hash)> Hash); size_t HashSize; + // First 16 bytes are a header. + static const unsigned HeaderSize = 16; }; template