[PATCH] Clear the diagnostic buffer after flushing it.
Alexander Kornienko
alexfh at google.com
Fri Jan 3 07:32:06 PST 2014
Hi klimek,
http://llvm-reviews.chandlerc.com/D2504
Files:
clang-tidy/ClangTidyDiagnosticConsumer.h
Index: clang-tidy/ClangTidyDiagnosticConsumer.h
===================================================================
--- clang-tidy/ClangTidyDiagnosticConsumer.h
+++ clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -115,19 +115,23 @@
// 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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2504.1.patch
Type: text/x-patch
Size: 1133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140103/ff6e1410/attachment.bin>
More information about the cfe-commits
mailing list