<div dir="ltr">This is a really nice clean-up. Thanks Rafael!<div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 8, 2014 at 8:28 AM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</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 8 10:28:58 2014<br>
New Revision: 219314<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=219314&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=219314&view=rev</a><br>
Log:<br>
Remove bogus std::error_code returns form SectionRef.<br>
<br>
There are two methods in SectionRef that can fail:<br>
<br>
* getName: The index into the string table can be invalid.<br>
* getContents: The section might point to invalid contents.<br>
<br>
Every other method will always succeed and returning and std::error_code just<br>
complicates the code. For example, a section can have an invalid alignment,<br>
but if we are able to get to the section structure at all and create a<br>
SectionRef, we will always be able to read that invalid alignment.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/Object/COFF.h<br>
llvm/trunk/include/llvm/Object/ELFObjectFile.h<br>
llvm/trunk/include/llvm/Object/MachO.h<br>
llvm/trunk/include/llvm/Object/ObjectFile.h<br>
llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp<br>
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp<br>
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h<br>
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h<br>
llvm/trunk/lib/Object/COFFObjectFile.cpp<br>
llvm/trunk/lib/Object/MachOObjectFile.cpp<br>
llvm/trunk/lib/Object/Object.cpp<br>
llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp<br>
llvm/trunk/tools/llvm-cov/TestingSupport.cpp<br>
llvm/trunk/tools/llvm-objdump/MachODump.cpp<br>
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp<br>
llvm/trunk/tools/llvm-readobj/ARMWinEHPrinter.cpp<br>
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp<br>
llvm/trunk/tools/llvm-readobj/MachODumper.cpp<br>
llvm/trunk/tools/llvm-size/llvm-size.cpp<br>
llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Object/COFF.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/COFF.h (original)<br>
+++ llvm/trunk/include/llvm/Object/COFF.h Wed Oct 8 10:28:58 2014<br>
@@ -546,24 +546,19 @@ protected:<br>
void moveSectionNext(DataRefImpl &Sec) const override;<br>
std::error_code getSectionName(DataRefImpl Sec,<br>
StringRef &Res) const override;<br>
- std::error_code getSectionAddress(DataRefImpl Sec,<br>
- uint64_t &Res) const override;<br>
- std::error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const override;<br>
+ uint64_t getSectionAddress(DataRefImpl Sec) const override;<br>
+ uint64_t getSectionSize(DataRefImpl Sec) const override;<br>
std::error_code getSectionContents(DataRefImpl Sec,<br>
StringRef &Res) const override;<br>
- std::error_code getSectionAlignment(DataRefImpl Sec,<br>
- uint64_t &Res) const override;<br>
- std::error_code isSectionText(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionData(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionReadOnlyData(DataRefImpl Sec,<br>
- bool &Res) const override;<br>
- std::error_code isSectionRequiredForExecution(DataRefImpl Sec,<br>
- bool &Res) const override;<br>
- std::error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,<br>
- bool &Result) const override;<br>
+ uint64_t getSectionAlignment(DataRefImpl Sec) const override;<br>
+ bool isSectionText(DataRefImpl Sec) const override;<br>
+ bool isSectionData(DataRefImpl Sec) const override;<br>
+ bool isSectionBSS(DataRefImpl Sec) const override;<br>
+ bool isSectionVirtual(DataRefImpl Sec) const override;<br>
+ bool isSectionZeroInit(DataRefImpl Sec) const override;<br>
+ bool isSectionReadOnlyData(DataRefImpl Sec) const override;<br>
+ bool isSectionRequiredForExecution(DataRefImpl Sec) const override;<br>
+ bool sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const override;<br>
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;<br>
relocation_iterator section_rel_end(DataRefImpl Sec) const override;<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)<br>
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Wed Oct 8 10:28:58 2014<br>
@@ -89,24 +89,19 @@ protected:<br>
void moveSectionNext(DataRefImpl &Sec) const override;<br>
std::error_code getSectionName(DataRefImpl Sec,<br>
StringRef &Res) const override;<br>
- std::error_code getSectionAddress(DataRefImpl Sec,<br>
- uint64_t &Res) const override;<br>
- std::error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const override;<br>
+ uint64_t getSectionAddress(DataRefImpl Sec) const override;<br>
+ uint64_t getSectionSize(DataRefImpl Sec) const override;<br>
std::error_code getSectionContents(DataRefImpl Sec,<br>
StringRef &Res) const override;<br>
- std::error_code getSectionAlignment(DataRefImpl Sec,<br>
- uint64_t &Res) const override;<br>
- std::error_code isSectionText(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionData(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionRequiredForExecution(DataRefImpl Sec,<br>
- bool &Res) const override;<br>
- std::error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionReadOnlyData(DataRefImpl Sec,<br>
- bool &Res) const override;<br>
- std::error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,<br>
- bool &Result) const override;<br>
+ uint64_t getSectionAlignment(DataRefImpl Sec) const override;<br>
+ bool isSectionText(DataRefImpl Sec) const override;<br>
+ bool isSectionData(DataRefImpl Sec) const override;<br>
+ bool isSectionBSS(DataRefImpl Sec) const override;<br>
+ bool isSectionRequiredForExecution(DataRefImpl Sec) const override;<br>
+ bool isSectionVirtual(DataRefImpl Sec) const override;<br>
+ bool isSectionZeroInit(DataRefImpl Sec) const override;<br>
+ bool isSectionReadOnlyData(DataRefImpl Sec) const override;<br>
+ bool sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const override;<br>
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;<br>
relocation_iterator section_rel_end(DataRefImpl Sec) const override;<br>
section_iterator getRelocatedSection(DataRefImpl Sec) const override;<br>
@@ -413,17 +408,13 @@ std::error_code ELFObjectFile<ELFT>::get<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::getSectionAddress(DataRefImpl Sec,<br>
- uint64_t &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_addr;<br>
- return object_error::success;<br>
+uint64_t ELFObjectFile<ELFT>::getSectionAddress(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_addr;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::getSectionSize(DataRefImpl Sec,<br>
- uint64_t &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_size;<br>
- return object_error::success;<br>
+uint64_t ELFObjectFile<ELFT>::getSectionSize(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_size;<br>
}<br>
<br>
template <class ELFT><br>
@@ -436,79 +427,59 @@ ELFObjectFile<ELFT>::getSectionContents(<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code<br>
-ELFObjectFile<ELFT>::getSectionAlignment(DataRefImpl Sec,<br>
- uint64_t &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_addralign;<br>
- return object_error::success;<br>
+uint64_t ELFObjectFile<ELFT>::getSectionAlignment(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_addralign;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::isSectionText(DataRefImpl Sec,<br>
- bool &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_flags & ELF::SHF_EXECINSTR;<br>
- return object_error::success;<br>
+bool ELFObjectFile<ELFT>::isSectionText(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_flags & ELF::SHF_EXECINSTR;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::isSectionData(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool ELFObjectFile<ELFT>::isSectionData(DataRefImpl Sec) const {<br>
Elf_Shdr_Iter EShdr = toELFShdrIter(Sec);<br>
- Result = EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&<br>
- EShdr->sh_type == ELF::SHT_PROGBITS;<br>
- return object_error::success;<br>
+ return EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&<br>
+ EShdr->sh_type == ELF::SHT_PROGBITS;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::isSectionBSS(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool ELFObjectFile<ELFT>::isSectionBSS(DataRefImpl Sec) const {<br>
Elf_Shdr_Iter EShdr = toELFShdrIter(Sec);<br>
- Result = EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&<br>
- EShdr->sh_type == ELF::SHT_NOBITS;<br>
- return object_error::success;<br>
+ return EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&<br>
+ EShdr->sh_type == ELF::SHT_NOBITS;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code<br>
-ELFObjectFile<ELFT>::isSectionRequiredForExecution(DataRefImpl Sec,<br>
- bool &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_flags & ELF::SHF_ALLOC;<br>
- return object_error::success;<br>
+bool ELFObjectFile<ELFT>::isSectionRequiredForExecution(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_flags & ELF::SHF_ALLOC;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::isSectionVirtual(DataRefImpl Sec,<br>
- bool &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;<br>
- return object_error::success;<br>
+bool ELFObjectFile<ELFT>::isSectionVirtual(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::isSectionZeroInit(DataRefImpl Sec,<br>
- bool &Result) const {<br>
- Result = toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;<br>
- return object_error::success;<br>
+bool ELFObjectFile<ELFT>::isSectionZeroInit(DataRefImpl Sec) const {<br>
+ return toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::isSectionReadOnlyData(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool ELFObjectFile<ELFT>::isSectionReadOnlyData(DataRefImpl Sec) const {<br>
Elf_Shdr_Iter EShdr = toELFShdrIter(Sec);<br>
- Result = !(EShdr->sh_flags & (ELF::SHF_WRITE | ELF::SHF_EXECINSTR));<br>
- return object_error::success;<br>
+ return !(EShdr->sh_flags & (ELF::SHF_WRITE | ELF::SHF_EXECINSTR));<br>
}<br>
<br>
template <class ELFT><br>
-std::error_code ELFObjectFile<ELFT>::sectionContainsSymbol(DataRefImpl Sec,<br>
- DataRefImpl Symb,<br>
- bool &Result) const {<br>
+bool ELFObjectFile<ELFT>::sectionContainsSymbol(DataRefImpl Sec,<br>
+ DataRefImpl Symb) const {<br>
Elf_Sym_Iter ESym = toELFSymIter(Symb);<br>
<br>
uintX_t Index = ESym->st_shndx;<br>
bool Reserved = Index >= ELF::SHN_LORESERVE && Index <= ELF::SHN_HIRESERVE;<br>
<br>
- Result = !Reserved && (&*toELFShdrIter(Sec) == EF.getSection(ESym->st_shndx));<br>
- return object_error::success;<br>
+ return !Reserved && (&*toELFShdrIter(Sec) == EF.getSection(ESym->st_shndx));<br>
}<br>
<br>
template <class ELFT><br>
<br>
Modified: llvm/trunk/include/llvm/Object/MachO.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/MachO.h (original)<br>
+++ llvm/trunk/include/llvm/Object/MachO.h Wed Oct 8 10:28:58 2014<br>
@@ -215,24 +215,19 @@ public:<br>
void moveSectionNext(DataRefImpl &Sec) const override;<br>
std::error_code getSectionName(DataRefImpl Sec,<br>
StringRef &Res) const override;<br>
- std::error_code getSectionAddress(DataRefImpl Sec,<br>
- uint64_t &Res) const override;<br>
- std::error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const override;<br>
+ uint64_t getSectionAddress(DataRefImpl Sec) const override;<br>
+ uint64_t getSectionSize(DataRefImpl Sec) const override;<br>
std::error_code getSectionContents(DataRefImpl Sec,<br>
StringRef &Res) const override;<br>
- std::error_code getSectionAlignment(DataRefImpl Sec,<br>
- uint64_t &Res) const override;<br>
- std::error_code isSectionText(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionData(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionRequiredForExecution(DataRefImpl Sec,<br>
- bool &Res) const override;<br>
- std::error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const override;<br>
- std::error_code isSectionReadOnlyData(DataRefImpl Sec,<br>
- bool &Res) const override;<br>
- std::error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,<br>
- bool &Result) const override;<br>
+ uint64_t getSectionAlignment(DataRefImpl Sec) const override;<br>
+ bool isSectionText(DataRefImpl Sec) const override;<br>
+ bool isSectionData(DataRefImpl Sec) const override;<br>
+ bool isSectionBSS(DataRefImpl Sec) const override;<br>
+ bool isSectionRequiredForExecution(DataRefImpl Sec) const override;<br>
+ bool isSectionVirtual(DataRefImpl Sec) const override;<br>
+ bool isSectionZeroInit(DataRefImpl Sec) const override;<br>
+ bool isSectionReadOnlyData(DataRefImpl Sec) const override;<br>
+ bool sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const override;<br>
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;<br>
relocation_iterator section_rel_end(DataRefImpl Sec) const override;<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/Object/ObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ObjectFile.h?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ObjectFile.h?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/ObjectFile.h (original)<br>
+++ llvm/trunk/include/llvm/Object/ObjectFile.h Wed Oct 8 10:28:58 2014<br>
@@ -95,22 +95,22 @@ public:<br>
void moveNext();<br>
<br>
std::error_code getName(StringRef &Result) const;<br>
- std::error_code getAddress(uint64_t &Result) const;<br>
- std::error_code getSize(uint64_t &Result) const;<br>
+ uint64_t getAddress() const;<br>
+ uint64_t getSize() const;<br>
std::error_code getContents(StringRef &Result) const;<br>
<br>
/// @brief Get the alignment of this section as the actual value (not log 2).<br>
- std::error_code getAlignment(uint64_t &Result) const;<br>
+ uint64_t getAlignment() const;<br>
<br>
- std::error_code isText(bool &Result) const;<br>
- std::error_code isData(bool &Result) const;<br>
- std::error_code isBSS(bool &Result) const;<br>
- std::error_code isRequiredForExecution(bool &Result) const;<br>
- std::error_code isVirtual(bool &Result) const;<br>
- std::error_code isZeroInit(bool &Result) const;<br>
- std::error_code isReadOnlyData(bool &Result) const;<br>
+ bool isText() const;<br>
+ bool isData() const;<br>
+ bool isBSS() const;<br>
+ bool isRequiredForExecution() const;<br>
+ bool isVirtual() const;<br>
+ bool isZeroInit() const;<br>
+ bool isReadOnlyData() const;<br>
<br>
- std::error_code containsSymbol(SymbolRef S, bool &Result) const;<br>
+ bool containsSymbol(SymbolRef S) const;<br>
<br>
relocation_iterator relocation_begin() const;<br>
relocation_iterator relocation_end() const;<br>
@@ -225,29 +225,21 @@ protected:<br>
virtual void moveSectionNext(DataRefImpl &Sec) const = 0;<br>
virtual std::error_code getSectionName(DataRefImpl Sec,<br>
StringRef &Res) const = 0;<br>
- virtual std::error_code getSectionAddress(DataRefImpl Sec,<br>
- uint64_t &Res) const = 0;<br>
- virtual std::error_code getSectionSize(DataRefImpl Sec,<br>
- uint64_t &Res) const = 0;<br>
+ virtual uint64_t getSectionAddress(DataRefImpl Sec) const = 0;<br>
+ virtual uint64_t getSectionSize(DataRefImpl Sec) const = 0;<br>
virtual std::error_code getSectionContents(DataRefImpl Sec,<br>
StringRef &Res) const = 0;<br>
- virtual std::error_code getSectionAlignment(DataRefImpl Sec,<br>
- uint64_t &Res) const = 0;<br>
- virtual std::error_code isSectionText(DataRefImpl Sec, bool &Res) const = 0;<br>
- virtual std::error_code isSectionData(DataRefImpl Sec, bool &Res) const = 0;<br>
- virtual std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const = 0;<br>
- virtual std::error_code isSectionRequiredForExecution(DataRefImpl Sec,<br>
- bool &Res) const = 0;<br>
+ virtual uint64_t getSectionAlignment(DataRefImpl Sec) const = 0;<br>
+ virtual bool isSectionText(DataRefImpl Sec) const = 0;<br>
+ virtual bool isSectionData(DataRefImpl Sec) const = 0;<br>
+ virtual bool isSectionBSS(DataRefImpl Sec) const = 0;<br>
+ virtual bool isSectionRequiredForExecution(DataRefImpl Sec) const = 0;<br>
// A section is 'virtual' if its contents aren't present in the object image.<br>
- virtual std::error_code isSectionVirtual(DataRefImpl Sec,<br>
- bool &Res) const = 0;<br>
- virtual std::error_code isSectionZeroInit(DataRefImpl Sec,<br>
- bool &Res) const = 0;<br>
- virtual std::error_code isSectionReadOnlyData(DataRefImpl Sec,<br>
- bool &Res) const = 0;<br>
- virtual std::error_code sectionContainsSymbol(DataRefImpl Sec,<br>
- DataRefImpl Symb,<br>
- bool &Result) const = 0;<br>
+ virtual bool isSectionVirtual(DataRefImpl Sec) const = 0;<br>
+ virtual bool isSectionZeroInit(DataRefImpl Sec) const = 0;<br>
+ virtual bool isSectionReadOnlyData(DataRefImpl Sec) const = 0;<br>
+ virtual bool sectionContainsSymbol(DataRefImpl Sec,<br>
+ DataRefImpl Symb) const = 0;<br>
virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0;<br>
virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0;<br>
virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;<br>
@@ -397,54 +389,53 @@ inline std::error_code SectionRef::getNa<br>
return OwningObject->getSectionName(SectionPimpl, Result);<br>
}<br>
<br>
-inline std::error_code SectionRef::getAddress(uint64_t &Result) const {<br>
- return OwningObject->getSectionAddress(SectionPimpl, Result);<br>
+inline uint64_t SectionRef::getAddress() const {<br>
+ return OwningObject->getSectionAddress(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::getSize(uint64_t &Result) const {<br>
- return OwningObject->getSectionSize(SectionPimpl, Result);<br>
+inline uint64_t SectionRef::getSize() const {<br>
+ return OwningObject->getSectionSize(SectionPimpl);<br>
}<br>
<br>
inline std::error_code SectionRef::getContents(StringRef &Result) const {<br>
return OwningObject->getSectionContents(SectionPimpl, Result);<br>
}<br>
<br>
-inline std::error_code SectionRef::getAlignment(uint64_t &Result) const {<br>
- return OwningObject->getSectionAlignment(SectionPimpl, Result);<br>
+inline uint64_t SectionRef::getAlignment() const {<br>
+ return OwningObject->getSectionAlignment(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isText(bool &Result) const {<br>
- return OwningObject->isSectionText(SectionPimpl, Result);<br>
+inline bool SectionRef::isText() const {<br>
+ return OwningObject->isSectionText(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isData(bool &Result) const {<br>
- return OwningObject->isSectionData(SectionPimpl, Result);<br>
+inline bool SectionRef::isData() const {<br>
+ return OwningObject->isSectionData(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isBSS(bool &Result) const {<br>
- return OwningObject->isSectionBSS(SectionPimpl, Result);<br>
+inline bool SectionRef::isBSS() const {<br>
+ return OwningObject->isSectionBSS(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isRequiredForExecution(bool &Result) const {<br>
- return OwningObject->isSectionRequiredForExecution(SectionPimpl, Result);<br>
+inline bool SectionRef::isRequiredForExecution() const {<br>
+ return OwningObject->isSectionRequiredForExecution(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isVirtual(bool &Result) const {<br>
- return OwningObject->isSectionVirtual(SectionPimpl, Result);<br>
+inline bool SectionRef::isVirtual() const {<br>
+ return OwningObject->isSectionVirtual(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isZeroInit(bool &Result) const {<br>
- return OwningObject->isSectionZeroInit(SectionPimpl, Result);<br>
+inline bool SectionRef::isZeroInit() const {<br>
+ return OwningObject->isSectionZeroInit(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::isReadOnlyData(bool &Result) const {<br>
- return OwningObject->isSectionReadOnlyData(SectionPimpl, Result);<br>
+inline bool SectionRef::isReadOnlyData() const {<br>
+ return OwningObject->isSectionReadOnlyData(SectionPimpl);<br>
}<br>
<br>
-inline std::error_code SectionRef::containsSymbol(SymbolRef S,<br>
- bool &Result) const {<br>
+inline bool SectionRef::containsSymbol(SymbolRef S) const {<br>
return OwningObject->sectionContainsSymbol(SectionPimpl,<br>
- S.getRawDataRefImpl(), Result);<br>
+ S.getRawDataRefImpl());<br>
}<br>
<br>
inline relocation_iterator SectionRef::relocation_begin() const {<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Wed Oct 8 10:28:58 2014<br>
@@ -516,12 +516,10 @@ DWARFContextInMemory::DWARFContextInMemo<br>
StringRef name;<br>
Section.getName(name);<br>
// Skip BSS and Virtual sections, they aren't interesting.<br>
- bool IsBSS;<br>
- Section.isBSS(IsBSS);<br>
+ bool IsBSS = Section.isBSS();<br>
if (IsBSS)<br>
continue;<br>
- bool IsVirtual;<br>
- Section.isVirtual(IsVirtual);<br>
+ bool IsVirtual = Section.isVirtual();<br>
if (IsVirtual)<br>
continue;<br>
StringRef data;<br>
@@ -612,8 +610,7 @@ DWARFContextInMemory::DWARFContextInMemo<br>
}<br>
<br>
if (Section.relocation_begin() != Section.relocation_end()) {<br>
- uint64_t SectionSize;<br>
- RelocatedSection->getSize(SectionSize);<br>
+ uint64_t SectionSize = RelocatedSection->getSize();<br>
for (const RelocationRef &Reloc : Section.relocations()) {<br>
uint64_t Address;<br>
Reloc.getOffset(Address);<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Wed Oct 8 10:28:58 2014<br>
@@ -134,10 +134,7 @@ static std::error_code getOffset(const S<br>
return object_error::success;<br>
}<br>
<br>
- uint64_t SectionAddress;<br>
- if (std::error_code EC = SecI->getAddress(SectionAddress))<br>
- return EC;<br>
-<br>
+ uint64_t SectionAddress = SecI->getAddress();<br>
Result = Address - SectionAddress;<br>
return object_error::success;<br>
}<br>
@@ -199,14 +196,13 @@ RuntimeDyldImpl::loadObject(std::unique_<br>
SymType == object::SymbolRef::ST_Unknown) {<br>
uint64_t SectOffset;<br>
StringRef SectionData;<br>
- bool IsCode;<br>
section_iterator SI = Obj->end_sections();<br>
Check(getOffset(*I, SectOffset));<br>
Check(I->getSection(SI));<br>
if (SI == Obj->end_sections())<br>
continue;<br>
Check(SI->getContents(SectionData));<br>
- Check(SI->isText(IsCode));<br>
+ bool IsCode = SI->isText();<br>
unsigned SectionID =<br>
findOrEmitSection(*Obj, *SI, IsCode, LocalSections);<br>
LocalSymbols[Name.data()] = SymbolLoc(SectionID, SectOffset);<br>
@@ -236,8 +232,7 @@ RuntimeDyldImpl::loadObject(std::unique_<br>
if (I == E && !ProcessAllSections)<br>
continue;<br>
<br>
- bool IsCode = false;<br>
- Check(RelocatedSection->isText(IsCode));<br>
+ bool IsCode = RelocatedSection->isText();<br>
SectionID =<br>
findOrEmitSection(*Obj, *RelocatedSection, IsCode, LocalSections);<br>
DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n");<br>
@@ -291,20 +286,15 @@ void RuntimeDyldImpl::computeTotalAllocS<br>
SI != SE; ++SI) {<br>
const SectionRef &Section = *SI;<br>
<br>
- bool IsRequired;<br>
- Check(Section.isRequiredForExecution(IsRequired));<br>
+ bool IsRequired = Section.isRequiredForExecution();<br>
<br>
// Consider only the sections that are required to be loaded for execution<br>
if (IsRequired) {<br>
- uint64_t DataSize = 0;<br>
- uint64_t Alignment64 = 0;<br>
- bool IsCode = false;<br>
- bool IsReadOnly = false;<br>
StringRef Name;<br>
- Check(Section.getSize(DataSize));<br>
- Check(Section.getAlignment(Alignment64));<br>
- Check(Section.isText(IsCode));<br>
- Check(Section.isReadOnlyData(IsReadOnly));<br>
+ uint64_t DataSize = Section.getSize();<br>
+ uint64_t Alignment64 = Section.getAlignment();<br>
+ bool IsCode = Section.isText();<br>
+ bool IsReadOnly = Section.isReadOnlyData();<br>
Check(Section.getName(Name));<br>
unsigned Alignment = (unsigned)Alignment64 & 0xffffffffL;<br>
<br>
@@ -386,10 +376,8 @@ unsigned RuntimeDyldImpl::computeSection<br>
}<br>
<br>
// Get section data size and alignment<br>
- uint64_t Alignment64;<br>
- uint64_t DataSize;<br>
- Check(Section.getSize(DataSize));<br>
- Check(Section.getAlignment(Alignment64));<br>
+ uint64_t DataSize = Section.getSize();<br>
+ uint64_t Alignment64 = Section.getAlignment();<br>
<br>
// Add stubbuf size alignment<br>
unsigned Alignment = (unsigned)Alignment64 & 0xffffffffL;<br>
@@ -473,24 +461,18 @@ unsigned RuntimeDyldImpl::emitSection(Ob<br>
const SectionRef &Section, bool IsCode) {<br>
<br>
StringRef data;<br>
- uint64_t Alignment64;<br>
Check(Section.getContents(data));<br>
- Check(Section.getAlignment(Alignment64));<br>
+ uint64_t Alignment64 = Section.getAlignment();<br>
<br>
unsigned Alignment = (unsigned)Alignment64 & 0xffffffffL;<br>
- bool IsRequired;<br>
- bool IsVirtual;<br>
- bool IsZeroInit;<br>
- bool IsReadOnly;<br>
- uint64_t DataSize;<br>
unsigned PaddingSize = 0;<br>
unsigned StubBufSize = 0;<br>
StringRef Name;<br>
- Check(Section.isRequiredForExecution(IsRequired));<br>
- Check(Section.isVirtual(IsVirtual));<br>
- Check(Section.isZeroInit(IsZeroInit));<br>
- Check(Section.isReadOnlyData(IsReadOnly));<br>
- Check(Section.getSize(DataSize));<br>
+ bool IsRequired = Section.isRequiredForExecution();<br>
+ bool IsVirtual = Section.isVirtual();<br>
+ bool IsZeroInit = Section.isZeroInit();<br>
+ bool IsReadOnly = Section.isReadOnlyData();<br>
+ uint64_t DataSize = Section.getSize();<br>
Check(Section.getName(Name));<br>
<br>
StubBufSize = computeSectionStubBufSize(Obj, Section);<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Wed Oct 8 10:28:58 2014<br>
@@ -702,8 +702,7 @@ void RuntimeDyldELF::findOPDEntrySection<br>
<br>
section_iterator tsi(Obj.end_sections());<br>
check(TargetSymbol->getSection(tsi));<br>
- bool IsCode = false;<br>
- tsi->isText(IsCode);<br>
+ bool IsCode = tsi->isText();<br>
Rel.SectionID = findOrEmitSection(Obj, (*tsi), IsCode, LocalSections);<br>
Rel.Addend = (intptr_t)Addend;<br>
return;<br>
@@ -983,9 +982,7 @@ relocation_iterator RuntimeDyldELF::proc<br>
if (si == Obj.end_sections())<br>
llvm_unreachable("Symbol section not found, bad object file format!");<br>
DEBUG(dbgs() << "\t\tThis is section symbol\n");<br>
- // Default to 'true' in case isText fails (though it never does).<br>
- bool isCode = true;<br>
- si->isText(isCode);<br>
+ bool isCode = si->isText();<br>
Value.SectionID = findOrEmitSection(Obj, (*si), isCode, ObjSectionToID);<br>
Value.Addend = Addend;<br>
break;<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp Wed Oct 8 10:28:58 2014<br>
@@ -66,11 +66,9 @@ RelocationValueRef RuntimeDyldMachO::get<br>
}<br>
} else {<br>
SectionRef Sec = Obj.getRelocationSection(RelInfo);<br>
- bool IsCode = false;<br>
- Sec.isText(IsCode);<br>
+ bool IsCode = Sec.isText();<br>
Value.SectionID = findOrEmitSection(ObjImg, Sec, IsCode, ObjSectionToID);<br>
- uint64_t Addr;<br>
- Sec.getAddress(Addr);<br>
+ uint64_t Addr = Sec.getAddress();<br>
Value.Offset = RE.Addend - Addr;<br>
}<br>
<br>
@@ -115,9 +113,8 @@ RuntimeDyldMachO::getSectionByAddress(co<br>
section_iterator SE = Obj.section_end();<br>
<br>
for (; SI != SE; ++SI) {<br>
- uint64_t SAddr, SSize;<br>
- SI->getAddress(SAddr);<br>
- SI->getSize(SSize);<br>
+ uint64_t SAddr = SI->getAddress();<br>
+ uint64_t SSize = SI->getSize();<br>
if ((Addr >= SAddr) && (Addr < SAddr + SSize))<br>
return SI;<br>
}<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h Wed Oct 8 10:28:58 2014<br>
@@ -232,20 +232,17 @@ private:<br>
uint32_t AddrA = MachO->getScatteredRelocationValue(RE);<br>
section_iterator SAI = getSectionByAddress(*MachO, AddrA);<br>
assert(SAI != MachO->section_end() && "Can't find section for address A");<br>
- uint64_t SectionABase;<br>
- SAI->getAddress(SectionABase);<br>
+ uint64_t SectionABase = SAI->getAddress();<br>
uint64_t SectionAOffset = AddrA - SectionABase;<br>
SectionRef SectionA = *SAI;<br>
- bool IsCode;<br>
- SectionA.isText(IsCode);<br>
+ bool IsCode = SectionA.isText();<br>
uint32_t SectionAID =<br>
findOrEmitSection(Obj, SectionA, IsCode, ObjSectionToID);<br>
<br>
uint32_t AddrB = MachO->getScatteredRelocationValue(RE2);<br>
section_iterator SBI = getSectionByAddress(*MachO, AddrB);<br>
assert(SBI != MachO->section_end() && "Can't find section for address B");<br>
- uint64_t SectionBBase;<br>
- SBI->getAddress(SectionBBase);<br>
+ uint64_t SectionBBase = SBI->getAddress();<br>
uint64_t SectionBOffset = AddrB - SectionBBase;<br>
SectionRef SectionB = *SBI;<br>
uint32_t SectionBID =<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h Wed Oct 8 10:28:58 2014<br>
@@ -152,20 +152,17 @@ private:<br>
uint32_t AddrA = MachO->getScatteredRelocationValue(RE);<br>
section_iterator SAI = getSectionByAddress(*MachO, AddrA);<br>
assert(SAI != MachO->section_end() && "Can't find section for address A");<br>
- uint64_t SectionABase;<br>
- SAI->getAddress(SectionABase);<br>
+ uint64_t SectionABase = SAI->getAddress();<br>
uint64_t SectionAOffset = AddrA - SectionABase;<br>
SectionRef SectionA = *SAI;<br>
- bool IsCode;<br>
- SectionA.isText(IsCode);<br>
+ bool IsCode = SectionA.isText();<br>
uint32_t SectionAID =<br>
findOrEmitSection(Obj, SectionA, IsCode, ObjSectionToID);<br>
<br>
uint32_t AddrB = MachO->getScatteredRelocationValue(RE2);<br>
section_iterator SBI = getSectionByAddress(*MachO, AddrB);<br>
assert(SBI != MachO->section_end() && "Can't find section for address B");<br>
- uint64_t SectionBBase;<br>
- SBI->getAddress(SectionBBase);<br>
+ uint64_t SectionBBase = SBI->getAddress();<br>
uint64_t SectionBOffset = AddrB - SectionBBase;<br>
SectionRef SectionB = *SBI;<br>
uint32_t SectionBID =<br>
@@ -211,11 +208,9 @@ private:<br>
unsigned SymbolBaseAddr = MachO->getScatteredRelocationValue(RE);<br>
section_iterator TargetSI = getSectionByAddress(*MachO, SymbolBaseAddr);<br>
assert(TargetSI != MachO->section_end() && "Can't find section for symbol");<br>
- uint64_t SectionBaseAddr;<br>
- TargetSI->getAddress(SectionBaseAddr);<br>
+ uint64_t SectionBaseAddr = TargetSI->getAddress();<br>
SectionRef TargetSection = *TargetSI;<br>
- bool IsCode;<br>
- TargetSection.isText(IsCode);<br>
+ bool IsCode = TargetSection.isText();<br>
uint32_t TargetSectionID =<br>
findOrEmitSection(Obj, TargetSection, IsCode, ObjSectionToID);<br>
<br>
<br>
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Oct 8 10:28:58 2014<br>
@@ -260,18 +260,14 @@ std::error_code COFFObjectFile::getSecti<br>
return getSectionName(Sec, Result);<br>
}<br>
<br>
-std::error_code COFFObjectFile::getSectionAddress(DataRefImpl Ref,<br>
- uint64_t &Result) const {<br>
+uint64_t COFFObjectFile::getSectionAddress(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Result = Sec->VirtualAddress;<br>
- return object_error::success;<br>
+ return Sec->VirtualAddress;<br>
}<br>
<br>
-std::error_code COFFObjectFile::getSectionSize(DataRefImpl Ref,<br>
- uint64_t &Result) const {<br>
+uint64_t COFFObjectFile::getSectionSize(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Result = Sec->SizeOfRawData;<br>
- return object_error::success;<br>
+ return Sec->SizeOfRawData;<br>
}<br>
<br>
std::error_code COFFObjectFile::getSectionContents(DataRefImpl Ref,<br>
@@ -283,71 +279,52 @@ std::error_code COFFObjectFile::getSecti<br>
return EC;<br>
}<br>
<br>
-std::error_code COFFObjectFile::getSectionAlignment(DataRefImpl Ref,<br>
- uint64_t &Res) const {<br>
+uint64_t COFFObjectFile::getSectionAlignment(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Res = uint64_t(1) << (((Sec->Characteristics & 0x00F00000) >> 20) - 1);<br>
- return object_error::success;<br>
+ return uint64_t(1) << (((Sec->Characteristics & 0x00F00000) >> 20) - 1);<br>
}<br>
<br>
-std::error_code COFFObjectFile::isSectionText(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionText(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_CODE;<br>
- return object_error::success;<br>
+ return Sec->Characteristics & COFF::IMAGE_SCN_CNT_CODE;<br>
}<br>
<br>
-std::error_code COFFObjectFile::isSectionData(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionData(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;<br>
- return object_error::success;<br>
+ return Sec->Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;<br>
}<br>
<br>
-std::error_code COFFObjectFile::isSectionBSS(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;<br>
- return object_error::success;<br>
+ return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;<br>
}<br>
<br>
-std::error_code<br>
-COFFObjectFile::isSectionRequiredForExecution(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionRequiredForExecution(DataRefImpl Ref) const {<br>
// FIXME: Unimplemented<br>
- Result = true;<br>
- return object_error::success;<br>
+ return true;<br>
}<br>
<br>
-std::error_code COFFObjectFile::isSectionVirtual(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionVirtual(DataRefImpl Ref) const {<br>
const coff_section *Sec = toSec(Ref);<br>
- Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;<br>
- return object_error::success;<br>
+ return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;<br>
}<br>
<br>
-std::error_code COFFObjectFile::isSectionZeroInit(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionZeroInit(DataRefImpl Ref) const {<br>
// FIXME: Unimplemented.<br>
- Result = false;<br>
- return object_error::success;<br>
+ return false;<br>
}<br>
<br>
-std::error_code COFFObjectFile::isSectionReadOnlyData(DataRefImpl Ref,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::isSectionReadOnlyData(DataRefImpl Ref) const {<br>
// FIXME: Unimplemented.<br>
- Result = false;<br>
- return object_error::success;<br>
+ return false;<br>
}<br>
<br>
-std::error_code COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef,<br>
- DataRefImpl SymbRef,<br>
- bool &Result) const {<br>
+bool COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef,<br>
+ DataRefImpl SymbRef) const {<br>
const coff_section *Sec = toSec(SecRef);<br>
COFFSymbolRef Symb = getCOFFSymbol(SymbRef);<br>
int32_t SecNumber = (Sec - SectionTable) + 1;<br>
- Result = SecNumber == Symb.getSectionNumber();<br>
- return object_error::success;<br>
+ return SecNumber == Symb.getSectionNumber();<br>
}<br>
<br>
relocation_iterator COFFObjectFile::section_rel_begin(DataRefImpl Ref) const {<br>
<br>
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Wed Oct 8 10:28:58 2014<br>
@@ -144,11 +144,9 @@ static void printRelocationTargetName(co<br>
// to find a section beginning instead.<br>
for (const SectionRef &Section : O->sections()) {<br>
std::error_code ec;<br>
- uint64_t Addr;<br>
- StringRef Name;<br>
<br>
- if ((ec = Section.getAddress(Addr)))<br>
- report_fatal_error(ec.message());<br>
+ StringRef Name;<br>
+ uint64_t Addr = Section.getAddress();<br>
if (Addr != Val)<br>
continue;<br>
if ((ec = Section.getName(Name)))<br>
@@ -394,11 +392,10 @@ std::error_code MachOObjectFile::getSymb<br>
EndOffset = Value;<br>
}<br>
if (!EndOffset) {<br>
- uint64_t Size;<br>
DataRefImpl Sec;<br>
Sec.d.a = SectionIndex-1;<br>
- getSectionSize(Sec, Size);<br>
- getSectionAddress(Sec, EndOffset);<br>
+ uint64_t Size = getSectionSize(Sec);<br>
+ EndOffset = getSectionAddress(Sec);<br>
EndOffset += Size;<br>
}<br>
Result = EndOffset - BeginOffset;<br>
@@ -495,29 +492,16 @@ std::error_code MachOObjectFile::getSect<br>
return object_error::success;<br>
}<br>
<br>
-std::error_code MachOObjectFile::getSectionAddress(DataRefImpl Sec,<br>
- uint64_t &Res) const {<br>
- if (is64Bit()) {<br>
- MachO::section_64 Sect = getSection64(Sec);<br>
- Res = Sect.addr;<br>
- } else {<br>
- MachO::section Sect = getSection(Sec);<br>
- Res = Sect.addr;<br>
- }<br>
- return object_error::success;<br>
+uint64_t MachOObjectFile::getSectionAddress(DataRefImpl Sec) const {<br>
+ if (is64Bit())<br>
+ return getSection64(Sec).addr;<br>
+ return getSection(Sec).addr;<br>
}<br>
<br>
-std::error_code MachOObjectFile::getSectionSize(DataRefImpl Sec,<br>
- uint64_t &Res) const {<br>
- if (is64Bit()) {<br>
- MachO::section_64 Sect = getSection64(Sec);<br>
- Res = Sect.size;<br>
- } else {<br>
- MachO::section Sect = getSection(Sec);<br>
- Res = Sect.size;<br>
- }<br>
-<br>
- return object_error::success;<br>
+uint64_t MachOObjectFile::getSectionSize(DataRefImpl Sec) const {<br>
+ if (is64Bit())<br>
+ return getSection64(Sec).size;<br>
+ return getSection(Sec).size;<br>
}<br>
<br>
std::error_code MachOObjectFile::getSectionContents(DataRefImpl Sec,<br>
@@ -539,8 +523,7 @@ std::error_code MachOObjectFile::getSect<br>
return object_error::success;<br>
}<br>
<br>
-std::error_code MachOObjectFile::getSectionAlignment(DataRefImpl Sec,<br>
- uint64_t &Res) const {<br>
+uint64_t MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {<br>
uint32_t Align;<br>
if (is64Bit()) {<br>
MachO::section_64 Sect = getSection64(Sec);<br>
@@ -550,92 +533,70 @@ std::error_code MachOObjectFile::getSect<br>
Align = Sect.align;<br>
}<br>
<br>
- Res = uint64_t(1) << Align;<br>
- return object_error::success;<br>
+ return uint64_t(1) << Align;<br>
}<br>
<br>
-std::error_code MachOObjectFile::isSectionText(DataRefImpl Sec,<br>
- bool &Res) const {<br>
+bool MachOObjectFile::isSectionText(DataRefImpl Sec) const {<br>
uint32_t Flags = getSectionFlags(this, Sec);<br>
- Res = Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;<br>
- return object_error::success;<br>
+ return Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;<br>
}<br>
<br>
-std::error_code MachOObjectFile::isSectionData(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool MachOObjectFile::isSectionData(DataRefImpl Sec) const {<br>
uint32_t Flags = getSectionFlags(this, Sec);<br>
unsigned SectionType = Flags & MachO::SECTION_TYPE;<br>
- Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&<br>
- !(SectionType == MachO::S_ZEROFILL ||<br>
- SectionType == MachO::S_GB_ZEROFILL);<br>
- return object_error::success;<br>
+ return !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&<br>
+ !(SectionType == MachO::S_ZEROFILL ||<br>
+ SectionType == MachO::S_GB_ZEROFILL);<br>
}<br>
<br>
-std::error_code MachOObjectFile::isSectionBSS(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const {<br>
uint32_t Flags = getSectionFlags(this, Sec);<br>
unsigned SectionType = Flags & MachO::SECTION_TYPE;<br>
- Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&<br>
- (SectionType == MachO::S_ZEROFILL ||<br>
- SectionType == MachO::S_GB_ZEROFILL);<br>
- return object_error::success;<br>
+ return !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&<br>
+ (SectionType == MachO::S_ZEROFILL ||<br>
+ SectionType == MachO::S_GB_ZEROFILL);<br>
}<br>
<br>
-std::error_code<br>
-MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sect) const {<br>
// FIXME: Unimplemented.<br>
- Result = true;<br>
- return object_error::success;<br>
+ return true;<br>
}<br>
<br>
-std::error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const {<br>
// FIXME: Unimplemented.<br>
- Result = false;<br>
- return object_error::success;<br>
+ return false;<br>
}<br>
<br>
-std::error_code MachOObjectFile::isSectionZeroInit(DataRefImpl Sec,<br>
- bool &Res) const {<br>
+bool MachOObjectFile::isSectionZeroInit(DataRefImpl Sec) const {<br>
uint32_t Flags = getSectionFlags(this, Sec);<br>
unsigned SectionType = Flags & MachO::SECTION_TYPE;<br>
- Res = SectionType == MachO::S_ZEROFILL ||<br>
- SectionType == MachO::S_GB_ZEROFILL;<br>
- return object_error::success;<br>
+ return SectionType == MachO::S_ZEROFILL ||<br>
+ SectionType == MachO::S_GB_ZEROFILL;<br>
}<br>
<br>
-std::error_code MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec,<br>
- bool &Result) const {<br>
+bool MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec) const {<br>
// Consider using the code from isSectionText to look for __const sections.<br>
// Alternately, emit S_ATTR_PURE_INSTRUCTIONS and/or S_ATTR_SOME_INSTRUCTIONS<br>
// to use section attributes to distinguish code from data.<br>
<br>
// FIXME: Unimplemented.<br>
- Result = false;<br>
- return object_error::success;<br>
+ return false;<br>
}<br>
<br>
-std::error_code MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,<br>
- DataRefImpl Symb,<br>
- bool &Result) const {<br>
+bool MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,<br>
+ DataRefImpl Symb) const {<br>
SymbolRef::Type ST;<br>
this->getSymbolType(Symb, ST);<br>
- if (ST == SymbolRef::ST_Unknown) {<br>
- Result = false;<br>
- return object_error::success;<br>
- }<br>
+ if (ST == SymbolRef::ST_Unknown)<br>
+ return false;<br>
<br>
- uint64_t SectBegin, SectEnd;<br>
- getSectionAddress(Sec, SectBegin);<br>
- getSectionSize(Sec, SectEnd);<br>
+ uint64_t SectBegin = getSectionAddress(Sec);<br>
+ uint64_t SectEnd = getSectionSize(Sec);<br>
SectEnd += SectBegin;<br>
<br>
uint64_t SymAddr;<br>
getSymbolAddress(Symb, SymAddr);<br>
- Result = (SymAddr >= SectBegin) && (SymAddr < SectEnd);<br>
-<br>
- return object_error::success;<br>
+ return (SymAddr >= SectBegin) && (SymAddr < SectEnd);<br>
}<br>
<br>
relocation_iterator MachOObjectFile::section_rel_begin(DataRefImpl Sec) const {<br>
@@ -673,8 +634,7 @@ std::error_code MachOObjectFile::getRelo<br>
<br>
DataRefImpl Sec;<br>
Sec.d.a = Rel.d.a;<br>
- uint64_t SecAddress;<br>
- getSectionAddress(Sec, SecAddress);<br>
+ uint64_t SecAddress = getSectionAddress(Sec);<br>
Res = SecAddress + Offset;<br>
return object_error::success;<br>
}<br>
<br>
Modified: llvm/trunk/lib/Object/Object.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Object.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Object.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Object/Object.cpp (original)<br>
+++ llvm/trunk/lib/Object/Object.cpp Wed Oct 8 10:28:58 2014<br>
@@ -132,10 +132,7 @@ const char *LLVMGetSectionName(LLVMSecti<br>
}<br>
<br>
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) {<br>
- uint64_t ret;<br>
- if (std::error_code ec = (*unwrap(SI))->getSize(ret))<br>
- report_fatal_error(ec.message());<br>
- return ret;<br>
+ return (*unwrap(SI))->getSize();<br>
}<br>
<br>
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {<br>
@@ -146,18 +143,12 @@ const char *LLVMGetSectionContents(LLVMS<br>
}<br>
<br>
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) {<br>
- uint64_t ret;<br>
- if (std::error_code ec = (*unwrap(SI))->getAddress(ret))<br>
- report_fatal_error(ec.message());<br>
- return ret;<br>
+ return (*unwrap(SI))->getAddress();<br>
}<br>
<br>
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,<br>
LLVMSymbolIteratorRef Sym) {<br>
- bool ret;<br>
- if (std::error_code ec = (*unwrap(SI))->containsSymbol(**unwrap(Sym), ret))<br>
- report_fatal_error(ec.message());<br>
- return ret;<br>
+ return (*unwrap(SI))->containsSymbol(**unwrap(Sym));<br>
}<br>
<br>
// Section Relocation iterators<br>
<br>
Modified: llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp (original)<br>
+++ llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp Wed Oct 8 10:28:58 2014<br>
@@ -333,7 +333,8 @@ struct SectionData {<br>
std::error_code load(SectionRef &Section) {<br>
if (auto Err = Section.getContents(Data))<br>
return Err;<br>
- return Section.getAddress(Address);<br>
+ Address = Section.getAddress();<br>
+ return instrprof_error::success;<br>
}<br>
<br>
std::error_code get(uint64_t Pointer, size_t Size, StringRef &Result) {<br>
<br>
Modified: llvm/trunk/tools/llvm-cov/TestingSupport.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/TestingSupport.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/TestingSupport.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-cov/TestingSupport.cpp (original)<br>
+++ llvm/trunk/tools/llvm-cov/TestingSupport.cpp Wed Oct 8 10:28:58 2014<br>
@@ -67,11 +67,10 @@ int convert_for_testing_main(int argc, c<br>
return 1;<br>
<br>
// Get the contents of the given sections.<br>
+ uint64_t ProfileNamesAddress = ProfileNames.getAddress();<br>
StringRef CoverageMappingData;<br>
- uint64_t ProfileNamesAddress;<br>
StringRef ProfileNamesData;<br>
if (CoverageMapping.getContents(CoverageMappingData) ||<br>
- ProfileNames.getAddress(ProfileNamesAddress) ||<br>
ProfileNames.getContents(ProfileNamesData))<br>
return 1;<br>
<br>
<br>
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)<br>
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Wed Oct 8 10:28:58 2014<br>
@@ -283,8 +283,7 @@ int SymbolizerGetOpInfo(void *DisInfo, u<br>
return 0;<br>
// First search the section's relocation entries (if any) for an entry<br>
// for this section offset.<br>
- uint64_t sect_addr;<br>
- info->S.getAddress(sect_addr);<br>
+ uint64_t sect_addr = info->S.getAddress();<br>
uint64_t sect_offset = (Pc + Offset) - sect_addr;<br>
bool reloc_found = false;<br>
DataRefImpl Rel;<br>
@@ -522,8 +521,7 @@ const char *GuessLiteralPointer(uint64_t<br>
return nullptr;<br>
<br>
// First see if there is an external relocation entry at the ReferencePC.<br>
- uint64_t sect_addr;<br>
- info->S.getAddress(sect_addr);<br>
+ uint64_t sect_addr = info->S.getAddress();<br>
uint64_t sect_offset = ReferencePC - sect_addr;<br>
bool reloc_found = false;<br>
DataRefImpl Rel;<br>
@@ -820,7 +818,7 @@ static void DisassembleInputMachO2(Strin<br>
// Build a data in code table that is sorted on by the address of each entry.<br>
uint64_t BaseAddress = 0;<br>
if (Header.filetype == MachO::MH_OBJECT)<br>
- Sections[0].getAddress(BaseAddress);<br>
+ BaseAddress = Sections[0].getAddress();<br>
else<br>
BaseAddress = BaseSegmentAddress;<br>
DiceTable Dices;<br>
@@ -863,8 +861,7 @@ static void DisassembleInputMachO2(Strin<br>
<br>
for (unsigned SectIdx = 0; SectIdx != Sections.size(); SectIdx++) {<br>
<br>
- bool SectIsText = false;<br>
- Sections[SectIdx].isText(SectIsText);<br>
+ bool SectIsText = Sections[SectIdx].isText();<br>
if (SectIsText == false)<br>
continue;<br>
<br>
@@ -881,8 +878,7 @@ static void DisassembleInputMachO2(Strin<br>
<br>
StringRef Bytes;<br>
Sections[SectIdx].getContents(Bytes);<br>
- uint64_t SectAddress = 0;<br>
- Sections[SectIdx].getAddress(SectAddress);<br>
+ uint64_t SectAddress = Sections[SectIdx].getAddress();<br>
DisasmMemoryObject MemoryObject((const uint8_t *)Bytes.data(), Bytes.size(),<br>
SectAddress);<br>
bool symbolTableWorked = false;<br>
@@ -890,9 +886,9 @@ static void DisassembleInputMachO2(Strin<br>
// Parse relocations.<br>
std::vector<std::pair<uint64_t, SymbolRef>> Relocs;<br>
for (const RelocationRef &Reloc : Sections[SectIdx].relocations()) {<br>
- uint64_t RelocOffset, SectionAddress;<br>
+ uint64_t RelocOffset;<br>
Reloc.getOffset(RelocOffset);<br>
- Sections[SectIdx].getAddress(SectionAddress);<br>
+ uint64_t SectionAddress = Sections[SectIdx].getAddress();<br>
RelocOffset -= SectionAddress;<br>
<br>
symbol_iterator RelocSym = Reloc.getSymbol();<br>
@@ -933,15 +929,13 @@ static void DisassembleInputMachO2(Strin<br>
continue;<br>
<br>
// Make sure the symbol is defined in this section.<br>
- bool containsSym = false;<br>
- Sections[SectIdx].containsSymbol(Symbols[SymIdx], containsSym);<br>
+ bool containsSym = Sections[SectIdx].containsSymbol(Symbols[SymIdx]);<br>
if (!containsSym)<br>
continue;<br>
<br>
// Start at the address of the symbol relative to the section's address.<br>
- uint64_t SectionAddress = 0;<br>
uint64_t Start = 0;<br>
- Sections[SectIdx].getAddress(SectionAddress);<br>
+ uint64_t SectionAddress = Sections[SectIdx].getAddress();<br>
Symbols[SymIdx].getAddress(Start);<br>
Start -= SectionAddress;<br>
<br>
@@ -954,8 +948,8 @@ static void DisassembleInputMachO2(Strin<br>
SymbolRef::Type NextSymType;<br>
Symbols[NextSymIdx].getType(NextSymType);<br>
if (NextSymType == SymbolRef::ST_Function) {<br>
- Sections[SectIdx].containsSymbol(Symbols[NextSymIdx],<br>
- containsNextSym);<br>
+ containsNextSym =<br>
+ Sections[SectIdx].containsSymbol(Symbols[NextSymIdx]);<br>
Symbols[NextSymIdx].getAddress(NextSym);<br>
NextSym -= SectionAddress;<br>
break;<br>
@@ -963,8 +957,7 @@ static void DisassembleInputMachO2(Strin<br>
++NextSymIdx;<br>
}<br>
<br>
- uint64_t SectSize;<br>
- Sections[SectIdx].getSize(SectSize);<br>
+ uint64_t SectSize = Sections[SectIdx].getSize();<br>
uint64_t End = containsNextSym ? NextSym : SectSize;<br>
uint64_t Size;<br>
<br>
@@ -1050,11 +1043,9 @@ static void DisassembleInputMachO2(Strin<br>
}<br>
}<br>
if (!symbolTableWorked) {<br>
- // Reading the symbol table didn't work, disassemble the whole section.<br>
- uint64_t SectAddress;<br>
- Sections[SectIdx].getAddress(SectAddress);<br>
- uint64_t SectSize;<br>
- Sections[SectIdx].getSize(SectSize);<br>
+ // Reading the symbol table didn't work, disassemble the whole section.<br>
+ uint64_t SectAddress = Sections[SectIdx].getAddress();<br>
+ uint64_t SectSize = Sections[SectIdx].getSize();<br>
uint64_t InstSize;<br>
for (uint64_t Index = 0; Index < SectSize; Index += InstSize) {<br>
MCInst Inst;<br>
@@ -1159,8 +1150,7 @@ static void findUnwindRelocNameAddend(co<br>
auto RE = Obj->getRelocation(Reloc.getRawDataRefImpl());<br>
SectionRef RelocSection = Obj->getRelocationSection(RE);<br>
<br>
- uint64_t SectionAddr;<br>
- RelocSection.getAddress(SectionAddr);<br>
+ uint64_t SectionAddr = RelocSection.getAddress();<br>
<br>
auto Sym = Symbols.upper_bound(Addr);<br>
if (Sym == Symbols.begin()) {<br>
@@ -2731,10 +2721,8 @@ SegInfo::SegInfo(const object::MachOObje<br>
SectionInfo Info;<br>
if (error(Section.getName(Info.SectionName)))<br>
return;<br>
- if (error(Section.getAddress(Info.Address)))<br>
- return;<br>
- if (error(Section.getSize(Info.Size)))<br>
- return;<br>
+ Info.Address = Section.getAddress();<br>
+ Info.Size = Section.getSize();<br>
Info.SegmentName =<br>
Obj->getSectionFinalSegmentName(Section.getRawDataRefImpl());<br>
if (!Info.SegmentName.equals(CurSegName)) {<br>
<br>
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)<br>
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Wed Oct 8 10:28:58 2014<br>
@@ -307,25 +307,17 @@ static void DisassembleObject(const Obje<br>
}<br>
<br>
for (const SectionRef &Section : Obj->sections()) {<br>
- bool Text;<br>
- if (error(Section.isText(Text)))<br>
- break;<br>
+ bool Text = Section.isText();<br>
if (!Text)<br>
continue;<br>
<br>
- uint64_t SectionAddr;<br>
- if (error(Section.getAddress(SectionAddr)))<br>
- break;<br>
-<br>
- uint64_t SectSize;<br>
- if (error(Section.getSize(SectSize)))<br>
- break;<br>
+ uint64_t SectionAddr = Section.getAddress();<br>
+ uint64_t SectSize = Section.getSize();<br>
<br>
// Make a list of all the symbols in this section.<br>
std::vector<std::pair<uint64_t, StringRef>> Symbols;<br>
for (const SymbolRef &Symbol : Obj->symbols()) {<br>
- bool contains;<br>
- if (!error(Section.containsSymbol(Symbol, contains)) && contains) {<br>
+ if (Section.containsSymbol(Symbol)) {<br>
uint64_t Address;<br>
if (error(Symbol.getAddress(Address)))<br>
break;<br>
@@ -501,19 +493,11 @@ static void PrintSectionHeaders(const Ob<br>
StringRef Name;<br>
if (error(Section.getName(Name)))<br>
return;<br>
- uint64_t Address;<br>
- if (error(Section.getAddress(Address)))<br>
- return;<br>
- uint64_t Size;<br>
- if (error(Section.getSize(Size)))<br>
- return;<br>
- bool Text, Data, BSS;<br>
- if (error(Section.isText(Text)))<br>
- return;<br>
- if (error(Section.isData(Data)))<br>
- return;<br>
- if (error(Section.isBSS(BSS)))<br>
- return;<br>
+ uint64_t Address = Section.getAddress();<br>
+ uint64_t Size = Section.getSize();<br>
+ bool Text = Section.isText();<br>
+ bool Data = Section.isData();<br>
+ bool BSS = Section.isBSS();<br>
std::string Type = (std::string(Text ? "TEXT " : "") +<br>
(Data ? "DATA " : "") + (BSS ? "BSS" : ""));<br>
outs() << format("%3d %-13s %08" PRIx64 " %016" PRIx64 " %s\n", i,<br>
@@ -527,20 +511,14 @@ static void PrintSectionContents(const O<br>
for (const SectionRef &Section : Obj->sections()) {<br>
StringRef Name;<br>
StringRef Contents;<br>
- uint64_t BaseAddr;<br>
- bool BSS;<br>
if (error(Section.getName(Name)))<br>
continue;<br>
- if (error(Section.getAddress(BaseAddr)))<br>
- continue;<br>
- if (error(Section.isBSS(BSS)))<br>
- continue;<br>
+ uint64_t BaseAddr = Section.getAddress();<br>
+ bool BSS = Section.isBSS();<br>
<br>
outs() << "Contents of section " << Name << ":\n";<br>
if (BSS) {<br>
- uint64_t Size;<br>
- if (error(Section.getSize(Size)))<br>
- continue;<br>
+ uint64_t Size = Section.getSize();<br>
outs() << format("<skipping contents of bss section at [%04" PRIx64<br>
", %04" PRIx64 ")>\n",<br>
BaseAddr, BaseAddr + Size);<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/ARMWinEHPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMWinEHPrinter.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMWinEHPrinter.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/ARMWinEHPrinter.cpp (original)<br>
+++ llvm/trunk/tools/llvm-readobj/ARMWinEHPrinter.cpp Wed Oct 8 10:28:58 2014<br>
@@ -186,13 +186,8 @@ void Decoder::printRegisters(const std::<br>
ErrorOr<object::SectionRef><br>
Decoder::getSectionContaining(const COFFObjectFile &COFF, uint64_t VA) {<br>
for (const auto &Section : COFF.sections()) {<br>
- uint64_t Address;<br>
- uint64_t Size;<br>
-<br>
- if (std::error_code EC = Section.getAddress(Address))<br>
- return EC;<br>
- if (std::error_code EC = Section.getSize(Size))<br>
- return EC;<br>
+ uint64_t Address = Section.getAddress();<br>
+ uint64_t Size = Section.getSize();<br>
<br>
if (VA >= Address && (VA - Address) <= Size)<br>
return Section;<br>
@@ -525,10 +520,7 @@ bool Decoder::dumpXDataRecord(const COFF<br>
if (COFF.getSectionContents(COFF.getCOFFSection(Section), Contents))<br>
return false;<br>
<br>
- uint64_t SectionVA;<br>
- if (Section.getAddress(SectionVA))<br>
- return false;<br>
-<br>
+ uint64_t SectionVA = Section.getAddress();<br>
uint64_t Offset = VA - SectionVA;<br>
const ulittle32_t *Data =<br>
reinterpret_cast<const ulittle32_t *>(Contents.data() + Offset);<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)<br>
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Wed Oct 8 10:28:58 2014<br>
@@ -629,8 +629,7 @@ void COFFDumper::printSections() {<br>
if (opts::SectionSymbols) {<br>
ListScope D(W, "Symbols");<br>
for (const SymbolRef &Symbol : Obj->symbols()) {<br>
- bool Contained = false;<br>
- if (Sec.containsSymbol(Symbol, Contained) || !Contained)<br>
+ if (!Sec.containsSymbol(Symbol))<br>
continue;<br>
<br>
printSymbol(Symbol);<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/MachODumper.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/MachODumper.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/MachODumper.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/MachODumper.cpp (original)<br>
+++ llvm/trunk/tools/llvm-readobj/MachODumper.cpp Wed Oct 8 10:28:58 2014<br>
@@ -257,8 +257,7 @@ void MachODumper::printSections(const Ma<br>
if (opts::SectionSymbols) {<br>
ListScope D(W, "Symbols");<br>
for (const SymbolRef &Symbol : Obj->symbols()) {<br>
- bool Contained = false;<br>
- if (Section.containsSymbol(Symbol, Contained) || !Contained)<br>
+ if (!Section.containsSymbol(Symbol))<br>
continue;<br>
<br>
printSymbol(Symbol);<br>
@@ -266,9 +265,7 @@ void MachODumper::printSections(const Ma<br>
}<br>
<br>
if (opts::SectionData) {<br>
- bool IsBSS;<br>
- if (error(Section.isBSS(IsBSS)))<br>
- break;<br>
+ bool IsBSS = Section.isBSS();<br>
if (!IsBSS) {<br>
StringRef Data;<br>
if (error(Section.getContents(Data)))<br>
<br>
Modified: llvm/trunk/tools/llvm-size/llvm-size.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-size/llvm-size.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-size/llvm-size.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-size/llvm-size.cpp (original)<br>
+++ llvm/trunk/tools/llvm-size/llvm-size.cpp Wed Oct 8 10:28:58 2014<br>
@@ -297,17 +297,13 @@ static void PrintObjectSectionSizes(Obje<br>
std::size_t max_size_len = strlen("size");<br>
std::size_t max_addr_len = strlen("addr");<br>
for (const SectionRef &Section : Obj->sections()) {<br>
- uint64_t size = 0;<br>
- if (error(Section.getSize(size)))<br>
- return;<br>
+ uint64_t size = Section.getSize();<br>
total += size;<br>
<br>
StringRef name;<br>
- uint64_t addr = 0;<br>
if (error(Section.getName(name)))<br>
return;<br>
- if (error(Section.getAddress(addr)))<br>
- return;<br>
+ uint64_t addr = Section.getAddress();<br>
max_name_len = std::max(max_name_len, name.size());<br>
max_size_len = std::max(max_size_len, getNumLengthAsString(size));<br>
max_addr_len = std::max(max_addr_len, getNumLengthAsString(addr));<br>
@@ -337,14 +333,10 @@ static void PrintObjectSectionSizes(Obje<br>
// Print each section.<br>
for (const SectionRef &Section : Obj->sections()) {<br>
StringRef name;<br>
- uint64_t size = 0;<br>
- uint64_t addr = 0;<br>
if (error(Section.getName(name)))<br>
return;<br>
- if (error(Section.getSize(size)))<br>
- return;<br>
- if (error(Section.getAddress(addr)))<br>
- return;<br>
+ uint64_t size = Section.getSize();<br>
+ uint64_t addr = Section.getAddress();<br>
std::string namestr = name;<br>
<br>
outs() << format(fmt.str().c_str(), namestr.c_str(), size, addr);<br>
@@ -365,18 +357,10 @@ static void PrintObjectSectionSizes(Obje<br>
<br>
// Make one pass over the section table to calculate sizes.<br>
for (const SectionRef &Section : Obj->sections()) {<br>
- uint64_t size = 0;<br>
- bool isText = false;<br>
- bool isData = false;<br>
- bool isBSS = false;<br>
- if (error(Section.getSize(size)))<br>
- return;<br>
- if (error(Section.isText(isText)))<br>
- return;<br>
- if (error(Section.isData(isData)))<br>
- return;<br>
- if (error(Section.isBSS(isBSS)))<br>
- return;<br>
+ uint64_t size = Section.getSize();<br>
+ bool isText = Section.isText();<br>
+ bool isData = Section.isData();<br>
+ bool isBSS = Section.isBSS();<br>
if (isText)<br>
total_text += size;<br>
else if (isData)<br>
<br>
Modified: llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp?rev=219314&r1=219313&r2=219314&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp?rev=219314&r1=219313&r2=219314&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp (original)<br>
+++ llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp Wed Oct 8 10:28:58 2014<br>
@@ -139,9 +139,8 @@ static void dumpVTables(const ObjectFile<br>
// Skip external symbols.<br>
if (SecI == Obj->section_end())<br>
continue;<br>
- bool IsBSS, IsVirtual;<br>
- if (error(SecI->isBSS(IsBSS)) || error(SecI->isVirtual(IsVirtual)))<br>
- break;<br>
+ bool IsBSS = SecI->isBSS();<br>
+ bool IsVirtual = SecI->isVirtual();<br>
// Skip virtual or BSS sections.<br>
if (IsBSS || IsVirtual)<br>
continue;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>