1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[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
This commit is contained in:
Sergey Dmitriev 2020-12-09 22:51:58 -08:00
parent 4bf07b5b90
commit 9302af918f

View File

@ -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()) {