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
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 533a6a7..2076b16 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -214,7 +214,7 @@
/// 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 @@
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 @@
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());
}
}