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 | c8aeb655c3f30a845c981f30f32260dc357e2900 (patch) | |
tree | 5d948a0269f7aabc83b4c4f9f7f0b4943fc1a11a /Driver/clang.cpp | |
parent | 7386d772171b0c3e2a70823dd0240d852d0850d6 (diff) |
Prevent clang from emitting output when input has errors
+ test case
<rdar://problem/6080040>
http://llvm.org/bugs/show_bug.cgi?id=2280
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r-- | Driver/clang.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 5e8f51cbc9..cf3f9793d9 100644 --- a/Driver/clang.cpp +++ b/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; |