diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-20 02:22:15 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-20 02:22:15 +0000 |
commit | 5bb4cdfaa92f6346982f7705f7f53df67116fc96 (patch) | |
tree | 10daff97f5d5058e73a146c509e027d5cacf592a /clang/lib/Driver/Driver.cpp | |
parent | 4419449391a16f39058f637658ebe10106bd1c67 (diff) | |
download | bcm5719-llvm-5bb4cdfaa92f6346982f7705f7f53df67116fc96.tar.gz bcm5719-llvm-5bb4cdfaa92f6346982f7705f7f53df67116fc96.zip |
Fix code that attempted to produce a diagnostic with one DiagnosticEngine, then
produce a note for that diagnostic either with a different DiagnosticEngine or
after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the
wrong thing if the original diagnostic was suppressed.
llvm-svn: 170636
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index d41bce5ba52..dcb3c5fd098 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -366,9 +366,12 @@ void Driver::generateCompilationDiagnostics(Compilation &C, C.PrintDiagnosticJob(OS, C.getJobs()); OS.flush(); - // Clear stale state and suppress tool output. + // Keep track of whether we produce any errors while trying to produce + // preprocessed sources. + DiagnosticErrorTrap Trap(Diags); + + // Suppress tool output. C.initCompilationForDiagnostics(); - Diags.Reset(); // Construct the list of inputs. InputList Inputs; @@ -430,7 +433,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C, BuildJobs(C); // If there were errors building the compilation, quit now. - if (Diags.hasErrorOccurred()) { + if (Trap.hasErrorOccurred()) { Diag(clang::diag::note_drv_command_failed_diag_msg) << "Error generating preprocessed source(s)."; return; |