QualType BaseType =
cast<PointerType>(TypeTy.getUnqualifiedType())->getPointeeType();
if (ExprBaseType.getAddressSpace() != BaseType.getAddressSpace()) {
- Diag(Expr->getExprLoc(), diag::err_implicit_pointer_address_space_cast,
- Expr->getSourceRange());
+ Diag(Expr->getExprLoc(), diag::err_implicit_pointer_address_space_cast)
+ << Expr->getSourceRange();
}
}
return true;
}
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& Range) {
- PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID) << Range;
- return true;
-}
-
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
const SourceRange& Range) {
PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID) << Msg << Range;
const std::string &Msg2);
/// More expressive diagnostic helpers for expressions (say that 6 times:-)
- bool Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& R1);
bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
const SourceRange& R1);
// CHECK: printf-like function is called with no format string.
if (format_idx >= TheCall->getNumArgs()) {
- Diag(TheCall->getRParenLoc(), diag::warn_printf_missing_format_string,
- Fn->getSourceRange());
+ Diag(TheCall->getRParenLoc(), diag::warn_printf_missing_format_string)
+ << Fn->getSourceRange();
return;
}
return;
Diag(TheCall->getArg(format_idx)->getLocStart(),
- diag::warn_printf_not_string_constant,
- OrigFormatExpr->getSourceRange());
+ diag::warn_printf_not_string_constant)
+ << OrigFormatExpr->getSourceRange();
return;
}
// CHECK: is the format string a wide literal?
if (FExpr->isWide()) {
Diag(FExpr->getLocStart(),
- diag::warn_printf_format_string_is_wide_literal,
- OrigFormatExpr->getSourceRange());
+ diag::warn_printf_format_string_is_wide_literal)
+ << OrigFormatExpr->getSourceRange();
return;
}
const unsigned StrLen = FExpr->getByteLength();
if (StrLen == 0) {
- Diag(FExpr->getLocStart(), diag::warn_printf_empty_format_string,
- OrigFormatExpr->getSourceRange());
+ Diag(FExpr->getLocStart(), diag::warn_printf_empty_format_string)
+ << OrigFormatExpr->getSourceRange();
return;
}
// The string returned by getStrData() is not null-terminated,
// so the presence of a null character is likely an error.
Diag(PP.AdvanceToTokenCharacter(FExpr->getLocStart(), StrIdx+1),
- diag::warn_printf_format_string_contains_null_char,
- OrigFormatExpr->getSourceRange());
+ diag::warn_printf_format_string_contains_null_char)
+ << OrigFormatExpr->getSourceRange();
return;
}
Loc = PP.AdvanceToTokenCharacter(Loc, StrIdx+1);
if (Str[StrIdx-1] == '.')
- Diag(Loc, diag::warn_printf_asterisk_precision_missing_arg,
- OrigFormatExpr->getSourceRange());
+ Diag(Loc, diag::warn_printf_asterisk_precision_missing_arg)
+ << OrigFormatExpr->getSourceRange();
else
- Diag(Loc, diag::warn_printf_asterisk_width_missing_arg,
- OrigFormatExpr->getSourceRange());
+ Diag(Loc, diag::warn_printf_asterisk_width_missing_arg)
+ << OrigFormatExpr->getSourceRange();
// Don't do any more checking. We'll just emit spurious errors.
return;
PP.AdvanceToTokenCharacter(FExpr->getLocStart(), StrIdx+1);
if (Str[StrIdx-1] == '.')
- Diag(Loc, diag::warn_printf_asterisk_precision_wrong_type,
- E->getType().getAsString(), E->getSourceRange());
+ Diag(Loc, diag::warn_printf_asterisk_precision_wrong_type)
+ << E->getType().getAsString() << E->getSourceRange();
else
- Diag(Loc, diag::warn_printf_asterisk_width_wrong_type,
- E->getType().getAsString(), E->getSourceRange());
+ Diag(Loc, diag::warn_printf_asterisk_width_wrong_type)
+ << E->getType().getAsString() << E->getSourceRange();
break;
}
SourceLocation Loc = PP.AdvanceToTokenCharacter(FExpr->getLocStart(),
LastConversionIdx+1);
- Diag(Loc, diag::warn_printf_write_back, OrigFormatExpr->getSourceRange());
+ Diag(Loc, diag::warn_printf_write_back)<<OrigFormatExpr->getSourceRange();
break;
}
SourceLocation Loc = PP.AdvanceToTokenCharacter(FExpr->getLocStart(),
LastConversionIdx);
- Diag(Loc, diag::warn_printf_insufficient_data_args,
- OrigFormatExpr->getSourceRange());
+ Diag(Loc, diag::warn_printf_insufficient_data_args)
+ << OrigFormatExpr->getSourceRange();
}
// CHECK: Does the number of data arguments exceed the number of
// format conversions in the format string?
else if (numConversions < numDataArgs)
Diag(TheCall->getArg(format_idx+numConversions+1)->getLocStart(),
- diag::warn_printf_too_many_data_args,
- OrigFormatExpr->getSourceRange());
+ diag::warn_printf_too_many_data_args)
+ << OrigFormatExpr->getSourceRange();
}
}
RetValExp = IcExpr->getSubExpr();
if (BlockExpr *C = dyn_cast_or_null<BlockExpr>(RetValExp))
- Diag(C->getLocStart(), diag::err_ret_local_block,
- C->getSourceRange());
+ Diag(C->getLocStart(), diag::err_ret_local_block)
+ << C->getSourceRange();
}
// Perform checking for stack values returned by reference.
else if (lhsType->isReferenceType()) {
// Check for a reference to the stack
if (DeclRefExpr *DR = EvalVal(RetValExp))
- Diag(DR->getLocStart(), diag::warn_ret_stack_ref,
- DR->getDecl()->getIdentifier()->getName(),
- RetValExp->getSourceRange());
+ Diag(DR->getLocStart(), diag::warn_ret_stack_ref)
+ << DR->getDecl()->getIdentifier()->getName()
+ << RetValExp->getSourceRange();
}
}
// FIXME: Avoid truncation for 64-bit length strings.
if (strLiteral->getByteLength() > (unsigned)CAT->getSize().getZExtValue())
Diag(strLiteral->getSourceRange().getBegin(),
- diag::warn_initializer_string_for_char_array_too_long,
- strLiteral->getSourceRange());
+ diag::warn_initializer_string_for_char_array_too_long)
+ << strLiteral->getSourceRange();
}
// Set type from "char *" to "constant array of char".
strLiteral->setType(DeclT);
// C99 6.7.8p3: The type of the entity to be initialized shall be an array
// of unknown size ("[]") or an object type that is not a variable array type.
if (const VariableArrayType *VAT = Context.getAsVariableArrayType(DeclType))
- return Diag(InitLoc,
- diag::err_variable_object_no_init,
- VAT->getSizeExpr()->getSourceRange());
+ return Diag(InitLoc, diag::err_variable_object_no_init)
+ << VAT->getSizeExpr()->getSourceRange();
InitListExpr *InitList = dyn_cast<InitListExpr>(Init);
if (!InitList) {
// C99 6.7.8p16.
if (DeclType->isArrayType())
- return Diag(Init->getLocStart(),
- diag::err_array_init_list_required,
- Init->getSourceRange());
+ return Diag(Init->getLocStart(), diag::err_array_init_list_required)
+ << Init->getSourceRange();
return CheckSingleInitializer(Init, DeclType);
} else if (getLangOptions().CPlusPlus) {
if (const RecordType *ClassRec = DeclType->getAsRecordType()) {
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassRec->getDecl());
if (!ClassDecl->isAggregate())
- return Diag(InitLoc,
- diag::err_init_non_aggr_init_list,
- DeclType.getAsString(),
- Init->getSourceRange());
+ return Diag(InitLoc, diag::err_init_non_aggr_init_list)
+ << DeclType.getAsString() << Init->getSourceRange();
}
}
}
void Sema::InitializerElementNotConstant(const Expr *Init) {
- Diag(Init->getExprLoc(),
- diag::err_init_element_not_constant, Init->getSourceRange());
+ Diag(Init->getExprLoc(), diag::err_init_element_not_constant)
+ << Init->getSourceRange();
}
bool Sema::CheckAddressConstantExpressionLValue(const Expr* Init) {
// emit a warning that this is a GNU extension.
if (FalseSide && !FalseSide->isEvaluatable(Context))
Diag(Init->getExprLoc(),
- diag::ext_typecheck_expression_not_constant_but_accepted,
- FalseSide->getSourceRange());
+ diag::ext_typecheck_expression_not_constant_but_accepted)
+ << FalseSide->getSourceRange();
return false;
}
}
// than a variably modified type.
if (T->isVariablyModifiedType()) {
// FIXME: This diagnostic needs work
- Diag(Loc, diag::err_typecheck_illegal_vla, Loc);
+ Diag(Loc, diag::err_typecheck_illegal_vla) << SourceRange(Loc);
InvalidDecl = true;
}
}
if (NumExprs > 1) {
- Diag(CommaLocs[0], diag::err_builtin_direct_init_more_than_one_arg,
- SourceRange(VDecl->getLocation(), RParenLoc));
+ Diag(CommaLocs[0], diag::err_builtin_direct_init_more_than_one_arg)
+ << SourceRange(VDecl->getLocation(), RParenLoc);
RealDecl->setInvalidDecl();
return;
}
}
if (issueWarning && (MethList.Method && MethList.Next)) {
Diag(R.getBegin(), diag::warn_multiple_method_decl, Sel.getName(), R);
- Diag(MethList.Method->getLocStart(), diag::warn_using_decl,
- MethList.Method->getSourceRange());
+ Diag(MethList.Method->getLocStart(), diag::warn_using_decl)
+ << MethList.Method->getSourceRange();
for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next)
- Diag(Next->Method->getLocStart(), diag::warn_also_found_decl,
- Next->Method->getSourceRange());
+ Diag(Next->Method->getLocStart(), diag::warn_also_found_decl)
+ << Next->Method->getSourceRange();
}
return MethList.Method;
}
// 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;
}
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;
}
// 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();
}
}
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
// 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];
// 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;
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() :
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.
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.
// 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,
// be a class with a suitably declared constructor.
//
if (NumExprs > 1)
- return Diag(CommaLocs[0], diag::err_builtin_func_cast_more_than_one_arg,
- FullRange);
+ return Diag(CommaLocs[0], diag::err_builtin_func_cast_more_than_one_arg)
+ << FullRange;
assert(NumExprs == 0 && "Expected 0 expressions");
// rvalue of the specified type, which is value-initialized.
//
if (Ty->isArrayType())
- return Diag(TyBeginLoc, diag::err_value_init_for_array_type, FullRange);
+ return Diag(TyBeginLoc, diag::err_value_init_for_array_type) << FullRange;
if (Ty->isIncompleteType() && !Ty->isVoidType())
- return Diag(TyBeginLoc, diag::err_invalid_incomplete_type_use,
- Ty.getAsString(), FullRange);
+ return Diag(TyBeginLoc, diag::err_invalid_incomplete_type_use)
+ << Ty.getAsString() << FullRange;
return new CXXZeroInitValueExpr(Ty, TyBeginLoc, RParenLoc);
}
if (Ty->isFunctionType()) { // The declarator shall not specify a function...
// We exit without creating a CXXConditionDeclExpr because a FunctionDecl
// would be created and CXXConditionDeclExpr wants a VarDecl.
- return Diag(StartLoc, diag::err_invalid_use_of_function_type,
- SourceRange(StartLoc, EqualLoc));
+ return Diag(StartLoc, diag::err_invalid_use_of_function_type)
+ << SourceRange(StartLoc, EqualLoc);
} else if (Ty->isArrayType()) { // ...or an array.
- Diag(StartLoc, diag::err_invalid_use_of_array_type,
- SourceRange(StartLoc, EqualLoc));
+ Diag(StartLoc, diag::err_invalid_use_of_array_type)
+ << SourceRange(StartLoc, EqualLoc);
} else if (const RecordType *RT = Ty->getAsRecordType()) {
RecordDecl *RD = RT->getDecl();
// The type-specifier-seq shall not declare a new class...
SemaRef->IsStringLiteralInit(IList->getInit(Index), T)) {
// Special-case
SemaRef->Diag(IList->getInit(Index)->getLocStart(),
- diag::err_excess_initializers_in_char_array_initializer,
- IList->getInit(Index)->getSourceRange());
+ diag::err_excess_initializers_in_char_array_initializer)
+ << IList->getInit(Index)->getSourceRange();
hadError = true;
} else if (!T->isIncompleteType()) {
// Don't warn for incomplete types, since we'll get an error elsewhere
SemaRef->Diag(IList->getInit(Index)->getLocStart(),
- diag::warn_excess_initializers,
- IList->getInit(Index)->getSourceRange());
+ diag::warn_excess_initializers)
+ << IList->getInit(Index)->getSourceRange();
}
}
if (T->isScalarType())
- SemaRef->Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init,
- IList->getSourceRange());
+ SemaRef->Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init)
+ << IList->getSourceRange();
}
void InitListChecker::CheckListElementTypes(InitListExpr *IList,
Expr* expr = IList->getInit(Index);
if (isa<InitListExpr>(expr)) {
SemaRef->Diag(IList->getLocStart(),
- diag::err_many_braces_around_scalar_init,
- IList->getSourceRange());
+ diag::err_many_braces_around_scalar_init)
+ << IList->getSourceRange();
hadError = true;
++Index;
return;
IList->setInit(Index, expr);
++Index;
} else {
- SemaRef->Diag(IList->getLocStart(),
- diag::err_empty_scalar_initializer,
- IList->getSourceRange());
+ SemaRef->Diag(IList->getLocStart(), diag::err_empty_scalar_initializer)
+ << IList->getSourceRange();
hadError = true;
return;
}
// earlier, but I don't know where clang accepts VLAs (gcc accepts
// them in all sorts of strange places).
SemaRef->Diag(VAT->getSizeExpr()->getLocStart(),
- diag::err_variable_object_no_init,
- VAT->getSizeExpr()->getSourceRange());
+ diag::err_variable_object_no_init)
+ << VAT->getSizeExpr()->getSourceRange();
hadError = true;
return;
}
SourceLocation ExpLoc;
// C99 6.8.4.2p3: The expression shall be an integer constant.
if (!LHSVal->isIntegerConstantExpr(Context, &ExpLoc)) {
- Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr,
- LHSVal->getSourceRange());
+ Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr)
+ << LHSVal->getSourceRange();
return SubStmt;
}
// GCC extension: The expression shall be an integer constant.
if (RHSVal && !RHSVal->isIntegerConstantExpr(Context, &ExpLoc)) {
- Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr,
- RHSVal->getSourceRange());
+ Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr)
+ << RHSVal->getSourceRange();
RHSVal = 0; // Recover by just forgetting about it.
}
// If the low value is bigger than the high value, the case is empty.
if (CaseRanges[i].first > HiVal) {
- Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range,
- SourceRange(CR->getLHS()->getLocStart(),
- CR->getRHS()->getLocEnd()));
+ Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range)
+ << SourceRange(CR->getLHS()->getLocStart(),
+ CR->getRHS()->getLocEnd());
CaseRanges.erase(CaseRanges.begin()+i);
--i, --e;
continue;
Expr::isLvalueResult lval = cast<Expr>(First)->isLvalue(Context);
if (lval != Expr::LV_Valid)
- return Diag(First->getLocStart(), diag::err_selector_element_not_lvalue,
- First->getSourceRange());
+ return Diag(First->getLocStart(), diag::err_selector_element_not_lvalue)
+ << First->getSourceRange();
FirstType = static_cast<Expr*>(first)->getType();
}
if (!Context.isObjCObjectPointerType(FirstType))
- Diag(ForLoc, diag::err_selector_element_type,
- FirstType.getAsString(), First->getSourceRange());
+ Diag(ForLoc, diag::err_selector_element_type)
+ << FirstType.getAsString() << First->getSourceRange();
}
if (Second) {
DefaultFunctionArrayConversion(Second);
QualType SecondType = Second->getType();
if (!Context.isObjCObjectPointerType(SecondType))
- Diag(ForLoc, diag::err_collection_expr_type,
- SecondType.getAsString(), Second->getSourceRange());
+ Diag(ForLoc, diag::err_collection_expr_type)
+ << SecondType.getAsString() << Second->getSourceRange();
}
return new ObjCForCollectionStmt(First, Second, Body, ForLoc, RParenLoc);
}
// The parser verifies that there is a string literal here.
if (AsmString->isWide())
// FIXME: We currently leak memory here.
- return Diag(AsmString->getLocStart(), diag::err_asm_wide_character,
- AsmString->getSourceRange());
+ return Diag(AsmString->getLocStart(), diag::err_asm_wide_character)
+ << AsmString->getSourceRange();
for (unsigned i = 0; i != NumOutputs; i++) {
StringLiteral *Literal = Constraints[i];
if (Literal->isWide())
// FIXME: We currently leak memory here.
- return Diag(Literal->getLocStart(), diag::err_asm_wide_character,
- Literal->getSourceRange());
+ return Diag(Literal->getLocStart(), diag::err_asm_wide_character)
+ << Literal->getSourceRange();
std::string OutputConstraint(Literal->getStrData(),
Literal->getByteLength());
if (Result != Expr::LV_Valid) {
// FIXME: We currently leak memory here.
return Diag(OutputExpr->getSubExpr()->getLocStart(),
- diag::err_asm_invalid_lvalue_in_output,
- OutputExpr->getSubExpr()->getSourceRange());
+ diag::err_asm_invalid_lvalue_in_output)
+ << OutputExpr->getSubExpr()->getSourceRange();
}
}
StringLiteral *Literal = Constraints[i];
if (Literal->isWide())
// FIXME: We currently leak memory here.
- return Diag(Literal->getLocStart(), diag::err_asm_wide_character,
- Literal->getSourceRange());
+ return Diag(Literal->getLocStart(), diag::err_asm_wide_character)
+ << Literal->getSourceRange();
std::string InputConstraint(Literal->getStrData(),
Literal->getByteLength());
NumOutputs, info)) {
// FIXME: We currently leak memory here.
return Diag(Literal->getLocStart(),
- diag::err_asm_invalid_input_constraint, InputConstraint);
+ diag::err_asm_invalid_input_constraint) << InputConstraint;
}
// Check that the input exprs aren't of type void.
StringLiteral *Literal = Clobbers[i];
if (Literal->isWide())
// FIXME: We currently leak memory here.
- return Diag(Literal->getLocStart(), diag::err_asm_wide_character,
- Literal->getSourceRange());
+ return Diag(Literal->getLocStart(), diag::err_asm_wide_character)
+ << Literal->getSourceRange();
llvm::SmallString<16> Clobber(Literal->getStrData(),
Literal->getStrData() +
// have a value greater than zero.
if (ConstVal.isSigned()) {
if (ConstVal.isNegative()) {
- Diag(ArraySize->getLocStart(),
- diag::err_typecheck_negative_array_size,
- ArraySize->getSourceRange());
+ Diag(ArraySize->getLocStart(),
+ diag::err_typecheck_negative_array_size)
+ << ArraySize->getSourceRange();
D.setInvalidType(true);
} else if (ConstVal == 0) {
// GCC accepts zero sized static arrays.
- Diag(ArraySize->getLocStart(), diag::ext_typecheck_zero_array_size,
- ArraySize->getSourceRange());
+ Diag(ArraySize->getLocStart(), diag::ext_typecheck_zero_array_size)
+ << ArraySize->getSourceRange();
}
}
T = Context.getConstantArrayType(T, ConstVal, ASM, ATI.TypeQuals);
Expr *ASArgExpr = static_cast<Expr *>(Attr.getArg(0));
llvm::APSInt addrSpace(32);
if (!ASArgExpr->isIntegerConstantExpr(addrSpace, S.Context)) {
- S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int,
- ASArgExpr->getSourceRange());
+ S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int)
+ << ASArgExpr->getSourceRange();
return;
}