From 86311313659273a747b2da37f8604f5788ebe717 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Fri, 22 Apr 2016 04:58:12 +0000 Subject: [PATCH] Clean the API for CollectAsmUndefinedRefs, taking a Triple and a String InlineAsm instead of a Module (NFC) From: Mehdi Amini llvm-svn: 267106 --- include/llvm/Object/IRObjectFile.h | 3 ++- lib/Object/IRObjectFile.cpp | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/llvm/Object/IRObjectFile.h b/include/llvm/Object/IRObjectFile.h index 453c0f542c2..0cf31d91582 100644 --- a/include/llvm/Object/IRObjectFile.h +++ b/include/llvm/Object/IRObjectFile.h @@ -20,6 +20,7 @@ namespace llvm { class Mangler; class Module; class GlobalValue; +class Triple; namespace object { class ObjectFile; @@ -65,7 +66,7 @@ public: /// For each found symbol, call \p AsmUndefinedRefs with the name of the /// symbol found and the associated flags. static void CollectAsmUndefinedRefs( - Module &TheModule, + const Triple &TheTriple, StringRef InlineAsm, const std::function & AsmUndefinedRefs); diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp index 0d35744f93d..76cb15630ae 100644 --- a/lib/Object/IRObjectFile.cpp +++ b/lib/Object/IRObjectFile.cpp @@ -39,7 +39,8 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr Mod) : SymbolicFile(Binary::ID_IR, Object), M(std::move(Mod)) { Mang.reset(new Mangler()); CollectAsmUndefinedRefs( - *M, [this](StringRef Name, BasicSymbolRef::Flags Flags) { + Triple(M->getTargetTriple()), M->getModuleInlineAsm(), + [this](StringRef Name, BasicSymbolRef::Flags Flags) { AsmSymbols.push_back( std::make_pair(Name, std::move(Flags))); }); @@ -48,15 +49,12 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr Mod) // Parse inline ASM and collect the list of symbols that are not defined in // the current module. This is inspired from IRObjectFile. void IRObjectFile::CollectAsmUndefinedRefs( - Module &TheModule, + const Triple &TT, StringRef InlineAsm, const std::function & AsmUndefinedRefs) { - - const std::string &InlineAsm = TheModule.getModuleInlineAsm(); if (InlineAsm.empty()) return; - Triple TT(TheModule.getTargetTriple()); std::string Err; const Target *T = TargetRegistry::lookupTarget(TT.str(), Err); if (!T)