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 | 5b9268f26ac53a74d2c504279fe577d988d5615d (patch) | |
tree | 5e408834de6e2933211c24bba04b91aacca2a551 /lib/Driver/Driver.cpp | |
parent | 88d158c631c4c08831855f601990f36f2234f975 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index d41bce5ba5..dcb3c5fd09 100644 --- a/lib/Driver/Driver.cpp +++ b/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; |