diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Analysis/PathDiagnostic.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 6 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Driver/TextDiagnosticBuffer.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Driver/TextDiagnosticPrinter.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Parse/DeclSpec.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 19 |
9 files changed, 32 insertions, 23 deletions
diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp index 971e751b8dc..02cfe1e341b 100644 --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/lib/Analysis/PathDiagnostic.cpp @@ -24,7 +24,7 @@ void PathDiagnosticClient::HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel, FullSourceLoc Pos, diag::kind ID, - const std::string *Strs, + const std::string **Strs, unsigned NumStrs, const SourceRange *Ranges, unsigned NumRanges) { 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()); } } diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index a101e389b28..d7d732997b6 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -108,8 +108,9 @@ void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type, "cannot codegen this %0 yet"); SourceRange Range = S->getSourceRange(); std::string Msg = Type; + const std::string *Strs[] = { &Msg }; getDiags().Report(Context.getFullLoc(S->getLocStart()), DiagID, - &Msg, 1, &Range, 1); + Strs, 1, &Range, 1); } /// ErrorUnsupported - Print out an error that codegen doesn't support the @@ -121,8 +122,8 @@ void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type, unsigned DiagID = getDiags().getCustomDiagID(Diagnostic::Error, "cannot codegen this %0 yet"); std::string Msg = Type; - getDiags().Report(Context.getFullLoc(D->getLocation()), DiagID, - &Msg, 1); + const std::string *Strs[] = { &Msg }; + getDiags().Report(Context.getFullLoc(D->getLocation()), DiagID, Strs, 1); } /// setGlobalVisibility - Set the visibility for the given LLVM diff --git a/clang/lib/Driver/TextDiagnosticBuffer.cpp b/clang/lib/Driver/TextDiagnosticBuffer.cpp index 26ac879dd04..ef7ac6d408c 100644 --- a/clang/lib/Driver/TextDiagnosticBuffer.cpp +++ b/clang/lib/Driver/TextDiagnosticBuffer.cpp @@ -21,7 +21,7 @@ void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level Level, FullSourceLoc Pos, diag::kind ID, - const std::string *Strs, + const std::string **Strs, unsigned NumStrs, const SourceRange *, unsigned) { diff --git a/clang/lib/Driver/TextDiagnosticPrinter.cpp b/clang/lib/Driver/TextDiagnosticPrinter.cpp index e0faf478d1a..e03588b9899 100644 --- a/clang/lib/Driver/TextDiagnosticPrinter.cpp +++ b/clang/lib/Driver/TextDiagnosticPrinter.cpp @@ -96,7 +96,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level Level, FullSourceLoc Pos, diag::kind ID, - const std::string *Strs, + const std::string **Strs, unsigned NumStrs, const SourceRange *Ranges, unsigned NumRanges) { diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index c65b5462098..dc4dd877b67 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -124,14 +124,16 @@ void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID) { void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) { - Diags.Report(getFullLoc(Loc), DiagID, &Msg, 1); + const std::string *Strs[] = { &Msg }; + Diags.Report(getFullLoc(Loc), DiagID, Strs, 1); } void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg, const SourceRange &R1, const SourceRange &R2) { + const std::string *Strs[] = { &Msg }; SourceRange R[] = {R1, R2}; - Diags.Report(getFullLoc(Loc), DiagID, &Msg, 1, R, 2); + Diags.Report(getFullLoc(Loc), DiagID, Strs, 1, R, 2); } diff --git a/clang/lib/Parse/DeclSpec.cpp b/clang/lib/Parse/DeclSpec.cpp index e80076127d8..733c37cb4f9 100644 --- a/clang/lib/Parse/DeclSpec.cpp +++ b/clang/lib/Parse/DeclSpec.cpp @@ -311,6 +311,7 @@ void DeclSpec::Diag(Diagnostic &D, SourceLocation Loc, SourceManager& SrcMgr, } void DeclSpec::Diag(Diagnostic &D, SourceLocation Loc, SourceManager& SrcMgr, - unsigned DiagID, const std::string &info) { - D.Report(FullSourceLoc(Loc,SrcMgr), DiagID, &info, 1); + unsigned DiagID, const std::string &Info) { + const std::string *Strs[] = { &Info }; + D.Report(FullSourceLoc(Loc,SrcMgr), DiagID, Strs, 1); } diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 3b36ebec7b9..dfabc9b16a5 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -43,13 +43,15 @@ Action::~Action() {} bool Parser::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) { - Diags.Report(FullSourceLoc(Loc,PP.getSourceManager()), DiagID, &Msg, 1); + const std::string *Strs[] = { &Msg }; + Diags.Report(FullSourceLoc(Loc,PP.getSourceManager()), DiagID, Strs, 1); return true; } bool Parser::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg, const SourceRange& Range) { - Diags.Report(PP.getFullLoc(Loc), DiagID, &Msg, 1, &Range,1); + const std::string *Strs[] = { &Msg }; + Diags.Report(PP.getFullLoc(Loc), DiagID, Strs, 1, &Range,1); return true; } diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 64959495269..5ea27c979b1 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -176,13 +176,14 @@ bool Sema::Diag(SourceLocation Loc, unsigned DiagID) { } bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) { - PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, &Msg, 1); + const std::string *Strs[] = { &Msg }; + PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, Strs, 1); return true; } bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, const std::string &Msg2) { - std::string MsgArr[] = { Msg1, Msg2 }; + const std::string *MsgArr[] = { &Msg1, &Msg2 }; PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, MsgArr, 2); return true; } @@ -194,21 +195,22 @@ bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& Range) { bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg, const SourceRange& Range) { - PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, &Msg, 1, &Range,1); + const std::string *Strs[] = { &Msg }; + PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, Strs, 1, &Range,1); return true; } bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, const std::string &Msg2, const SourceRange& Range) { - std::string MsgArr[] = { Msg1, Msg2 }; + const std::string *MsgArr[] = { &Msg1, &Msg2 }; PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, MsgArr, 2, &Range, 1); return true; } bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, const std::string &Msg2, const std::string &Msg3, - const SourceRange& R1) { - std::string MsgArr[] = { Msg1, Msg2, Msg3 }; + const SourceRange &R1) { + const std::string *MsgArr[] = { &Msg1, &Msg2, &Msg3 }; PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, MsgArr, 3, &R1, 1); return true; } @@ -223,14 +225,15 @@ bool Sema::Diag(SourceLocation Loc, unsigned DiagID, bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg, const SourceRange& R1, const SourceRange& R2) { SourceRange RangeArr[] = { R1, R2 }; - PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, &Msg, 1, RangeArr, 2); + const std::string *Strs[] = { &Msg }; + PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, Strs, 1, RangeArr, 2); return true; } bool Sema::Diag(SourceLocation Range, unsigned DiagID, const std::string &Msg1, const std::string &Msg2, const SourceRange& R1, const SourceRange& R2) { - std::string MsgArr[] = { Msg1, Msg2 }; + const std::string *MsgArr[] = { &Msg1, &Msg2 }; SourceRange RangeArr[] = { R1, R2 }; PP.getDiagnostics().Report(PP.getFullLoc(Range),DiagID, MsgArr,2,RangeArr, 2); return true; |