[cfe-commits] r59554 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/LiteralSupport.cpp lib/Lex/PPDirectives.cpp lib/Lex/PPExpressions.cpp lib/Lex/Preprocessor.cpp lib/Lex/PreprocessorLexer.cpp lib/Lex/TokenLexer.cpp lib/Parse/ParsePragma.cpp
Chris Lattner
sabre at nondot.org
Tue Nov 18 13:48:13 PST 2008
Author: lattner
Date: Tue Nov 18 15:48:13 2008
New Revision: 59554
URL: http://llvm.org/viewvc/llvm-project?rev=59554&view=rev
Log:
Remove the last of the old-style Preprocessor::Diag methods.
Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/PPExpressions.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/Lex/PreprocessorLexer.cpp
cfe/trunk/lib/Lex/TokenLexer.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Nov 18 15:48:13 2008
@@ -399,12 +399,6 @@
/// position in the current buffer into a SourcePosition object for rendering.
DiagnosticInfo Diag(SourceLocation Loc, unsigned DiagID);
DiagnosticInfo Diag(const Token &Tok, unsigned DiagID);
- void Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg);
- void Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
- const SourceRange &R1, const SourceRange &R2);
- void Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R);
- void Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R1,
- const SourceRange &R2);
/// getSpelling() - Return the 'spelling' of the Tok token. The spelling of a
/// token is the characters used to represent the token in the source file
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Nov 18 15:48:13 2008
@@ -53,7 +53,7 @@
ResultChar = 8;
break;
case 'e':
- PP.Diag(Loc, diag::ext_nonstandard_escape, "e");
+ PP.Diag(Loc, diag::ext_nonstandard_escape) << "e";
ResultChar = 27;
break;
case 'f':
@@ -135,16 +135,16 @@
case '(': case '{': case '[': case '%':
// GCC accepts these as extensions. We warn about them as such though.
if (!PP.getLangOptions().NoExtensions) {
- PP.Diag(Loc, diag::ext_nonstandard_escape,
- std::string()+(char)ResultChar);
+ PP.Diag(Loc, diag::ext_nonstandard_escape)
+ << std::string()+(char)ResultChar;
break;
}
// FALL THROUGH.
default:
if (isgraph(ThisTokBuf[0])) {
- PP.Diag(Loc, diag::ext_unknown_escape, std::string()+(char)ResultChar);
+ PP.Diag(Loc, diag::ext_unknown_escape) << std::string()+(char)ResultChar;
} else {
- PP.Diag(Loc, diag::ext_unknown_escape, "x"+llvm::utohexstr(ResultChar));
+ PP.Diag(Loc, diag::ext_unknown_escape) << "x"+llvm::utohexstr(ResultChar);
}
break;
}
@@ -531,8 +531,8 @@
}
void NumericLiteralParser::Diag(SourceLocation Loc, unsigned DiagID,
- const std::string &M) {
- PP.Diag(Loc, DiagID, M);
+ const std::string &M) {
+ PP.Diag(Loc, DiagID) << M;
hadError = true;
}
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Nov 18 15:48:13 2008
@@ -970,8 +970,8 @@
// Macros must be identical. This means all tokes and whitespace separation
// must be the same. C99 6.10.3.2.
if (!MI->isIdenticalTo(*OtherMI, *this)) {
- Diag(MI->getDefinitionLoc(), diag::ext_pp_macro_redef,
- MacroNameTok.getIdentifierInfo()->getName());
+ Diag(MI->getDefinitionLoc(), diag::ext_pp_macro_redef)
+ << MacroNameTok.getIdentifierInfo()->getName();
Diag(OtherMI->getDefinitionLoc(), diag::ext_pp_macro_redef2);
}
delete OtherMI;
Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Tue Nov 18 15:48:13 2008
@@ -137,7 +137,7 @@
if (LParenLoc.isValid()) {
if (PeekTok.isNot(tok::r_paren)) {
PP.Diag(PeekTok.getLocation(), diag::err_pp_missing_rparen);
- PP.Diag(LParenLoc, diag::err_matching, "(");
+ PP.Diag(LParenLoc, diag::err_matching) << "(";
return true;
}
// Consume the ).
@@ -259,9 +259,9 @@
return true;
if (PeekTok.isNot(tok::r_paren)) {
- PP.Diag(PeekTok.getLocation(), diag::err_pp_expected_rparen,
- Result.getRange());
- PP.Diag(Start, diag::err_matching, "(");
+ PP.Diag(PeekTok.getLocation(), diag::err_pp_expected_rparen)
+ << Result.getRange();
+ PP.Diag(Start, diag::err_matching) << "(";
return true;
}
DT.State = DefinedTracker::Unknown;
@@ -292,7 +292,7 @@
// If this operator is live and overflowed, report the issue.
if (Overflow && ValueLive)
- PP.Diag(Loc, diag::warn_pp_expr_overflow, Result.getRange());
+ PP.Diag(Loc, diag::warn_pp_expr_overflow) << Result.getRange();
DT.State = DefinedTracker::Unknown;
return false;
@@ -379,8 +379,8 @@
unsigned PeekPrec = getPrecedence(PeekTok.getKind());
// If this token isn't valid, report the error.
if (PeekPrec == ~0U) {
- PP.Diag(PeekTok.getLocation(), diag::err_pp_expr_bad_token_binop,
- LHS.getRange());
+ PP.Diag(PeekTok.getLocation(), diag::err_pp_expr_bad_token_binop)
+ << LHS.getRange();
return true;
}
@@ -423,8 +423,8 @@
// If this token isn't valid, report the error.
if (PeekPrec == ~0U) {
- PP.Diag(PeekTok.getLocation(), diag::err_pp_expr_bad_token_binop,
- RHS.getRange());
+ PP.Diag(PeekTok.getLocation(), diag::err_pp_expr_bad_token_binop)
+ << RHS.getRange();
return true;
}
@@ -469,15 +469,15 @@
// value was negative, warn about it.
if (ValueLive && Res.isUnsigned()) {
if (!LHS.isUnsigned() && LHS.Val.isNegative())
- PP.Diag(OpLoc, diag::warn_pp_convert_lhs_to_positive,
- LHS.Val.toString(10, true) + " to " +
- LHS.Val.toString(10, false),
- LHS.getRange(), RHS.getRange());
+ PP.Diag(OpLoc, diag::warn_pp_convert_lhs_to_positive)
+ << LHS.Val.toString(10, true) + " to " +
+ LHS.Val.toString(10, false)
+ << LHS.getRange() << RHS.getRange();
if (!RHS.isUnsigned() && RHS.Val.isNegative())
- PP.Diag(OpLoc, diag::warn_pp_convert_rhs_to_positive,
- RHS.Val.toString(10, true) + " to " +
- RHS.Val.toString(10, false),
- LHS.getRange(), RHS.getRange());
+ PP.Diag(OpLoc, diag::warn_pp_convert_rhs_to_positive)
+ << RHS.Val.toString(10, true) + " to " +
+ RHS.Val.toString(10, false)
+ << LHS.getRange() << RHS.getRange();
}
LHS.Val.setIsUnsigned(Res.isUnsigned());
RHS.Val.setIsUnsigned(Res.isUnsigned());
@@ -491,8 +491,8 @@
if (RHS.Val != 0)
Res = LHS.Val % RHS.Val;
else if (ValueLive) {
- PP.Diag(OpLoc, diag::err_pp_remainder_by_zero, LHS.getRange(),
- RHS.getRange());
+ PP.Diag(OpLoc, diag::err_pp_remainder_by_zero)
+ << LHS.getRange() << RHS.getRange();
return true;
}
break;
@@ -502,8 +502,8 @@
if (LHS.Val.isSigned()) // MININT/-1 --> overflow.
Overflow = LHS.Val.isMinSignedValue() && RHS.Val.isAllOnesValue();
} else if (ValueLive) {
- PP.Diag(OpLoc, diag::err_pp_division_by_zero, LHS.getRange(),
- RHS.getRange());
+ PP.Diag(OpLoc, diag::err_pp_division_by_zero)
+ << LHS.getRange() << RHS.getRange();
return true;
}
break;
@@ -597,15 +597,16 @@
// Comma is invalid in pp expressions in c89/c++ mode, but is valid in C99
// if not being evaluated.
if (!PP.getLangOptions().C99 || ValueLive)
- PP.Diag(OpLoc, diag::ext_pp_comma_expr, LHS.getRange(), RHS.getRange());
+ PP.Diag(OpLoc, diag::ext_pp_comma_expr)
+ << LHS.getRange() << RHS.getRange();
Res = RHS.Val; // LHS = LHS,RHS -> RHS.
break;
case tok::question: {
// Parse the : part of the expression.
if (PeekTok.isNot(tok::colon)) {
- PP.Diag(PeekTok.getLocation(), diag::err_expected_colon,
- LHS.getRange(), RHS.getRange());
- PP.Diag(OpLoc, diag::err_matching, "?");
+ PP.Diag(PeekTok.getLocation(), diag::err_expected_colon)
+ << LHS.getRange(), RHS.getRange();
+ PP.Diag(OpLoc, diag::err_matching) << "?";
return true;
}
// Consume the :.
@@ -638,15 +639,15 @@
}
case tok::colon:
// Don't allow :'s to float around without being part of ?: exprs.
- PP.Diag(OpLoc, diag::err_pp_colon_without_question, LHS.getRange(),
- RHS.getRange());
+ PP.Diag(OpLoc, diag::err_pp_colon_without_question)
+ << LHS.getRange() << RHS.getRange();
return true;
}
// If this operator is live and overflowed, report the issue.
if (Overflow && ValueLive)
- PP.Diag(OpLoc, diag::warn_pp_expr_overflow,
- LHS.getRange(), RHS.getRange());
+ PP.Diag(OpLoc, diag::warn_pp_expr_overflow)
+ << LHS.getRange() << RHS.getRange();
// Put the result back into 'LHS' for our next iteration.
LHS.Val = Res;
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Tue Nov 18 15:48:13 2008
@@ -126,30 +126,6 @@
return Diags.Report(getFullLoc(Tok.getLocation()), DiagID);
}
-
-void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
- const std::string &Msg) {
- Diags.Report(getFullLoc(Loc), DiagID) << Msg;
-}
-
-void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
- const std::string &Msg,
- const SourceRange &R1, const SourceRange &R2) {
- Diags.Report(getFullLoc(Loc), DiagID) << Msg << R1 << R2;
-}
-
-
-void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
- const SourceRange &R) {
- Diags.Report(getFullLoc(Loc), DiagID) << R;
-}
-
-void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
- const SourceRange &R1, const SourceRange &R2) {
- Diags.Report(getFullLoc(Loc), DiagID) << R1 << R2;
-}
-
-
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
llvm::cerr << tok::getTokenName(Tok.getKind()) << " '"
<< getSpelling(Tok) << "'";
Modified: cfe/trunk/lib/Lex/PreprocessorLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PreprocessorLexer.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PreprocessorLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PreprocessorLexer.cpp Tue Nov 18 15:48:13 2008
@@ -24,7 +24,7 @@
const std::string &Msg) const {
if (LexingRawMode && Diagnostic::isBuiltinNoteWarningOrExtension(DiagID))
return;
- PP->Diag(Loc, DiagID, Msg);
+ PP->Diag(Loc, DiagID) << Msg;
}
/// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Tue Nov 18 15:48:13 2008
@@ -423,8 +423,8 @@
return true;
} else {
// TODO: If not in assembler language mode.
- PP.Diag(PasteOpLoc, diag::err_pp_bad_paste,
- std::string(Buffer.begin(), Buffer.end()-1));
+ PP.Diag(PasteOpLoc, diag::err_pp_bad_paste)
+ << std::string(Buffer.begin(), Buffer.end()-1);
return false;
}
}
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=59554&r1=59553&r2=59554&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Tue Nov 18 15:48:13 2008
@@ -76,8 +76,8 @@
PP.Lex(Tok);
if (Tok.isNot(tok::numeric_constant)) {
- PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed,
- II->getName());
+ PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed)
+ << II->getName();
return;
}
@@ -88,8 +88,8 @@
PP.Lex(Tok);
}
} else {
- PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed,
- II->getName());
+ PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed)
+ << II->getName();
return;
}
}
More information about the cfe-commits
mailing list