Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.
[oota-llvm.git] / tools / llvm-readobj / MachODumper.cpp
index 54de49c310e304cb52db6e47db66b61997d162cc..8df6fd6457ffd729c8980445b3039ea43a218ecc 100644 (file)
@@ -341,11 +341,12 @@ void MachODumper::printRelocation(const MachOObjectFile *Obj,
   uint64_t Offset;
   SmallString<32> RelocName;
   StringRef SymbolName;
-  SymbolRef Symbol;
   if (error(RelI->getOffset(Offset))) return;
   if (error(RelI->getTypeName(RelocName))) return;
-  if (error(RelI->getSymbol(Symbol))) return;
-  if (error(Symbol.getName(SymbolName))) return;
+  symbol_iterator Symbol = RelI->getSymbol();
+  if (Symbol != Obj->end_symbols() &&
+      error(Symbol->getName(SymbolName)))
+    return;
 
   DataRefImpl DR = RelI->getRawDataRefImpl();
   macho::RelocationEntry RE = Obj->getRelocation(DR);
@@ -406,12 +407,11 @@ void MachODumper::printSymbol(symbol_iterator SymI) {
   MachOSymbol Symbol;
   getSymbol(Obj, SymI->getRawDataRefImpl(), Symbol);
 
-  StringRef SectionName;
+  StringRef SectionName = "";
   section_iterator SecI(Obj->end_sections());
-  if (error(SymI->getSection(SecI)) ||
-      SecI == Obj->end_sections() ||
-      error(SecI->getName(SectionName)))
-    SectionName = "";
+  if (!error(SymI->getSection(SecI)) &&
+      SecI != Obj->end_sections())
+      error(SecI->getName(SectionName));
 
   DictScope D(W, "Symbol");
   W.printNumber("Name", SymbolName, Symbol.StringIndex);