mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #10733 from graydon/rdar-32984579-emit-bc-depends-on-bridging-pch-as-well
[Bridging PCH] Move dependency-on-bridging-PCH to -emit-bc JobAction itself
This commit is contained in:
@@ -1340,6 +1340,27 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
|
||||
OI.SelectedSanitizer);
|
||||
}
|
||||
|
||||
static void
|
||||
currentDependsOnPCHIfPresent(JobAction *PCH,
|
||||
std::unique_ptr<Action> &Current,
|
||||
ActionList &Actions) {
|
||||
if (PCH) {
|
||||
// FIXME: When we have a PCH job, it's officially owned by the Actions
|
||||
// array; but it's also a secondary input to each of the current
|
||||
// JobActions, which means that we need to flip the "owns inputs" bit
|
||||
// on the JobActions so they don't try to free it. That in turn means
|
||||
// we need to transfer ownership of all the JobActions' existing
|
||||
// inputs to the Actions array, since the JobActions either own or
|
||||
// don't own _all_ of their inputs. Ownership can't vary
|
||||
// input-by-input.
|
||||
auto *job = cast<JobAction>(Current.get());
|
||||
auto inputs = job->getInputs();
|
||||
Actions.append(inputs.begin(), inputs.end());
|
||||
job->setOwnsInputs(false);
|
||||
job->addInput(PCH);
|
||||
}
|
||||
}
|
||||
|
||||
void Driver::buildActions(const ToolChain &TC,
|
||||
const DerivedArgList &Args,
|
||||
const InputFileList &Inputs,
|
||||
@@ -1404,6 +1425,7 @@ void Driver::buildActions(const ToolChain &TC,
|
||||
Current.reset(new CompileJobAction(Current.release(),
|
||||
types::TY_LLVM_BC,
|
||||
previousBuildState));
|
||||
currentDependsOnPCHIfPresent(PCH, Current, Actions);
|
||||
AllModuleInputs.push_back(Current.get());
|
||||
Current.reset(new BackendJobAction(Current.release(),
|
||||
OI.CompilerOutputType, 0));
|
||||
@@ -1411,23 +1433,9 @@ void Driver::buildActions(const ToolChain &TC,
|
||||
Current.reset(new CompileJobAction(Current.release(),
|
||||
OI.CompilerOutputType,
|
||||
previousBuildState));
|
||||
currentDependsOnPCHIfPresent(PCH, Current, Actions);
|
||||
AllModuleInputs.push_back(Current.get());
|
||||
}
|
||||
if (PCH) {
|
||||
// FIXME: When we have a PCH job, it's officially owned by the Actions
|
||||
// array; but it's also a secondary input to each of the current
|
||||
// JobActions, which means that we need to flip the "owns inputs" bit
|
||||
// on the JobActions so they don't try to free it. That in turn means
|
||||
// we need to transfer ownership of all the JobActions' existing
|
||||
// inputs to the Actions array, since the JobActions either own or
|
||||
// don't own _all_ of their inputs. Ownership can't vary
|
||||
// input-by-input.
|
||||
auto *job = cast<JobAction>(Current.get());
|
||||
auto inputs = job->getInputs();
|
||||
Actions.append(inputs.begin(), inputs.end());
|
||||
job->setOwnsInputs(false);
|
||||
job->addInput(PCH);
|
||||
}
|
||||
AllLinkerInputs.push_back(Current.release());
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user