r176198 - [driver] The failure of any phase (e.g., preprocess, compile, assemble) for a
Chad Rosier
mcrosier at apple.com
Wed Feb 27 10:46:05 PST 2013
Author: mcrosier
Date: Wed Feb 27 12:46:04 2013
New Revision: 176198
URL: http://llvm.org/viewvc/llvm-project?rev=176198&view=rev
Log:
[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 at codeaurora.org>.
rdar://13298009
Added:
cfe/trunk/test/Driver/inhibit-downstream-commands.c
Modified:
cfe/trunk/lib/Driver/Compilation.cpp
Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=176198&r1=176197&r2=176198&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Wed Feb 27 12:46:04 2013
@@ -307,9 +307,36 @@ int Compilation::ExecuteCommand(const Co
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,
- SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands) const {
+ FailingCommandList &FailingCommands) const {
if (const Command *C = dyn_cast<Command>(&J)) {
+ if (!InputsOk(*C, FailingCommands))
+ return;
const Command *FailingCommand = 0;
if (int Res = ExecuteCommand(*C, FailingCommand))
FailingCommands.push_back(std::make_pair(Res, FailingCommand));
Added: cfe/trunk/test/Driver/inhibit-downstream-commands.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/inhibit-downstream-commands.c?rev=176198&view=auto
==============================================================================
--- cfe/trunk/test/Driver/inhibit-downstream-commands.c (added)
+++ cfe/trunk/test/Driver/inhibit-downstream-commands.c Wed Feb 27 12:46:04 2013
@@ -0,0 +1,5 @@
+// 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!
More information about the cfe-commits
mailing list