[cfe-commits] r90125 - in /cfe/trunk: include/clang/Frontend/TextDiagnosticBuffer.h lib/Frontend/TextDiagnosticBuffer.cpp
Daniel Dunbar
daniel at zuster.org
Mon Nov 30 00:41:35 PST 2009
Author: ddunbar
Date: Mon Nov 30 02:41:34 2009
New Revision: 90125
URL: http://llvm.org/viewvc/llvm-project?rev=90125&view=rev
Log:
Add TextDiagnosticBuffer::FlushDiagnostics, for forwarding the buffered diagnostics to a different diagnostics engine.
Modified:
cfe/trunk/include/clang/Frontend/TextDiagnosticBuffer.h
cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp
Modified: cfe/trunk/include/clang/Frontend/TextDiagnosticBuffer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnosticBuffer.h?rev=90125&r1=90124&r2=90125&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnosticBuffer.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnosticBuffer.h Mon Nov 30 02:41:34 2009
@@ -41,6 +41,10 @@
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
Modified: cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp?rev=90125&r1=90124&r2=90125&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticBuffer.cpp Mon Nov 30 02:41:34 2009
@@ -36,3 +36,13 @@
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()));
+}
More information about the cfe-commits
mailing list