aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnosticBuffer.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-12-01 11:08:04 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-12-01 11:08:04 +0000
commit1569ce68681d909594d64f9b056d71f5dd7563bf (patch)
tree867cbbe32a66fd7d62dd9ce9df23a23fefdb8290 /lib/Frontend/TextDiagnosticBuffer.cpp
parentf5bd02d290ff15268853e0456c130a1afa15e907 (diff)
downloadsrc-1569ce68681d909594d64f9b056d71f5dd7563bf.tar.gz
src-1569ce68681d909594d64f9b056d71f5dd7563bf.zip
Update clang to r90226.
Notes
Notes: svn path=/vendor/clang/dist/; revision=199990
Diffstat (limited to 'lib/Frontend/TextDiagnosticBuffer.cpp')
-rw-r--r--lib/Frontend/TextDiagnosticBuffer.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Frontend/TextDiagnosticBuffer.cpp b/lib/Frontend/TextDiagnosticBuffer.cpp
index 34bc3c796aa8..fdf2ec8ccf5d 100644
--- a/lib/Frontend/TextDiagnosticBuffer.cpp
+++ b/lib/Frontend/TextDiagnosticBuffer.cpp
@@ -20,20 +20,29 @@ using namespace clang;
///
void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level,
const DiagnosticInfo &Info) {
- llvm::SmallString<100> StrC;
- Info.FormatDiagnostic(StrC);
- std::string Str(StrC.begin(), StrC.end());
+ llvm::SmallString<100> Buf;
+ Info.FormatDiagnostic(Buf);
switch (Level) {
default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
case Diagnostic::Note:
- Notes.push_back(std::make_pair(Info.getLocation(), Str));
+ Notes.push_back(std::make_pair(Info.getLocation(), Buf.str()));
break;
case Diagnostic::Warning:
- Warnings.push_back(std::make_pair(Info.getLocation(), Str));
+ Warnings.push_back(std::make_pair(Info.getLocation(), Buf.str()));
break;
case Diagnostic::Error:
case Diagnostic::Fatal:
- Errors.push_back(std::make_pair(Info.getLocation(), Str));
+ Errors.push_back(std::make_pair(Info.getLocation(), Buf.str()));
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()));
+}