Skip to content
Snippets Groups Projects
Commit 4c4df452 authored by Chad Rosier's avatar Chad Rosier
Browse files

[driver] The failure of any phase (e.g., preprocess, compile, assemble) for a

single translation unit should prevent later phases from executing.  Otherwise,
this generates lots of noise in build systems.  This a fallout from r173825.
Patch by Matthew Curtis <mcurtis@codeaurora.org>.
rdar://13298009

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176198 91177308-0d34-0410-b5e6-96231b3b80d8
parent e9616a49
No related branches found
No related tags found
No related merge requests found
...@@ -307,9 +307,36 @@ int Compilation::ExecuteCommand(const Command &C, ...@@ -307,9 +307,36 @@ int Compilation::ExecuteCommand(const Command &C,
return Res; return Res;
} }
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::ExecuteJob(const Job &J, void Compilation::ExecuteJob(const Job &J,
SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands) const { FailingCommandList &FailingCommands) const {
if (const Command *C = dyn_cast<Command>(&J)) { if (const Command *C = dyn_cast<Command>(&J)) {
if (!InputsOk(*C, FailingCommands))
return;
const Command *FailingCommand = 0; const Command *FailingCommand = 0;
if (int Res = ExecuteCommand(*C, FailingCommand)) if (int Res = ExecuteCommand(*C, FailingCommand))
FailingCommands.push_back(std::make_pair(Res, FailingCommand)); FailingCommands.push_back(std::make_pair(Res, FailingCommand));
......
// RUN: %clang -no-integrated-as %s 2>&1 | FileCheck %s
// CHECK: error: unknown type name 'invalid'
// CHECK-NOT: clang: error: assembler command failed
// CHECK-NOT: clang: error: linker command failed
invalid C code!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment