Use early returns to reduce nesting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204171 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama 2014-03-18 18:58:51 +00:00
parent 50e4d56b9f
commit 172c31844b

View File

@ -699,9 +699,10 @@ static void PrintCOFFSymbolTable(const COFFObjectFile *coff) {
static void PrintSymbolTable(const ObjectFile *o) { static void PrintSymbolTable(const ObjectFile *o) {
outs() << "SYMBOL TABLE:\n"; outs() << "SYMBOL TABLE:\n";
if (const COFFObjectFile *coff = dyn_cast<const COFFObjectFile>(o)) if (const COFFObjectFile *coff = dyn_cast<const COFFObjectFile>(o)) {
PrintCOFFSymbolTable(coff); PrintCOFFSymbolTable(coff);
else { return;
}
for (const SymbolRef &Symbol : o->symbols()) { for (const SymbolRef &Symbol : o->symbols()) {
StringRef Name; StringRef Name;
uint64_t Address; uint64_t Address;
@ -751,11 +752,11 @@ static void PrintSymbolTable(const ObjectFile *o) {
<< Debug // Debugging (d) or dynamic (D) symbol. << Debug // Debugging (d) or dynamic (D) symbol.
<< FileFunc // Name of function (F), file (f) or object (O). << FileFunc // Name of function (F), file (f) or object (O).
<< ' '; << ' ';
if (Absolute) if (Absolute) {
outs() << "*ABS*"; outs() << "*ABS*";
else if (Section == o->section_end()) } else if (Section == o->section_end()) {
outs() << "*UND*"; outs() << "*UND*";
else { } else {
if (const MachOObjectFile *MachO = if (const MachOObjectFile *MachO =
dyn_cast<const MachOObjectFile>(o)) { dyn_cast<const MachOObjectFile>(o)) {
DataRefImpl DR = Section->getRawDataRefImpl(); DataRefImpl DR = Section->getRawDataRefImpl();
@ -772,7 +773,6 @@ static void PrintSymbolTable(const ObjectFile *o) {
<< Name << Name
<< '\n'; << '\n';
} }
}
} }
static void PrintUnwindInfo(const ObjectFile *o) { static void PrintUnwindInfo(const ObjectFile *o) {