summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNico Rieck <nico.rieck@gmail.com>2013-04-22 08:34:46 +0000
committerNico Rieck <nico.rieck@gmail.com>2013-04-22 08:34:46 +0000
commit48831939a83915939f759bdbe95404499169bc85 (patch)
tree4c33a29810aacc0378d102edbf60cb7f26507e6e /tools
parentd9e70873f38e734f37ed8b7ce75839b25e3eada5 (diff)
downloadexternal_llvm-48831939a83915939f759bdbe95404499169bc85.zip
external_llvm-48831939a83915939f759bdbe95404499169bc85.tar.gz
external_llvm-48831939a83915939f759bdbe95404499169bc85.tar.bz2
llvm-readobj: Do not print NULL StringRefs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-readobj/COFFDumper.cpp6
-rw-r--r--tools/llvm-readobj/ELFDumper.cpp6
-rw-r--r--tools/llvm-readobj/MachODumper.cpp9
3 files changed, 10 insertions, 11 deletions
diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp
index d600bc3..56885c6 100644
--- a/tools/llvm-readobj/COFFDumper.cpp
+++ b/tools/llvm-readobj/COFFDumper.cpp
@@ -726,9 +726,9 @@ void COFFDumper::printSymbol(symbol_iterator SymI) {
if (Obj->getSymbolName(Symbol, SymbolName))
SymbolName = "";
- StringRef SectionName;
- if (Section && Obj->getSectionName(Section, SectionName))
- SectionName = "";
+ StringRef SectionName = "";
+ if (Section)
+ Obj->getSectionName(Section, SectionName);
W.printString("Name", SymbolName);
W.printNumber("Value", Symbol->Value);
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
index 3757b09..f771cbd 100644
--- a/tools/llvm-readobj/ELFDumper.cpp
+++ b/tools/llvm-readobj/ELFDumper.cpp
@@ -643,9 +643,9 @@ void ELFDumper<ELFT>::printSymbol(symbol_iterator SymI, bool IsDynamic) {
if (SymI->getName(SymbolName))
SymbolName = "";
- StringRef SectionName;
- if (Section && Obj->getSectionName(Section, SectionName))
- SectionName = "";
+ StringRef SectionName = "";
+ if (Section)
+ Obj->getSectionName(Section, SectionName);
std::string FullSymbolName(SymbolName);
if (IsDynamic) {
diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp
index 54de49c..10e53d9 100644
--- a/tools/llvm-readobj/MachODumper.cpp
+++ b/tools/llvm-readobj/MachODumper.cpp
@@ -406,12 +406,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);