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

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 17:23:04 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287846: Object: Add IRObjectFile::getTargetTriple(). (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D27074?vs=79166&id=79177#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27074

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


Index: llvm/trunk/lib/Object/IRObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp
+++ llvm/trunk/lib/Object/IRObjectFile.cpp
@@ -213,6 +213,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/trunk/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp
@@ -265,14 +265,8 @@
 }
 
 static char isSymbolList64Bit(SymbolicFile &Obj) {
-  if (isa<IRObjectFile>(Obj)) {
-    IRObjectFile *IRobj = dyn_cast<IRObjectFile>(&Obj);
-    Module &M = IRobj->getModule();
-    if (M.getTargetTriple().empty())
-      return false;
-    Triple T(M.getTargetTriple());
-    return T.isArch64Bit();
-  }
+  if (auto *IRObj = dyn_cast<IRObjectFile>(&Obj))
+    return Triple(IRObj->getTargetTriple()).isArch64Bit();
   if (isa<COFFObjectFile>(Obj))
     return false;
   if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj))
Index: llvm/trunk/include/llvm/Object/IRObjectFile.h
===================================================================
--- llvm/trunk/include/llvm/Object/IRObjectFile.h
+++ llvm/trunk/include/llvm/Object/IRObjectFile.h
@@ -60,6 +60,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.79177.patch
Type: text/x-patch
Size: 1692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161124/5a49ac09/attachment.bin>


More information about the llvm-commits mailing list