Remove bogus std::error_code returns form SectionRef.

There are two methods in SectionRef that can fail:

* getName: The index into the string table can be invalid.
* getContents: The section might point to invalid contents.

Every other method will always succeed and returning and std::error_code just
complicates the code. For example, a section can have an invalid alignment,
but if we are able to get to the section structure at all and create a
SectionRef, we will always be able to read that invalid alignment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219314 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-10-08 15:28:58 +00:00
parent 1a98f792a5
commit 8175be535a
22 changed files with 252 additions and 470 deletions
+3 -6
View File
@@ -516,12 +516,10 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
StringRef name;
Section.getName(name);
// Skip BSS and Virtual sections, they aren't interesting.
bool IsBSS;
Section.isBSS(IsBSS);
bool IsBSS = Section.isBSS();
if (IsBSS)
continue;
bool IsVirtual;
Section.isVirtual(IsVirtual);
bool IsVirtual = Section.isVirtual();
if (IsVirtual)
continue;
StringRef data;
@@ -612,8 +610,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
}
if (Section.relocation_begin() != Section.relocation_end()) {
uint64_t SectionSize;
RelocatedSection->getSize(SectionSize);
uint64_t SectionSize = RelocatedSection->getSize();
for (const RelocationRef &Reloc : Section.relocations()) {
uint64_t Address;
Reloc.getOffset(Address);