diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-11-18 04:56:44 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-11-18 04:56:44 +0000 |
| commit | 16ba91396a16f4f0e66ac1db37423a78f7dd3221 (patch) | |
| tree | c480c7ef5b2a274e4bbb717f7d915afbe69e13ab /clang/lib/Basic | |
| parent | 95d3d1094f03b6183bd9eacb36e2b1525a195644 (diff) | |
| download | bcm5719-llvm-16ba91396a16f4f0e66ac1db37423a78f7dd3221.tar.gz bcm5719-llvm-16ba91396a16f4f0e66ac1db37423a78f7dd3221.zip | |
Change the diagnostics interface to take an array of pointers to
strings instead of array of strings. This reduces string copying
in some not-very-important cases, but paves the way for future
improvements.
llvm-svn: 59494
Diffstat (limited to 'clang/lib/Basic')
| -rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index 533a6a76ecd..2076b16db08 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -214,7 +214,7 @@ Diagnostic::Level Diagnostic::getDiagnosticLevel(unsigned DiagID) const { /// DiagID is a member of the diag::kind enum. void Diagnostic::Report(DiagnosticClient* C, FullSourceLoc Loc, unsigned DiagID, - const std::string *Strs, unsigned NumStrs, + const std::string **Strs, unsigned NumStrs, const SourceRange *Ranges, unsigned NumRanges) { // Figure out the diagnostic level of this message. @@ -260,7 +260,7 @@ DiagnosticClient::~DiagnosticClient() {} std::string DiagnosticClient::FormatDiagnostic(Diagnostic &Diags, Diagnostic::Level Level, diag::kind ID, - const std::string *Strs, + const std::string **Strs, unsigned NumStrs) { std::string Msg = Diags.getDescription(ID); @@ -269,7 +269,7 @@ std::string DiagnosticClient::FormatDiagnostic(Diagnostic &Diags, if (Msg[i] == '%' && isdigit(Msg[i + 1])) { unsigned StrNo = Msg[i + 1] - '0'; Msg = std::string(Msg.begin(), Msg.begin() + i) + - (StrNo < NumStrs ? Strs[StrNo] : "<<<INTERNAL ERROR>>>") + + (StrNo < NumStrs ? *Strs[StrNo] : "<<<INTERNAL ERROR>>>") + std::string(Msg.begin() + i + 2, Msg.end()); } } |

