<div dir="ltr">Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 26, 2016 at 5:36 AM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Oct 26 07:36:56 2016<br>
New Revision: 285190<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=285190&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=285190&view=rev</a><br>
Log:<br>
Delete trivial getters. NFC.<br>
<br>
Modified:<br>
lld/trunk/ELF/ICF.cpp<br>
lld/trunk/ELF/InputSection.cpp<br>
lld/trunk/ELF/InputSection.h<br>
lld/trunk/ELF/LinkerScript.cpp<br>
lld/trunk/ELF/MarkLive.cpp<br>
lld/trunk/ELF/OutputSections.<wbr>cpp<br>
lld/trunk/ELF/Relocations.cpp<br>
lld/trunk/ELF/Writer.cpp<br>
<br>
Modified: lld/trunk/ELF/ICF.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/ICF.cpp?<wbr>rev=285190&r1=285189&r2=<wbr>285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/ICF.cpp (original)<br>
+++ lld/trunk/ELF/ICF.cpp Wed Oct 26 07:36:56 2016<br>
@@ -119,7 +119,7 @@ private:<br>
// Returns a hash value for S. Note that the information about<br>
// relocation targets is not included in the hash value.<br>
template <class ELFT> uint64_t ICF<ELFT>::getHash(<wbr>InputSection<ELFT> *S) {<br>
- uint64_t Flags = S->getFlags();<br>
+ uint64_t Flags = S->Flags;<br>
uint64_t H = hash_combine(Flags, S->getSize());<br>
for (const Elf_Shdr *Rel : S->RelocSections)<br>
H = hash_combine(H, (uint64_t)Rel->sh_size);<br>
@@ -141,7 +141,7 @@ template <class ELFT> bool ICF<ELFT>::is<br>
if (Name == ".init" || Name == ".fini")<br>
return false;<br>
<br>
- return (S->getFlags() & SHF_ALLOC) && !(S->getFlags() & SHF_WRITE);<br>
+ return (S->Flags & SHF_ALLOC) && !(S->Flags & SHF_WRITE);<br>
}<br>
<br>
template <class ELFT><br>
@@ -230,7 +230,7 @@ bool ICF<ELFT>::equalsConstant(<wbr>const Inp<br>
}<br>
}<br>
<br>
- return A->getFlags() == B->getFlags() && A->getSize() == B->getSize() &&<br>
+ return A->Flags == B->Flags && A->getSize() == B->getSize() &&<br>
A->Data == B->Data;<br>
}<br>
<br>
<br>
Modified: lld/trunk/ELF/InputSection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputSection.cpp?rev=285190&<wbr>r1=285189&r2=285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.cpp (original)<br>
+++ lld/trunk/ELF/InputSection.cpp Wed Oct 26 07:36:56 2016<br>
@@ -161,7 +161,7 @@ template <class ELFT> void InputSectionB<br>
// shouldn't be significant in ELF.) We need to be able to read both.<br>
ArrayRef<uint8_t> Buf; // Compressed data<br>
size_t Size; // Uncompressed size<br>
- if (getFlags() & SHF_COMPRESSED)<br>
+ if (Flags & SHF_COMPRESSED)<br>
std::tie(Buf, Size) = getElfCompressedData(Data);<br>
else<br>
std::tie(Buf, Size) = getRawCompressedData(Data);<br>
@@ -182,8 +182,8 @@ InputSectionBase<ELFT>::<wbr>getOffset(const<br>
<br>
template <class ELFT><br>
InputSectionBase<ELFT> *InputSectionBase<ELFT>::<wbr>getLinkOrderDep() const {<br>
- if ((getFlags() & SHF_LINK_ORDER) && getLink() != 0)<br>
- return getFile()->getSections()[<wbr>getLink()];<br>
+ if ((Flags & SHF_LINK_ORDER) && Link != 0)<br>
+ return getFile()->getSections()[Link]<wbr>;<br>
return nullptr;<br>
}<br>
<br>
@@ -206,9 +206,9 @@ bool InputSection<ELFT>::classof(<wbr>const I<br>
<br>
template <class ELFT><br>
InputSectionBase<ELFT> *InputSection<ELFT>::<wbr>getRelocatedSection() {<br>
- assert(this->getType() == SHT_RELA || this->getType() == SHT_REL);<br>
+ assert(this->Type == SHT_RELA || this->Type == SHT_REL);<br>
ArrayRef<InputSectionBase<<wbr>ELFT> *> Sections = this->File->getSections();<br>
- return Sections[this->getInfo()];<br>
+ return Sections[this->Info];<br>
}<br>
<br>
template <class ELFT> void InputSection<ELFT>::addThunk(<wbr>const Thunk<ELFT> *T) {<br>
@@ -418,7 +418,7 @@ void InputSectionBase<ELFT>::<wbr>relocate(ui<br>
// vector only for SHF_ALLOC'ed sections. For other sections,<br>
// we handle relocations directly here.<br>
auto *IS = dyn_cast<InputSection<ELFT>>(<wbr>this);<br>
- if (IS && !(IS->getFlags() & SHF_ALLOC)) {<br>
+ if (IS && !(IS->Flags & SHF_ALLOC)) {<br>
for (const Elf_Shdr *RelSec : IS->RelocSections) {<br>
if (RelSec->sh_type == SHT_RELA)<br>
IS->relocateNonAlloc(Buf, IS->File->getObj().relas(<wbr>RelSec));<br>
@@ -474,15 +474,15 @@ void InputSectionBase<ELFT>::<wbr>relocate(ui<br>
}<br>
<br>
template <class ELFT> void InputSection<ELFT>::writeTo(<wbr>uint8_t *Buf) {<br>
- if (this->getType() == SHT_NOBITS)<br>
+ if (this->Type == SHT_NOBITS)<br>
return;<br>
<br>
// If -r is given, then an InputSection may be a relocation section.<br>
- if (this->getType() == SHT_RELA) {<br>
+ if (this->Type == SHT_RELA) {<br>
copyRelocations(Buf + OutSecOff, this->template getDataAs<Elf_Rela>());<br>
return;<br>
}<br>
- if (this->getType() == SHT_REL) {<br>
+ if (this->Type == SHT_REL) {<br>
copyRelocations(Buf + OutSecOff, this->template getDataAs<Elf_Rel>());<br>
return;<br>
}<br>
@@ -605,7 +605,7 @@ std::vector<SectionPiece><br>
MergeInputSection<ELFT>::<wbr>splitStrings(ArrayRef<uint8_t> Data, size_t EntSize) {<br>
std::vector<SectionPiece> V;<br>
size_t Off = 0;<br>
- bool IsAlloca = this->getFlags() & SHF_ALLOC;<br>
+ bool IsAlloca = this->Flags & SHF_ALLOC;<br>
while (!Data.empty()) {<br>
size_t End = findNull(Data, EntSize);<br>
if (End == StringRef::npos)<br>
@@ -636,7 +636,7 @@ MergeInputSection<ELFT>::<wbr>splitNonStrings<br>
std::vector<SectionPiece> V;<br>
size_t Size = Data.size();<br>
assert((Size % EntSize) == 0);<br>
- bool IsAlloca = this->getFlags() & SHF_ALLOC;<br>
+ bool IsAlloca = this->Flags & SHF_ALLOC;<br>
for (unsigned I = 0, N = Size; I != N; I += EntSize) {<br>
Hashes.push_back(hash_value(<wbr>toStringRef(Data.slice(I, EntSize))));<br>
V.emplace_back(I, !IsAlloca);<br>
@@ -652,13 +652,13 @@ MergeInputSection<ELFT>::<wbr>MergeInputSecti<br>
<br>
template <class ELFT> void MergeInputSection<ELFT>::<wbr>splitIntoPieces() {<br>
ArrayRef<uint8_t> Data = this->Data;<br>
- uintX_t EntSize = this->getEntsize();<br>
- if (this->getFlags() & SHF_STRINGS)<br>
+ uintX_t EntSize = this->Entsize;<br>
+ if (this->Flags & SHF_STRINGS)<br>
this->Pieces = splitStrings(Data, EntSize);<br>
else<br>
this->Pieces = splitNonStrings(Data, EntSize);<br>
<br>
- if (Config->GcSections && (this->getFlags() & SHF_ALLOC))<br>
+ if (Config->GcSections && (this->Flags & SHF_ALLOC))<br>
for (uintX_t Off : LiveOffsets)<br>
this->getSectionPiece(Off)-><wbr>Live = true;<br>
}<br>
<br>
Modified: lld/trunk/ELF/InputSection.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputSection.h?rev=285190&r1=<wbr>285189&r2=285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.h (original)<br>
+++ lld/trunk/ELF/InputSection.h Wed Oct 26 07:36:56 2016<br>
@@ -85,6 +85,7 @@ protected:<br>
// The file this section is from.<br>
ObjectFile<ELFT> *File;<br>
<br>
+public:<br>
// These corresponds to the fields in Elf_Shdr.<br>
uintX_t Flags;<br>
uintX_t Entsize;<br>
@@ -92,7 +93,6 @@ protected:<br>
uint32_t Link;<br>
uint32_t Info;<br>
<br>
-public:<br>
InputSectionBase()<br>
: InputSectionData(Regular, "", ArrayRef<uint8_t>(), false, false),<br>
Repl(this) {}<br>
@@ -117,11 +117,6 @@ public:<br>
<br>
static InputSectionBase<ELFT> Discarded;<br>
<br>
- uintX_t getFlags() const { return Flags; }<br>
- uint32_t getType() const { return Type; }<br>
- uintX_t getEntsize() const { return Entsize; }<br>
- uint32_t getLink() const { return Link; }<br>
- uint32_t getInfo() const { return Info; }<br>
ObjectFile<ELFT> *getFile() const { return File; }<br>
uintX_t getOffset(const DefinedRegular<ELFT> &Sym) const;<br>
InputSectionBase *getLinkOrderDep() const;<br>
@@ -172,7 +167,7 @@ public:<br>
<br>
// Mark the piece at a given offset live. Used by GC.<br>
void markLiveAt(uintX_t Offset) {<br>
- assert(this->getFlags() & llvm::ELF::SHF_ALLOC);<br>
+ assert(this->Flags & llvm::ELF::SHF_ALLOC);<br>
LiveOffsets.insert(Offset);<br>
}<br>
<br>
<br>
Modified: lld/trunk/ELF/LinkerScript.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>LinkerScript.cpp?rev=285190&<wbr>r1=285189&r2=285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.cpp (original)<br>
+++ lld/trunk/ELF/LinkerScript.cpp Wed Oct 26 07:36:56 2016<br>
@@ -156,7 +156,7 @@ static bool matchConstraints(ArrayRef<In<br>
return true;<br>
bool IsRW = llvm::any_of(Sections, [=](InputSectionData *Sec2) {<br>
auto *Sec = static_cast<InputSectionBase<<wbr>ELFT> *>(Sec2);<br>
- return Sec->getFlags() & SHF_WRITE;<br>
+ return Sec->Flags & SHF_WRITE;<br>
});<br>
return (IsRW && Kind == ConstraintKind::ReadWrite) ||<br>
(!IsRW && Kind == ConstraintKind::ReadOnly);<br>
@@ -269,11 +269,11 @@ static SectionKey<ELFT::Is64Bits> create<br>
// supported by bfd or gold, so we can just create multiple section in that<br>
// case.<br>
typedef typename ELFT::uint uintX_t;<br>
- uintX_t Flags = C->getFlags() & (SHF_MERGE | SHF_STRINGS);<br>
+ uintX_t Flags = C->Flags & (SHF_MERGE | SHF_STRINGS);<br>
<br>
uintX_t Alignment = 0;<br>
if (isa<MergeInputSection<ELFT>>(<wbr>C))<br>
- Alignment = std::max<uintX_t>(C-><wbr>Alignment, C->getEntsize());<br>
+ Alignment = std::max<uintX_t>(C-><wbr>Alignment, C->Entsize);<br>
<br>
return SectionKey<ELFT::Is64Bits>{<wbr>OutsecName, /*Type*/ 0, Flags, Alignment};<br>
}<br>
<br>
Modified: lld/trunk/ELF/MarkLive.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>MarkLive.cpp?rev=285190&r1=<wbr>285189&r2=285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/MarkLive.cpp (original)<br>
+++ lld/trunk/ELF/MarkLive.cpp Wed Oct 26 07:36:56 2016<br>
@@ -135,7 +135,7 @@ scanEhFrameSection(<wbr>EhInputSection<ELFT><br>
ResolvedReloc<ELFT> R = resolveReloc(EH, Rels[I2]);<br>
if (!R.Sec || R.Sec == &InputSection<ELFT>::<wbr>Discarded)<br>
continue;<br>
- if (R.Sec->getFlags() & SHF_EXECINSTR)<br>
+ if (R.Sec->Flags & SHF_EXECINSTR)<br>
continue;<br>
Enqueue({R.Sec, 0});<br>
}<br>
@@ -164,14 +164,14 @@ scanEhFrameSection(<wbr>EhInputSection<ELFT><br>
// 1) Sections used by the loader (.init, .fini, .ctors, .dtors or .jcr)<br>
// 2) Non-allocatable sections which typically contain debugging information<br>
template <class ELFT> static bool isReserved(InputSectionBase<<wbr>ELFT> *Sec) {<br>
- switch (Sec->getType()) {<br>
+ switch (Sec->Type) {<br>
case SHT_FINI_ARRAY:<br>
case SHT_INIT_ARRAY:<br>
case SHT_NOTE:<br>
case SHT_PREINIT_ARRAY:<br>
return true;<br>
default:<br>
- if (!(Sec->getFlags() & SHF_ALLOC))<br>
+ if (!(Sec->Flags & SHF_ALLOC))<br>
return true;<br>
<br>
// We do not want to reclaim sections if they can be referred<br>
@@ -201,7 +201,7 @@ template <class ELFT> void elf::markLive<br>
return;<br>
<br>
// We don't gc non alloc sections.<br>
- if (!(R.Sec->getFlags() & SHF_ALLOC))<br>
+ if (!(R.Sec->Flags & SHF_ALLOC))<br>
return;<br>
<br>
// Usually, a whole section is marked as live or dead, but in mergeable<br>
<br>
Modified: lld/trunk/ELF/OutputSections.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>OutputSections.cpp?rev=285190&<wbr>r1=285189&r2=285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/OutputSections.<wbr>cpp (original)<br>
+++ lld/trunk/ELF/OutputSections.<wbr>cpp Wed Oct 26 07:36:56 2016<br>
@@ -966,8 +966,8 @@ void OutputSection<ELFT>::<wbr>addSection(Inp<br>
this->updateAlignment(S-><wbr>Alignment);<br>
// Keep sh_entsize value of the input section to be able to perform merging<br>
// later during a final linking using the generated relocatable object.<br>
- if (Config->Relocatable && (S->getFlags() & SHF_MERGE))<br>
- this->Header.sh_entsize = S->getEntsize();<br>
+ if (Config->Relocatable && (S->Flags & SHF_MERGE))<br>
+ this->Header.sh_entsize = S->Entsize;<br>
}<br>
<br>
// This function is called after we sort input sections<br>
@@ -1304,7 +1304,7 @@ void MergeOutputSection<ELFT>::<wbr>addSectio<br>
auto *Sec = cast<MergeInputSection<ELFT>>(<wbr>C);<br>
Sec->OutSec = this;<br>
this->updateAlignment(Sec-><wbr>Alignment);<br>
- this->Header.sh_entsize = Sec->getEntsize();<br>
+ this->Header.sh_entsize = Sec->Entsize;<br>
Sections.push_back(Sec);<br>
<br>
auto HashI = Sec->Hashes.begin();<br>
@@ -1896,7 +1896,7 @@ void MipsAbiFlagsOutputSection<<wbr>ELFT>::ad<br>
<br>
template <class ELFT><br>
static typename ELFT::uint getOutFlags(InputSectionBase<<wbr>ELFT> *S) {<br>
- return S->getFlags() & ~SHF_GROUP & ~SHF_COMPRESSED;<br>
+ return S->Flags & ~SHF_GROUP & ~SHF_COMPRESSED;<br>
}<br>
<br>
template <class ELFT><br>
@@ -1913,11 +1913,10 @@ static SectionKey<ELFT::Is64Bits> create<br>
// output sections for them to allow merging at final linking stage.<br>
uintX_t Alignment = 0;<br>
if (isa<MergeInputSection<ELFT>>(<wbr>C) ||<br>
- (Config->Relocatable && (C->getFlags() & SHF_MERGE)))<br>
- Alignment = std::max<uintX_t>(C-><wbr>Alignment, C->getEntsize());<br>
+ (Config->Relocatable && (C->Flags & SHF_MERGE)))<br>
+ Alignment = std::max<uintX_t>(C-><wbr>Alignment, C->Entsize);<br>
<br>
- uint32_t Type = C->getType();<br>
- return SectionKey<ELFT::Is64Bits>{<wbr>OutsecName, Type, Flags, Alignment};<br>
+ return SectionKey<ELFT::Is64Bits>{<wbr>OutsecName, C->Type, Flags, Alignment};<br>
}<br>
<br>
template <class ELFT><br>
@@ -1939,7 +1938,7 @@ OutputSectionFactory<ELFT>::<wbr>create(const<br>
return {Sec, false};<br>
}<br>
<br>
- uint32_t Type = C->getType();<br>
+ uint32_t Type = C->Type;<br>
switch (C->kind()) {<br>
case InputSectionBase<ELFT>::<wbr>Regular:<br>
Sec = new OutputSection<ELFT>(Key.Name, Type, Flags);<br>
<br>
Modified: lld/trunk/ELF/Relocations.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>Relocations.cpp?rev=285190&r1=<wbr>285189&r2=285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Relocations.cpp (original)<br>
+++ lld/trunk/ELF/Relocations.cpp Wed Oct 26 07:36:56 2016<br>
@@ -132,7 +132,7 @@ static unsigned handleTlsRelocation(uint<br>
InputSectionBase<ELFT> &C,<br>
typename ELFT::uint Offset,<br>
typename ELFT::uint Addend, RelExpr Expr) {<br>
- if (!(C.getFlags() & SHF_ALLOC))<br>
+ if (!(C.Flags & SHF_ALLOC))<br>
return 0;<br>
<br>
if (!Body.isTls())<br>
@@ -598,7 +598,7 @@ template <class ELFT, class RelTy><br>
static void scanRelocs(InputSectionBase<<wbr>ELFT> &C, ArrayRef<RelTy> Rels) {<br>
typedef typename ELFT::uint uintX_t;<br>
<br>
- bool IsWrite = C.getFlags() & SHF_WRITE;<br>
+ bool IsWrite = C.Flags & SHF_WRITE;<br>
<br>
auto AddDyn = [=](const DynamicReloc<ELFT> &Reloc) {<br>
Out<ELFT>::RelaDyn->addReloc(<wbr>Reloc);<br>
<br>
Modified: lld/trunk/ELF/Writer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=285190&r1=285189&r2=285190&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/Writer.<wbr>cpp?rev=285190&r1=285189&r2=<wbr>285190&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Writer.cpp (original)<br>
+++ lld/trunk/ELF/Writer.cpp Wed Oct 26 07:36:56 2016<br>
@@ -346,7 +346,7 @@ static bool shouldKeepInSymtab(InputSect<br>
if (Config->Discard == DiscardPolicy::Locals)<br>
return false;<br>
<br>
- return !Sec || !(Sec->getFlags() & SHF_MERGE);<br>
+ return !Sec || !(Sec->Flags & SHF_MERGE);<br>
}<br>
<br>
template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {<br>
@@ -676,7 +676,7 @@ void Writer<ELFT>::forEachRelSec(<br>
// creating GOT, PLT, copy relocations, etc.<br>
// Note that relocations for non-alloc sections are directly<br>
// processed by InputSection::<wbr>relocateNonAlloc.<br>
- if (!(IS->getFlags() & SHF_ALLOC))<br>
+ if (!(IS->Flags & SHF_ALLOC))<br>
continue;<br>
if (auto *S = dyn_cast<InputSection<ELFT>>(<wbr>IS)) {<br>
for (const Elf_Shdr *RelSec : S->RelocSections)<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>