diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2008-07-18 16:38:05 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2008-07-18 16:38:05 +0000 |
| commit | 155ed24359c55820878919a8160ca048287da1b2 (patch) | |
| tree | b688fee42275b204f366f678a981ff4d4391889c /clang/Driver/clang.cpp | |
| parent | d785465167b82bd25f4ba2e110425acd9dbd7c06 (diff) | |
| download | bcm5719-llvm-155ed24359c55820878919a8160ca048287da1b2.tar.gz bcm5719-llvm-155ed24359c55820878919a8160ca048287da1b2.zip | |
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
Diffstat (limited to 'clang/Driver/clang.cpp')
| -rw-r--r-- | clang/Driver/clang.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp index 5e8f51cbc97..cf3f9793d91 100644 --- a/clang/Driver/clang.cpp +++ b/clang/Driver/clang.cpp @@ -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; |

