[llvm] r178979 - Remove last use of InMemoryStruct in llvm-objdump.

Rafael Espindola rafael.espindola at gmail.com
Sun Apr 7 07:40:18 PDT 2013


Author: rafael
Date: Sun Apr  7 09:40:18 2013
New Revision: 178979

URL: http://llvm.org/viewvc/llvm-project?rev=178979&view=rev
Log:
Remove last use of InMemoryStruct in llvm-objdump.

Modified:
    llvm/trunk/include/llvm/Object/MachO.h
    llvm/trunk/lib/Object/MachOObjectFile.cpp
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=178979&r1=178978&r2=178979&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Sun Apr  7 09:40:18 2013
@@ -113,6 +113,13 @@ namespace MachOFormat {
     support::ulittle32_t NumSections;
     support::ulittle32_t Flags;
   };
+
+  struct LinkeditDataLoadCommand {
+    support::ulittle32_t Type;
+    support::ulittle32_t Size;
+    support::ulittle32_t DataOffset;
+    support::ulittle32_t DataSize;
+  };
 }
 
 typedef MachOObject::LoadCommandInfo LoadCommandInfo;
@@ -145,6 +152,9 @@ public:
   ArrayRef<char> getSectionRawName(DataRefImpl Sec) const;
   ArrayRef<char>getSectionRawFinalSegmentName(DataRefImpl Sec) const;
 
+  const MachOFormat::LinkeditDataLoadCommand *
+    getLinkeditDataLoadCommand(LoadCommandInfo LCI) const;
+
   MachOObject *getObject() { return MachOObj.get(); }
 
   static inline bool classof(const Binary *v) {

Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=178979&r1=178978&r2=178979&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Sun Apr  7 09:40:18 2013
@@ -75,6 +75,14 @@ MachOObjectFile::getSegmentLoadCommand(L
   return reinterpret_cast<const MachOFormat::SegmentLoadCommand*>(Data.data());
 }
 
+const MachOFormat::LinkeditDataLoadCommand *
+MachOObjectFile::getLinkeditDataLoadCommand(LoadCommandInfo LCI) const {
+  StringRef Data = MachOObj->getData(LCI.Offset,
+                                  sizeof(MachOFormat::LinkeditDataLoadCommand));
+  return
+    reinterpret_cast<const MachOFormat::LinkeditDataLoadCommand*>(Data.data());
+}
+
 const MachOFormat::Segment64LoadCommand *
 MachOObjectFile::getSegment64LoadCommand(LoadCommandInfo LCI) const {
   StringRef Data = MachOObj->getData(LCI.Offset,

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=178979&r1=178978&r2=178979&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Sun Apr  7 09:40:18 2013
@@ -223,8 +223,8 @@ static void getSectionsAndSymbols(const
     if (LCI.Command.Type == macho::LCT_FunctionStarts) {
       // We found a function starts segment, parse the addresses for later
       // consumption.
-      InMemoryStruct<macho::LinkeditDataLoadCommand> LLC;
-      MachOObj->getObject()->ReadLinkeditDataLoadCommand(LCI, LLC);
+      const MachOFormat::LinkeditDataLoadCommand *LLC =
+        MachOObj->getLinkeditDataLoadCommand(LCI);
 
       MachOObj->getObject()->ReadULEB128s(LLC->DataOffset, FoundFns);
     }





More information about the llvm-commits mailing list