forked from OSchip/llvm-project
Replacing err_attribute_argument_not_int with err_attribute_not_type_attr
llvm-svn: 187419
This commit is contained in:
parent
ed71850ab2
commit
9d695091fd
|
@ -1770,8 +1770,6 @@ def err_attribute_missing_parameter_name : Error<
|
|||
def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
|
||||
def err_attribute_bad_neon_vector_size : Error<
|
||||
"Neon vector size must be 64 or 128 bits">;
|
||||
def err_attribute_argument_not_int : Error<
|
||||
"'%0' attribute requires integer constant">;
|
||||
def err_aligned_attribute_argument_not_int : Error<
|
||||
"'aligned' attribute requires integer constant">;
|
||||
def err_alignas_attribute_wrong_decl_type : Error<
|
||||
|
|
|
@ -1174,8 +1174,9 @@ static void handleAllocSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
// check if the function argument is of an integer type
|
||||
QualType T = getFunctionOrMethodArgType(D, Idx).getNonReferenceType();
|
||||
if (!T->isIntegerType()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< "alloc_size" << Ex->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< Ex->getSourceRange();
|
||||
return;
|
||||
}
|
||||
SizeArgs.push_back(Idx);
|
||||
|
@ -2691,8 +2692,9 @@ static void handleWorkGroupSize(Sema &S, Decl *D,
|
|||
llvm::APSInt ArgNum(32);
|
||||
if (E->isTypeDependent() || E->isValueDependent() ||
|
||||
!E->isIntegerConstantExpr(ArgNum, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< Attr.getName()->getName() << E->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< E->getSourceRange();
|
||||
return;
|
||||
}
|
||||
WGSize[i] = (unsigned) ArgNum.getZExtValue();
|
||||
|
@ -3047,8 +3049,9 @@ static void handleInitPriorityAttr(Sema &S, Decl *D,
|
|||
llvm::APSInt priority(32);
|
||||
if (priorityExpr->isTypeDependent() || priorityExpr->isValueDependent() ||
|
||||
!priorityExpr->isIntegerConstantExpr(priority, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< "init_priority" << priorityExpr->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< priorityExpr->getSourceRange();
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -3964,8 +3967,9 @@ static void handleOpenCLImageAccessAttr(Sema &S, Decl *D, const AttributeList &A
|
|||
llvm::APSInt ArgNum(32);
|
||||
if (E->isTypeDependent() || E->isValueDependent() ||
|
||||
!E->isIntegerConstantExpr(ArgNum, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< Attr.getName()->getName() << E->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< E->getSourceRange();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4070,8 +4074,9 @@ bool Sema::CheckRegparmAttr(const AttributeList &Attr, unsigned &numParams) {
|
|||
llvm::APSInt NumParams(32);
|
||||
if (NumParamsExpr->isTypeDependent() || NumParamsExpr->isValueDependent() ||
|
||||
!NumParamsExpr->isIntegerConstantExpr(NumParams, Context)) {
|
||||
Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< "regparm" << NumParamsExpr->getSourceRange();
|
||||
Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< NumParamsExpr->getSourceRange();
|
||||
Attr.setInvalid();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1630,8 +1630,9 @@ QualType Sema::BuildExtVectorType(QualType T, Expr *ArraySize,
|
|||
if (!ArraySize->isTypeDependent() && !ArraySize->isValueDependent()) {
|
||||
llvm::APSInt vecSize(32);
|
||||
if (!ArraySize->isIntegerConstantExpr(vecSize, Context)) {
|
||||
Diag(AttrLoc, diag::err_attribute_argument_not_int)
|
||||
<< "ext_vector_type" << ArraySize->getSourceRange();
|
||||
Diag(AttrLoc, diag::err_attribute_argument_type)
|
||||
<< "ext_vector_type" << AANT_ArgumentIntegerConstant
|
||||
<< ArraySize->getSourceRange();
|
||||
return QualType();
|
||||
}
|
||||
|
||||
|
@ -3847,8 +3848,9 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
|
|||
llvm::APSInt addrSpace(32);
|
||||
if (ASArgExpr->isTypeDependent() || ASArgExpr->isValueDependent() ||
|
||||
!ASArgExpr->isIntegerConstantExpr(addrSpace, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< Attr.getName()->getName() << ASArgExpr->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< ASArgExpr->getSourceRange();
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4480,8 +4482,9 @@ static void HandleOpenCLImageAccessAttribute(QualType& CurType,
|
|||
llvm::APSInt arg(32);
|
||||
if (sizeExpr->isTypeDependent() || sizeExpr->isValueDependent() ||
|
||||
!sizeExpr->isIntegerConstantExpr(arg, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< "opencl_image_access" << sizeExpr->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< sizeExpr->getSourceRange();
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4521,8 +4524,9 @@ static void HandleVectorSizeAttr(QualType& CurType, const AttributeList &Attr,
|
|||
llvm::APSInt vecSize(32);
|
||||
if (sizeExpr->isTypeDependent() || sizeExpr->isValueDependent() ||
|
||||
!sizeExpr->isIntegerConstantExpr(vecSize, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< "vector_size" << sizeExpr->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< sizeExpr->getSourceRange();
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4608,8 +4612,7 @@ static void HandleExtVectorTypeAttr(QualType &CurType,
|
|||
/// match one of the standard Neon vector types.
|
||||
static void HandleNeonVectorTypeAttr(QualType& CurType,
|
||||
const AttributeList &Attr, Sema &S,
|
||||
VectorType::VectorKind VecKind,
|
||||
const char *AttrName) {
|
||||
VectorType::VectorKind VecKind) {
|
||||
// Check the attribute arguments.
|
||||
if (Attr.getNumArgs() != 1) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
|
||||
|
@ -4622,8 +4625,9 @@ static void HandleNeonVectorTypeAttr(QualType& CurType,
|
|||
llvm::APSInt numEltsInt(32);
|
||||
if (numEltsExpr->isTypeDependent() || numEltsExpr->isValueDependent() ||
|
||||
!numEltsExpr->isIntegerConstantExpr(numEltsInt, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< AttrName << numEltsExpr->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< numEltsExpr->getSourceRange();
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
|
@ -4739,13 +4743,12 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
|
|||
break;
|
||||
case AttributeList::AT_NeonVectorType:
|
||||
HandleNeonVectorTypeAttr(type, attr, state.getSema(),
|
||||
VectorType::NeonVector, "neon_vector_type");
|
||||
VectorType::NeonVector);
|
||||
attr.setUsedAsTypeAttr();
|
||||
break;
|
||||
case AttributeList::AT_NeonPolyVectorType:
|
||||
HandleNeonVectorTypeAttr(type, attr, state.getSema(),
|
||||
VectorType::NeonPolyVector,
|
||||
"neon_polyvector_type");
|
||||
VectorType::NeonPolyVector);
|
||||
attr.setUsedAsTypeAttr();
|
||||
break;
|
||||
case AttributeList::AT_OpenCLImageAccess:
|
||||
|
|
|
@ -40,8 +40,9 @@ static void HandleMSP430InterruptAttr(Decl *d,
|
|||
Expr *NumParamsExpr = static_cast<Expr *>(Attr.getArg(0));
|
||||
llvm::APSInt NumParams(32);
|
||||
if (!NumParamsExpr->isIntegerConstantExpr(NumParams, S.Context)) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
|
||||
<< "interrupt" << NumParamsExpr->getSourceRange();
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
|
||||
<< Attr.getName() << AANT_ArgumentIntegerConstant
|
||||
<< NumParamsExpr->getSourceRange();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,4 +66,4 @@ void access_as_field()
|
|||
}
|
||||
|
||||
typedef int PR4997 __attribute__((address_space(Foobar))); // expected-error {{use of undeclared identifier 'Foobar'}}
|
||||
__attribute__((address_space("12"))) int *i; // expected-error {{'address_space' attribute requires integer constant}}
|
||||
__attribute__((address_space("12"))) int *i; // expected-error {{'address_space' attribute requires an integer constant}}
|
||||
|
|
|
@ -7,7 +7,7 @@ void* my_realloc(void*, unsigned) __attribute__((alloc_size(2)));
|
|||
|
||||
void* fn1(int) __attribute__((alloc_size("xpto"))); // expected-error{{'alloc_size' attribute requires parameter 1 to be an integer constant}}
|
||||
|
||||
void* fn2(void*) __attribute__((alloc_size(1))); // expected-error{{attribute requires integer constant}}
|
||||
void* fn2(void*) __attribute__((alloc_size(1))); // expected-error{{'alloc_size' attribute requires an integer constant}}
|
||||
|
||||
void* fn3(unsigned) __attribute__((alloc_size(0))); // expected-error{{attribute parameter 1 is out of bounds}}
|
||||
void* fn4(unsigned) __attribute__((alloc_size(2))); // expected-error{{attribute parameter 1 is out of bounds}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
|
||||
|
||||
__attribute((regparm(2))) int x0(void);
|
||||
__attribute((regparm(1.0))) int x1(void); // expected-error{{'regparm' attribute requires integer constant}}
|
||||
__attribute((regparm(1.0))) int x1(void); // expected-error{{'regparm' attribute requires an integer constant}}
|
||||
__attribute((regparm(-1))) int x2(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
|
||||
__attribute((regparm(5))) int x3(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
|
||||
__attribute((regparm(5,3))) int x4(void); // expected-error{{'regparm' attribute takes one argument}}
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
|
|||
typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{'neon_vector_type' attribute takes one argument}}
|
||||
|
||||
// The number of elements must be an ICE.
|
||||
typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires integer constant}}
|
||||
typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{'neon_vector_type' attribute requires an integer constant}}
|
||||
|
||||
// Only certain element types are allowed.
|
||||
typedef __attribute__((neon_vector_type(2))) double double_elt; // expected-error{{invalid vector element type}}
|
||||
|
|
|
@ -23,7 +23,7 @@ Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{'init_
|
|||
|
||||
Two coo[2] __attribute__((init_priority(3))); // expected-error {{init_priority attribute requires integer constant between 101 and 65535 inclusive}}
|
||||
|
||||
Two koo[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires integer constant}}
|
||||
Two koo[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires an integer constant}}
|
||||
|
||||
|
||||
Two func() __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
|
||||
|
|
Loading…
Reference in New Issue