Merge remote-tracking branch 'origin/master' into master-next

This commit is contained in:
swift-ci
2017-06-30 16:08:53 -07:00
2 changed files with 29 additions and 15 deletions

View File

@@ -1338,6 +1338,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,
@@ -1402,6 +1423,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));
@@ -1409,23 +1431,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;
}