aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp6
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;