mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
minor diagnostics improvements.
llvm-svn: 70092
This commit is contained in:
@@ -946,8 +946,9 @@ def err_arithmetic_nonfragile_interface : Error<
|
||||
|
||||
|
||||
def err_typecheck_subscript_value : Error<
|
||||
"subscripted value is neither array nor pointer">;
|
||||
def err_typecheck_subscript : Error<"array subscript is not an integer">;
|
||||
"subscripted value is not an array, pointer, or vector">;
|
||||
def err_typecheck_subscript_not_integer : Error<
|
||||
"array subscript is not an integer">;
|
||||
def err_subscript_function_type : Error<
|
||||
"subscript of pointer to function type %0">;
|
||||
def err_subscript_incomplete_type : Error<
|
||||
|
||||
@@ -1636,13 +1636,13 @@ Sema::ActOnArraySubscriptExpr(Scope *S, ExprArg Base, SourceLocation LLoc,
|
||||
// FIXME: need to deal with const...
|
||||
ResultType = VTy->getElementType();
|
||||
} else {
|
||||
return ExprError(Diag(LHSExp->getLocStart(),
|
||||
diag::err_typecheck_subscript_value) << RHSExp->getSourceRange());
|
||||
return ExprError(Diag(LLoc, diag::err_typecheck_subscript_value)
|
||||
<< LHSExp->getSourceRange() << RHSExp->getSourceRange());
|
||||
}
|
||||
// C99 6.5.2.1p1
|
||||
if (!IndexExpr->getType()->isIntegerType() && !IndexExpr->isTypeDependent())
|
||||
return ExprError(Diag(IndexExpr->getLocStart(),
|
||||
diag::err_typecheck_subscript) << IndexExpr->getSourceRange());
|
||||
return ExprError(Diag(LLoc, diag::err_typecheck_subscript_not_integer)
|
||||
<< IndexExpr->getSourceRange());
|
||||
|
||||
// C99 6.5.2.1p1: "shall have type "pointer to *object* type". Similarly,
|
||||
// C++ [expr.sub]p1: The type "T" shall be a completely-defined object
|
||||
@@ -4586,7 +4586,7 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
|
||||
// FIXME: Leaks Res
|
||||
if (!Idx->isTypeDependent() && !Idx->getType()->isIntegerType())
|
||||
return ExprError(Diag(Idx->getLocStart(),
|
||||
diag::err_typecheck_subscript)
|
||||
diag::err_typecheck_subscript_not_integer)
|
||||
<< Idx->getSourceRange());
|
||||
|
||||
Res = new (Context) ArraySubscriptExpr(Res, Idx, AT->getElementType(),
|
||||
|
||||
Reference in New Issue
Block a user