[llvm] r242786 - Simplify printing the soname. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jul 21 06:48:41 PDT 2015
Author: rafael
Date: Tue Jul 21 08:48:41 2015
New Revision: 242786
URL: http://llvm.org/viewvc/llvm-project?rev=242786&view=rev
Log:
Simplify printing the soname. NFC.
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
llvm/trunk/tools/llvm-readobj/ObjDumper.h
llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=242786&r1=242785&r2=242786&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Tue Jul 21 08:48:41 2015
@@ -57,6 +57,7 @@ public:
void printNeededLibraries() override;
void printProgramHeaders() override;
void printHashTable() override;
+ void printLoadName() override;
void printAttributes() override;
void printMipsPLTGOT() override;
@@ -1140,6 +1141,10 @@ void ELFDumper<ELFT>::printHashTable() {
W.printList("Chains", HT->chains());
}
+template <typename ELFT> void ELFDumper<ELFT>::printLoadName() {
+ outs() << "LoadName: " << Obj->getLoadName() << '\n';
+}
+
template <class ELFT>
void ELFDumper<ELFT>::printAttributes() {
W.startLine() << "Attributes not implemented.\n";
Modified: llvm/trunk/tools/llvm-readobj/ObjDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ObjDumper.h?rev=242786&r1=242785&r2=242786&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ObjDumper.h (original)
+++ llvm/trunk/tools/llvm-readobj/ObjDumper.h Tue Jul 21 08:48:41 2015
@@ -38,6 +38,7 @@ public:
virtual void printNeededLibraries() { }
virtual void printProgramHeaders() { }
virtual void printHashTable() { }
+ virtual void printLoadName() {}
// Only implemented for ARM ELF at this time.
virtual void printAttributes() { }
Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=242786&r1=242785&r2=242786&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Tue Jul 21 08:48:41 2015
@@ -251,18 +251,6 @@ static std::error_code createDumper(cons
return readobj_error::unsupported_obj_file_format;
}
-static StringRef getLoadName(const ObjectFile *Obj) {
- if (auto *ELF = dyn_cast<ELF32LEObjectFile>(Obj))
- return ELF->getELFFile()->getLoadName();
- if (auto *ELF = dyn_cast<ELF64LEObjectFile>(Obj))
- return ELF->getELFFile()->getLoadName();
- if (auto *ELF = dyn_cast<ELF32BEObjectFile>(Obj))
- return ELF->getELFFile()->getLoadName();
- if (auto *ELF = dyn_cast<ELF64BEObjectFile>(Obj))
- return ELF->getELFFile()->getLoadName();
- llvm_unreachable("Not ELF");
-}
-
/// @brief Dumps the specified object file.
static void dumpObject(const ObjectFile *Obj) {
StreamWriter Writer(outs());
@@ -279,8 +267,7 @@ static void dumpObject(const ObjectFile
<< Triple::getArchTypeName((llvm::Triple::ArchType)Obj->getArch())
<< "\n";
outs() << "AddressSize: " << (8*Obj->getBytesInAddress()) << "bit\n";
- if (Obj->isELF())
- outs() << "LoadName: " << getLoadName(Obj) << "\n";
+ Dumper->printLoadName();
if (opts::FileHeaders)
Dumper->printFileHeaders();
More information about the llvm-commits
mailing list