diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-19 06:51:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-19 06:51:40 +0000 |
commit | f4c839657742b823cea1a95b18422f1ba74d3ddd (patch) | |
tree | 5750f35a2176c9969f07d1dbceb03e0e1028a3fc /lib/Analysis/PathDiagnostic.cpp | |
parent | 0293d540baafbe070c1035611787a81001a4118e (diff) |
rewrite FormatDiagnostic to be less gross and a lot more efficient.
This also makes it illegal to have bare '%'s in diagnostics. If you
want a % in a diagnostic, use %%.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59596 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PathDiagnostic.cpp')
-rw-r--r-- | lib/Analysis/PathDiagnostic.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Analysis/PathDiagnostic.cpp b/lib/Analysis/PathDiagnostic.cpp index aed83ea84f..29ea8c0e37 100644 --- a/lib/Analysis/PathDiagnostic.cpp +++ b/lib/Analysis/PathDiagnostic.cpp @@ -12,8 +12,8 @@ //===----------------------------------------------------------------------===// #include "clang/Analysis/PathDiagnostic.h" +#include "llvm/ADT/SmallString.h" #include <sstream> - using namespace clang; PathDiagnostic::~PathDiagnostic() { @@ -36,10 +36,13 @@ void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel, case Diagnostic::Fatal: LevelStr = "fatal error: "; break; } - std::string Msg = FormatDiagnostic(Info); + llvm::SmallString<100> StrC; + StrC += LevelStr; + Info.FormatDiagnostic(StrC); PathDiagnosticPiece *P = - new PathDiagnosticPiece(Info.getLocation(), LevelStr+Msg); + new PathDiagnosticPiece(Info.getLocation(), + std::string(StrC.begin(), StrC.end())); for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) P->addRange(Info.getRange(i)); |