remove one more old-style Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59589 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index d4307c1..853ecaf 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1421,11 +1421,11 @@
// The following || allows only one side to be void (a GCC-ism).
if (lexT->isVoidType() || rexT->isVoidType()) {
if (!lexT->isVoidType())
- Diag(rex->getLocStart(), diag::ext_typecheck_cond_one_void,
- rex->getSourceRange());
+ Diag(rex->getLocStart(), diag::ext_typecheck_cond_one_void)
+ << rex->getSourceRange();
if (!rexT->isVoidType())
- Diag(lex->getLocStart(), diag::ext_typecheck_cond_one_void,
- lex->getSourceRange());
+ Diag(lex->getLocStart(), diag::ext_typecheck_cond_one_void)
+ << lex->getSourceRange();
ImpCastExprToType(lex, Context.VoidTy);
ImpCastExprToType(rex, Context.VoidTy);
return Context.VoidTy;
@@ -2387,9 +2387,9 @@
}
if (NeedType)
- S.Diag(Loc, Diag, E->getType().getAsString(), E->getSourceRange());
+ S.Diag(Loc, Diag) << E->getType().getAsString() << E->getSourceRange();
else
- S.Diag(Loc, Diag, E->getSourceRange());
+ S.Diag(Loc, Diag) << E->getSourceRange();
return true;
}
@@ -2464,21 +2464,21 @@
// C99 6.5.2.4p1: We allow complex as a GCC extension.
if (const PointerType *pt = resType->getAsPointerType()) {
if (pt->getPointeeType()->isVoidType()) {
- Diag(OpLoc, diag::ext_gnu_void_ptr, op->getSourceRange());
+ Diag(OpLoc, diag::ext_gnu_void_ptr) << op->getSourceRange();
} else if (!pt->getPointeeType()->isObjectType()) {
// C99 6.5.2.4p2, 6.5.6p2
- Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type,
- resType.getAsString(), op->getSourceRange());
+ Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type)
+ << resType.getAsString() << op->getSourceRange();
return QualType();
}
} else if (!resType->isRealType()) {
if (resType->isComplexType())
// C99 does not support ++/-- on complex types.
- Diag(OpLoc, diag::ext_integer_increment_complex,
- resType.getAsString(), op->getSourceRange());
+ Diag(OpLoc, diag::ext_integer_increment_complex)
+ << resType.getAsString() << op->getSourceRange();
else {
- Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement,
- resType.getAsString(), op->getSourceRange());
+ Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
+ << resType.getAsString() << op->getSourceRange();
return QualType();
}
}
@@ -2595,8 +2595,8 @@
if (lval != Expr::LV_Valid) { // C99 6.5.3.2p1
if (!dcl || !isa<FunctionDecl>(dcl)) {// allow function designators
// FIXME: emit more specific diag...
- Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof,
- op->getSourceRange());
+ Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof)
+ << op->getSourceRange();
return QualType();
}
} else if (MemberExpr *MemExpr = dyn_cast<MemberExpr>(op)) { // C99 6.5.3.2p1
@@ -3069,8 +3069,8 @@
// offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are a
// GCC extension, diagnose them.
if (NumComponents != 1)
- Diag(BuiltinLoc, diag::ext_offsetof_extended_field_designator,
- SourceRange(CompPtr[1].LocStart, CompPtr[NumComponents-1].LocEnd));
+ Diag(BuiltinLoc, diag::ext_offsetof_extended_field_designator)
+ << SourceRange(CompPtr[1].LocStart, CompPtr[NumComponents-1].LocEnd);
for (unsigned i = 0; i != NumComponents; ++i) {
const OffsetOfComponent &OC = CompPtr[i];
@@ -3088,8 +3088,8 @@
// C99 6.5.2.1p1
Expr *Idx = static_cast<Expr*>(OC.U.E);
if (!Idx->getType()->isIntegerType())
- return Diag(Idx->getLocStart(), diag::err_typecheck_subscript,
- Idx->getSourceRange());
+ return Diag(Idx->getLocStart(), diag::err_typecheck_subscript)
+ << Idx->getSourceRange();
Res = new ArraySubscriptExpr(Res, Idx, AT->getElementType(), OC.LocEnd);
continue;
@@ -3147,8 +3147,8 @@
llvm::APSInt condEval(32);
SourceLocation ExpLoc;
if (!CondExpr->isIntegerConstantExpr(condEval, Context, &ExpLoc))
- return Diag(ExpLoc, diag::err_typecheck_choose_expr_requires_constant,
- CondExpr->getSourceRange());
+ return Diag(ExpLoc, diag::err_typecheck_choose_expr_requires_constant)
+ << CondExpr->getSourceRange();
// If the condition is > zero, then the AST type is the same as the LSHExpr.
QualType resType = condEval.getZExtValue() ? LHSExpr->getType() :
@@ -3277,8 +3277,8 @@
SourceLocation RParenLoc) {
// __builtin_overload requires at least 2 arguments
if (NumArgs < 2)
- return Diag(RParenLoc, diag::err_typecheck_call_too_few_args,
- SourceRange(BuiltinLoc, RParenLoc));
+ return Diag(RParenLoc, diag::err_typecheck_call_too_few_args)
+ << SourceRange(BuiltinLoc, RParenLoc);
// The first argument is required to be a constant expression. It tells us
// the number of arguments to pass to each of the functions to be overloaded.
@@ -3287,18 +3287,18 @@
llvm::APSInt constEval(32);
SourceLocation ExpLoc;
if (!NParamsExpr->isIntegerConstantExpr(constEval, Context, &ExpLoc))
- return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant,
- NParamsExpr->getSourceRange());
+ return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant)
+ << NParamsExpr->getSourceRange();
// Verify that the number of parameters is > 0
unsigned NumParams = constEval.getZExtValue();
if (NumParams == 0)
- return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant,
- NParamsExpr->getSourceRange());
+ return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant)
+ << NParamsExpr->getSourceRange();
// Verify that we have at least 1 + NumParams arguments to the builtin.
if ((NumParams + 1) > NumArgs)
- return Diag(RParenLoc, diag::err_typecheck_call_too_few_args,
- SourceRange(BuiltinLoc, RParenLoc));
+ return Diag(RParenLoc, diag::err_typecheck_call_too_few_args)
+ << SourceRange(BuiltinLoc, RParenLoc);
// Figure out the return type, by matching the args to one of the functions
// listed after the parameters.
@@ -3315,16 +3315,16 @@
// parameters, and the number of parameters must match the value passed to
// the builtin.
if (!FnType || (FnType->getNumArgs() != NumParams))
- return Diag(Fn->getExprLoc(), diag::err_overload_incorrect_fntype,
- Fn->getSourceRange());
+ return Diag(Fn->getExprLoc(), diag::err_overload_incorrect_fntype)
+ << Fn->getSourceRange();
// Scan the parameter list for the FunctionType, checking the QualType of
// each parameter against the QualTypes of the arguments to the builtin.
// If they match, return a new OverloadExpr.
if (ExprsMatchFnType(Args+1, FnType, Context)) {
if (OE)
- return Diag(Fn->getExprLoc(), diag::err_overload_multiple_match,
- OE->getFn()->getSourceRange());
+ return Diag(Fn->getExprLoc(), diag::err_overload_multiple_match)
+ << OE->getFn()->getSourceRange();
// Remember our match, and continue processing the remaining arguments
// to catch any errors.
OE = new OverloadExpr(Args, NumArgs, i,