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 takeModule(); + StringRef getTargetTriple() const; + static inline bool classof(const Binary *v) { return v->isIR(); } 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 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(Obj)) { - IRObjectFile *IRobj = dyn_cast(&Obj); - Module &M = IRobj->getModule(); - if (M.getTargetTriple().empty()) - return false; - Triple T(M.getTargetTriple()); - return T.isArch64Bit(); - } + if (auto *IRObj = dyn_cast(&Obj)) + return Triple(IRObj->getTargetTriple()).isArch64Bit(); if (isa(Obj)) return false; if (MachOObjectFile *MachO = dyn_cast(&Obj))