[llvm-branch-commits] [llvm] 025d4fa - [llvm-link][NFC] Minor cleanup

Sergey Dmitriev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 9 23:22:34 PST 2020


Author: Sergey Dmitriev
Date: 2020-12-09T23:16:13-08:00
New Revision: 025d4faadb680925ccf5fdc957a36edd2fbb07ce

URL: https://github.com/llvm/llvm-project/commit/025d4faadb680925ccf5fdc957a36edd2fbb07ce
DIFF: https://github.com/llvm/llvm-project/commit/025d4faadb680925ccf5fdc957a36edd2fbb07ce.diff

LOG: [llvm-link][NFC] Minor cleanup

llvm::Linker::linkModules() is a static member, so there is no need
to pass reference to llvm::Linker instance to loadArFile() function.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D92918

Added: 
    

Modified: 
    llvm/tools/llvm-link/llvm-link.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 0f851a3e7c38..6996c5bfbe76 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -142,11 +142,9 @@ static std::unique_ptr<Module> loadFile(const char *argv0,
   return Result;
 }
 
-static std::unique_ptr<Module> loadArFile(const char *Argv0,
-                                          std::unique_ptr<MemoryBuffer> Buffer,
-                                          LLVMContext &Context, Linker &L,
-                                          unsigned OrigFlags,
-                                          unsigned ApplicableFlags) {
+static std::unique_ptr<Module>
+loadArFile(const char *Argv0, std::unique_ptr<MemoryBuffer> Buffer,
+           LLVMContext &Context, unsigned OrigFlags, unsigned ApplicableFlags) {
   std::unique_ptr<Module> Result(new Module("ArchiveModule", Context));
   StringRef ArchiveName = Buffer->getBufferIdentifier();
   if (Verbose)
@@ -163,7 +161,7 @@ static std::unique_ptr<Module> loadArFile(const char *Argv0,
           << " failed to read name of archive member"
           << ArchiveName << "'\n";
       return nullptr;
-    };
+    }
     std::string ChildName = Ename.get().str();
     if (Verbose)
       errs() << "Parsing member '" << ChildName
@@ -199,7 +197,7 @@ static std::unique_ptr<Module> loadArFile(const char *Argv0,
     }
     if (Verbose)
       errs() << "Linking member '" << ChildName << "' of archive library.\n";
-    if (L.linkModules(*Result, std::move(M), ApplicableFlags))
+    if (Linker::linkModules(*Result, std::move(M), ApplicableFlags))
       return nullptr;
     ApplicableFlags = OrigFlags;
   } // end for each child
@@ -356,7 +354,7 @@ static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L,
 
     std::unique_ptr<Module> M =
         identify_magic(Buffer->getBuffer()) == file_magic::archive
-            ? loadArFile(argv0, std::move(Buffer), Context, L, Flags,
+            ? loadArFile(argv0, std::move(Buffer), Context, Flags,
                          ApplicableFlags)
             : loadFile(argv0, std::move(Buffer), Context);
     if (!M.get()) {


        


More information about the llvm-branch-commits mailing list