summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-symbolizer
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-30 02:49:50 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-30 02:49:50 +0000
commit5e812afaeb3db56db706e81e448db46c08298abd (patch)
tree86d091fea3f71879287f607d9f616e410866099c /llvm/tools/llvm-symbolizer
parent980f2dc4fc9a27fa950f6f9c6baf554aa7cef351 (diff)
downloadbcm5719-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/tools/llvm-symbolizer')
-rw-r--r--llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp b/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp
index 71588e171fa..40751998579 100644
--- a/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp
+++ b/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp
@@ -52,11 +52,8 @@ static void patchFunctionNameInDILineInfo(const std::string &NewFunctionName,
ModuleInfo::ModuleInfo(ObjectFile *Obj, DIContext *DICtx)
: Module(Obj), DebugInfoContext(DICtx) {
- error_code ec;
for (symbol_iterator si = Module->begin_symbols(), se = Module->end_symbols();
- si != se; si.increment(ec)) {
- if (error(ec))
- return;
+ si != se; ++si) {
SymbolRef::Type SymbolType;
if (error(si->getType(SymbolType)))
continue;
@@ -268,9 +265,8 @@ static bool getGNUDebuglinkContents(const Binary *Bin, std::string &DebugName,
const ObjectFile *Obj = dyn_cast<ObjectFile>(Bin);
if (!Obj)
return false;
- error_code EC;
for (section_iterator I = Obj->begin_sections(), E = Obj->end_sections();
- I != E; I.increment(EC)) {
+ I != E; ++I) {
StringRef Name;
I->getName(Name);
Name = Name.substr(Name.find_first_not_of("._"));
OpenPOWER on IntegriCloud