diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-30 02:49:50 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-30 02:49:50 +0000 |
commit | 5e812afaeb3db56db706e81e448db46c08298abd (patch) | |
tree | 86d091fea3f71879287f607d9f616e410866099c /llvm/lib/DebugInfo | |
parent | 980f2dc4fc9a27fa950f6f9c6baf554aa7cef351 (diff) | |
download | bcm5719-llvm-5e812afaeb3db56db706e81e448db46c08298abd.tar.gz bcm5719-llvm-5e812afaeb3db56db706e81e448db46c08298abd.zip |
Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In
retrospect, that is not too surprising: no object format stores symbols or
sections in a linked list or other structure that requires chasing pointers.
As a consequence, all error checking can be done on begin() and end().
This reduces the text segment of bin/llvm-readobj in my machine from 521233 to
518526 bytes.
llvm-svn: 200442
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFContext.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp index 3b73f7ff4df..daf7cdd98c6 100644 --- a/llvm/lib/DebugInfo/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARFContext.cpp @@ -603,10 +603,9 @@ static bool consumeCompressedDebugSectionHeader(StringRef &data, DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : IsLittleEndian(Obj->isLittleEndian()), AddressSize(Obj->getBytesInAddress()) { - error_code ec; for (object::section_iterator i = Obj->begin_sections(), - e = Obj->end_sections(); - i != e; i.increment(ec)) { + e = Obj->end_sections(); + i != e; ++i) { StringRef name; i->getName(name); StringRef data; @@ -697,8 +696,8 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : uint64_t SectionSize; RelocatedSection->getSize(SectionSize); for (object::relocation_iterator reloc_i = i->begin_relocations(), - reloc_e = i->end_relocations(); - reloc_i != reloc_e; reloc_i.increment(ec)) { + reloc_e = i->end_relocations(); + reloc_i != reloc_e; ++reloc_i) { uint64_t Address; reloc_i->getOffset(Address); uint64_t Type; |