Revert "Bail on compilation as soon as a job fails."

This reverts commit r260448.

It was causing Driver/output-file-cleanup.c to fail.

llvm-svn: 260522
This commit is contained in:
Rafael Espindola 2016-02-11 14:13:17 +00:00
parent a1fa68ac9c
commit 932b31982a
1 changed files with 30 additions and 8 deletions

View File

@ -163,17 +163,39 @@ int Compilation::ExecuteCommand(const Command &C,
return ExecutionFailed ? 1 : Res;
}
void Compilation::ExecuteJobs(
const JobList &Jobs,
SmallVectorImpl<std::pair<int, const Command *>> &FailingCommands) const {
typedef SmallVectorImpl< std::pair<int, const Command *> > FailingCommandList;
static bool ActionFailed(const Action *A,
const FailingCommandList &FailingCommands) {
if (FailingCommands.empty())
return false;
for (FailingCommandList::const_iterator CI = FailingCommands.begin(),
CE = FailingCommands.end(); CI != CE; ++CI)
if (A == &(CI->second->getSource()))
return true;
for (Action::const_iterator AI = A->begin(), AE = A->end(); AI != AE; ++AI)
if (ActionFailed(*AI, FailingCommands))
return true;
return false;
}
static bool InputsOk(const Command &C,
const FailingCommandList &FailingCommands) {
return !ActionFailed(&C.getSource(), FailingCommands);
}
void Compilation::ExecuteJobs(const JobList &Jobs,
FailingCommandList &FailingCommands) const {
for (const auto &Job : Jobs) {
if (!InputsOk(Job, FailingCommands))
continue;
const Command *FailingCommand = nullptr;
if (int Res = ExecuteCommand(Job, FailingCommand)) {
if (int Res = ExecuteCommand(Job, FailingCommand))
FailingCommands.push_back(std::make_pair(Res, FailingCommand));
// Bail as soon as one command fails, so we don't output duplicate error
// messages if we die on e.g. the same file.
return;
}
}
}