[cfe-commits] r53756 - in /cfe/trunk: Driver/clang.cpp test/CodeGen/2008-07-17-no-emit-on-error.c
Daniel Dunbar
daniel at zuster.org
Fri Jul 18 09:38:05 PDT 2008
Author: ddunbar
Date: Fri Jul 18 11:38:05 2008
New Revision: 53756
URL: http://llvm.org/viewvc/llvm-project?rev=53756&view=rev
Log:
Prevent clang from emitting output when input has errors
+ test case
<rdar://problem/6080040>
http://llvm.org/bugs/show_bug.cgi?id=2280
Added:
cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c
Modified:
cfe/trunk/Driver/clang.cpp
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=53756&r1=53755&r2=53756&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Fri Jul 18 11:38:05 2008
@@ -1285,6 +1285,12 @@
ParseAST(PP, Consumer, Stats);
}
+ // Don't emit code when the input had errors.
+ if (CodeGenModule && PP.getDiagnostics().hasErrorOccurred()) {
+ delete CodeGenModule;
+ CodeGenModule = 0;
+ }
+
// If running the code generator, finish up now.
if (CodeGenModule) {
std::ostream *Out;
Added: cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c?rev=53756&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c (added)
+++ cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c Fri Jul 18 11:38:05 2008
@@ -0,0 +1,10 @@
+// RUN: rm -f %t1.bc
+// RUN: ! clang %s -emit-llvm-bc -o %t1.bc
+// RUN: ! test -f %t1.bc
+
+void f() {
+}
+
+void g() {
+ *10;
+}
More information about the cfe-commits
mailing list