forked from OSchip/llvm-project
Prevent clang from emitting output when input has errors
+ test case <rdar://problem/6080040> http://llvm.org/bugs/show_bug.cgi?id=2280 llvm-svn: 53756
This commit is contained in:
parent
d785465167
commit
155ed24359
|
@ -1285,6 +1285,12 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue