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 | 2383b7f6aea2cb2bf2b5bfc0ec730f9354fecbbf (patch) | |
tree | 13bdae5f244e4365dc659a6d5c94e84e910b626f /lib/Basic | |
parent | c5c8d7d57dbfb2ecb7c7db51711e3b198e379d6a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 533a6a76ec..2076b16db0 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/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()); } } |