@@ -7689,14 +7689,17 @@ static bool isPermittedNeonBaseType(QualType &Ty,
7689
7689
static bool verifyValidIntegerConstantExpr (Sema &S, const ParsedAttr &Attr,
7690
7690
llvm::APSInt &Result) {
7691
7691
const auto *AttrExpr = Attr.getArgAsExpr (0 );
7692
- if (AttrExpr->isTypeDependent () || AttrExpr->isValueDependent () ||
7693
- !AttrExpr-> isIntegerConstantExpr (Result, S. Context )) {
7694
- S. Diag (Attr. getLoc (), diag::err_attribute_argument_type)
7695
- << Attr << AANT_ArgumentIntegerConstant << AttrExpr-> getSourceRange () ;
7696
- Attr. setInvalid () ;
7697
- return false ;
7692
+ if (! AttrExpr->isTypeDependent () && ! AttrExpr->isValueDependent ()) {
7693
+ if (Optional<llvm::APSInt> Res =
7694
+ AttrExpr-> getIntegerConstantExpr (S. Context )) {
7695
+ Result = *Res ;
7696
+ return true ;
7697
+ }
7698
7698
}
7699
- return true ;
7699
+ S.Diag (Attr.getLoc (), diag::err_attribute_argument_type)
7700
+ << Attr << AANT_ArgumentIntegerConstant << AttrExpr->getSourceRange ();
7701
+ Attr.setInvalid ();
7702
+ return false ;
7700
7703
}
7701
7704
7702
7705
// / HandleNeonVectorTypeAttr - The "neon_vector_type" and
@@ -7737,7 +7740,7 @@ static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr,
7737
7740
7738
7741
// The total size of the vector must be 64 or 128 bits.
7739
7742
unsigned typeSize = static_cast <unsigned >(S.Context .getTypeSize (CurType));
7740
- unsigned numElts = static_cast <unsigned >(numEltsInt-> getZExtValue ());
7743
+ unsigned numElts = static_cast <unsigned >(numEltsInt. getZExtValue ());
7741
7744
unsigned vecSize = typeSize * numElts;
7742
7745
if (vecSize != 64 && vecSize != 128 ) {
7743
7746
S.Diag (Attr.getLoc (), diag::err_attribute_bad_neon_vector_size) << CurType;
0 commit comments