Skip to content

Commit

Permalink
[llvm-objdump] - Cleanup the code. NFCI.
Browse files Browse the repository at this point in the history
This is a cosmetic cleanup for the llvm-objdump code.

This patch:
* Renames things to match the official LLVM code style (lower case -> upper case).
* Removes few obviously excessive variables.
* Moves a few lines closer to the place of use, reorders the code a bit to simplify it,
to avoid doing excessive returns and to avoid using 'else` after returns.

I focused only on a llvm-objdump.h/llvm-objdump.cpp files. Few changes in the
MachODump.cpp and COFFDump.cpp are a result of llvm-objdump.h modification.

Differential revision: https://reviews.llvm.org/D56637

llvm-svn: 351171
  • Loading branch information
George Rimar committed Jan 15, 2019
1 parent 226af75 commit 73a2723
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 313 deletions.
2 changes: 1 addition & 1 deletion llvm/tools/llvm-objdump/COFFDump.cpp
Expand Up @@ -455,7 +455,7 @@ static bool getPDataSection(const COFFObjectFile *Obj,
Rels.push_back(Reloc);

// Sort relocations by address.
llvm::sort(Rels, RelocAddressLess);
llvm::sort(Rels, isRelocAddressLess);

ArrayRef<uint8_t> Contents;
error(Obj->getSectionContents(Pdata, Contents));
Expand Down
12 changes: 6 additions & 6 deletions llvm/tools/llvm-objdump/MachODump.cpp
Expand Up @@ -1627,9 +1627,9 @@ static void ProcessMachO(StringRef Name, MachOObjectFile *MachOOF,
if (Relocations)
PrintRelocations(MachOOF, !NonVerbose);
if (SectionHeaders)
PrintSectionHeaders(MachOOF);
printSectionHeaders(MachOOF);
if (SectionContents)
PrintSectionContents(MachOOF);
printSectionContents(MachOOF);
if (!FilterSections.empty())
DumpSectionContents(FileName, MachOOF, !NonVerbose);
if (InfoPlist)
Expand All @@ -1639,7 +1639,7 @@ static void ProcessMachO(StringRef Name, MachOObjectFile *MachOOF,
if (DylibId)
PrintDylibs(MachOOF, true);
if (SymbolTable)
PrintSymbolTable(MachOOF, ArchiveName, ArchitectureName);
printSymbolTable(MachOOF, ArchiveName, ArchitectureName);
if (UnwindInfo)
printMachOUnwindInfo(MachOOF);
if (PrivateHeaders) {
Expand Down Expand Up @@ -1959,7 +1959,7 @@ static bool ValidateArchFlags() {
// -arch flags selecting just those slices as specified by them and also parses
// archive files. Then for each individual Mach-O file ProcessMachO() is
// called to process the file based on the command line options.
void llvm::ParseInputMachO(StringRef Filename) {
void llvm::parseInputMachO(StringRef Filename) {
if (!ValidateArchFlags())
return;

Expand Down Expand Up @@ -1998,7 +1998,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
return;
}
if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(&Bin)) {
ParseInputMachO(UB);
parseInputMachO(UB);
return;
}
if (ObjectFile *O = dyn_cast<ObjectFile>(&Bin)) {
Expand All @@ -2015,7 +2015,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
llvm_unreachable("Input object can't be invalid at this point");
}

void llvm::ParseInputMachO(MachOUniversalBinary *UB) {
void llvm::parseInputMachO(MachOUniversalBinary *UB) {
if (!ValidateArchFlags())
return;

Expand Down

0 comments on commit 73a2723

Please sign in to comment.