[clang-tools-extra] r198423 - Clear the diagnostic buffer after flushing it.
Alexander Kornienko
alexfh at google.com
Fri Jan 3 07:34:40 PST 2014
Author: alexfh
Date: Fri Jan 3 09:34:40 2014
New Revision: 198423
URL: http://llvm.org/viewvc/llvm-project?rev=198423&view=rev
Log:
Clear the diagnostic buffer after flushing it.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2504
Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h?rev=198423&r1=198422&r2=198423&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h Fri Jan 3 09:34:40 2014
@@ -115,19 +115,23 @@ public:
// more generic and should be pulled out into a more useful Diagnostics
// library.
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
- const Diagnostic &Info) {
+ const Diagnostic &Info) LLVM_OVERRIDE {
if (DiagLevel != DiagnosticsEngine::Note) {
Errors.push_back(ClangTidyError(getMessage(Info)));
} else {
+ assert(!Errors.empty() &&
+ "A diagnostic note can only be appended to a message.");
Errors.back().Notes.push_back(getMessage(Info));
}
addFixes(Info, Errors.back());
}
- virtual void finish() {
+ // Flushes the internal diagnostics buffer to the ClangTidyContext.
+ virtual void finish() LLVM_OVERRIDE {
for (unsigned i = 0, e = Errors.size(); i != e; ++i) {
Context.storeError(Errors[i]);
}
+ Errors.clear();
}
private:
More information about the cfe-commits
mailing list