summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/TextDiagnosticBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver/TextDiagnosticBuffer.cpp')
-rw-r--r--clang/lib/Driver/TextDiagnosticBuffer.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Driver/TextDiagnosticBuffer.cpp b/clang/lib/Driver/TextDiagnosticBuffer.cpp
index b138b1a24d2..5032cdb0b5d 100644
--- a/clang/lib/Driver/TextDiagnosticBuffer.cpp
+++ b/clang/lib/Driver/TextDiagnosticBuffer.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Driver/TextDiagnosticBuffer.h"
+#include "llvm/ADT/SmallString.h"
using namespace clang;
/// HandleDiagnostic - Store the errors, warnings, and notes that are
@@ -19,19 +20,19 @@ 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());
switch (Level) {
default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
case Diagnostic::Note:
- Notes.push_back(std::make_pair(Info.getLocation().getLocation(),
- FormatDiagnostic(Info)));
+ Notes.push_back(std::make_pair(Info.getLocation().getLocation(), Str));
break;
case Diagnostic::Warning:
- Warnings.push_back(std::make_pair(Info.getLocation().getLocation(),
- FormatDiagnostic(Info)));
+ Warnings.push_back(std::make_pair(Info.getLocation().getLocation(), Str));
break;
case Diagnostic::Error:
- Errors.push_back(std::make_pair(Info.getLocation().getLocation(),
- FormatDiagnostic(Info)));
+ Errors.push_back(std::make_pair(Info.getLocation().getLocation(), Str));
break;
}
}
OpenPOWER on IntegriCloud