diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Frontend/TextDiagnosticBuffer.h | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/TextDiagnosticBuffer.cpp | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/include/clang/Frontend/TextDiagnosticBuffer.h b/clang/include/clang/Frontend/TextDiagnosticBuffer.h index 4e907e1965e..380a1dd224a 100644 --- a/clang/include/clang/Frontend/TextDiagnosticBuffer.h +++ b/clang/include/clang/Frontend/TextDiagnosticBuffer.h @@ -41,6 +41,10 @@ public: virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, const DiagnosticInfo &Info); + + /// FlushDiagnostics - Flush the buffered diagnostics to an given + /// diagnostic engine. + void FlushDiagnostics(Diagnostic &Diags) const; }; } // end namspace clang diff --git a/clang/lib/Frontend/TextDiagnosticBuffer.cpp b/clang/lib/Frontend/TextDiagnosticBuffer.cpp index 07a281e3c7f..fdf2ec8ccf5 100644 --- a/clang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/clang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -36,3 +36,13 @@ void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level, break; } } + +void TextDiagnosticBuffer::FlushDiagnostics(Diagnostic &Diags) const { + // FIXME: Flush the diagnostics in order. + for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it) + Diags.Report(Diags.getCustomDiagID(Diagnostic::Error, it->second.c_str())); + for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it) + Diags.Report(Diags.getCustomDiagID(Diagnostic::Warning,it->second.c_str())); + for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it) + Diags.Report(Diags.getCustomDiagID(Diagnostic::Note, it->second.c_str())); +} |