mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[LLD] Remove global state in lld/COFF
This patch removes globals from the lldCOFF library, by moving globals into a context class (COFFLinkingContext) and passing it around wherever it's needed. See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for context about removing globals from LLD. I also haven't moved the `driver` or `config` variables yet. Differential Revision: https://reviews.llvm.org/D109634
This commit is contained in:
@@ -156,7 +156,7 @@ void BitcodeCompiler::add(BitcodeFile &f) {
|
||||
|
||||
// Merge all the bitcode files we have seen, codegen the result
|
||||
// and return the resulting objects.
|
||||
std::vector<InputFile *> BitcodeCompiler::compile() {
|
||||
std::vector<InputFile *> BitcodeCompiler::compile(COFFLinkerContext &ctx) {
|
||||
unsigned maxTasks = ltoObj->getMaxTasks();
|
||||
buf.resize(maxTasks);
|
||||
files.resize(maxTasks);
|
||||
@@ -224,7 +224,7 @@ std::vector<InputFile *> BitcodeCompiler::compile() {
|
||||
|
||||
if (config->saveTemps)
|
||||
saveBuffer(buf[i], ltoObjName);
|
||||
ret.push_back(make<ObjFile>(MemoryBufferRef(objBuf, ltoObjName)));
|
||||
ret.push_back(make<ObjFile>(ctx, MemoryBufferRef(objBuf, ltoObjName)));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user