[llvm] r267106 - Clean the API for CollectAsmUndefinedRefs, taking a Triple and a String InlineAsm instead of a Module (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 21:58:12 PDT 2016


Author: mehdi_amini
Date: Thu Apr 21 23:58:12 2016
New Revision: 267106

URL: http://llvm.org/viewvc/llvm-project?rev=267106&view=rev
Log:
Clean the API for CollectAsmUndefinedRefs, taking a Triple and a String InlineAsm instead of a Module (NFC)

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/include/llvm/Object/IRObjectFile.h
    llvm/trunk/lib/Object/IRObjectFile.cpp

Modified: llvm/trunk/include/llvm/Object/IRObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/IRObjectFile.h?rev=267106&r1=267105&r2=267106&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/IRObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/IRObjectFile.h Thu Apr 21 23:58:12 2016
@@ -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<void(StringRef, BasicSymbolRef::Flags)> &
           AsmUndefinedRefs);
 

Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=267106&r1=267105&r2=267106&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Thu Apr 21 23:58:12 2016
@@ -39,7 +39,8 @@ IRObjectFile::IRObjectFile(MemoryBufferR
     : 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<std::string, uint32_t>(Name, std::move(Flags)));
       });
@@ -48,15 +49,12 @@ IRObjectFile::IRObjectFile(MemoryBufferR
 // 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<void(StringRef, BasicSymbolRef::Flags)> &
         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)




More information about the llvm-commits mailing list