[PATCH] D27074: Object: Add IRObjectFile::getTargetTriple().

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 16:09:22 PST 2016


pcc created this revision.
pcc added a reviewer: mehdi_amini.
pcc added subscribers: llvm-commits, rafael.
pcc added a dependency: D27073: Object: Extract a ModuleSymbolTable class from IRObjectFile..

This lets us remove a use of IRObjectFile::getModule() in llvm-nm.

Depends on https://reviews.llvm.org/D27073


https://reviews.llvm.org/D27074

Files:
  llvm/include/llvm/Object/IRObjectFile.h
  llvm/lib/Object/IRObjectFile.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp


Index: llvm/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/tools/llvm-nm/llvm-nm.cpp
+++ llvm/tools/llvm-nm/llvm-nm.cpp
@@ -267,10 +267,9 @@
 static char isSymbolList64Bit(SymbolicFile &Obj) {
   if (isa<IRObjectFile>(Obj)) {
     IRObjectFile *IRobj = dyn_cast<IRObjectFile>(&Obj);
-    Module &M = IRobj->getModule();
-    if (M.getTargetTriple().empty())
+    if (IRobj->getTargetTriple().empty())
       return false;
-    Triple T(M.getTargetTriple());
+    Triple T(IRobj->getTargetTriple());
     return T.isArch64Bit();
   }
   if (isa<COFFObjectFile>(Obj))
Index: llvm/lib/Object/IRObjectFile.cpp
===================================================================
--- llvm/lib/Object/IRObjectFile.cpp
+++ llvm/lib/Object/IRObjectFile.cpp
@@ -79,6 +79,8 @@
   return basic_symbol_iterator(BasicSymbolRef(Ret, this));
 }
 
+StringRef IRObjectFile::getTargetTriple() const { return M->getTargetTriple(); }
+
 ErrorOr<MemoryBufferRef> IRObjectFile::findBitcodeInObject(const ObjectFile &Obj) {
   for (const SectionRef &Sec : Obj.sections()) {
     if (Sec.isBitcode()) {
Index: llvm/include/llvm/Object/IRObjectFile.h
===================================================================
--- llvm/include/llvm/Object/IRObjectFile.h
+++ llvm/include/llvm/Object/IRObjectFile.h
@@ -53,6 +53,8 @@
   }
   std::unique_ptr<Module> takeModule();
 
+  StringRef getTargetTriple() const;
+
   static inline bool classof(const Binary *v) {
     return v->isIR();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27074.79166.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161124/37099420/attachment.bin>


More information about the llvm-commits mailing list