@@ -5241,36 +5241,22 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
5241
5241
<< ResultType << BaseExpr->getSourceRange();
5242
5242
return ExprError();
5243
5243
}
5244
- } else if (const VectorType *VTy = LHSTy->getAs<VectorType>()) {
5245
- BaseExpr = LHSExp; // vectors: V[123]
5246
- IndexExpr = RHSExp;
5247
- // We apply C++ DR1213 to vector subscripting too.
5248
- if (getLangOpts().CPlusPlus11 && LHSExp->isPRValue()) {
5249
- ExprResult Materialized = TemporaryMaterializationConversion(LHSExp);
5250
- if (Materialized.isInvalid())
5251
- return ExprError();
5252
- LHSExp = Materialized.get();
5244
+ } else if (LHSTy->isSubscriptableVectorType()) {
5245
+ if (LHSTy->isBuiltinType() &&
5246
+ LHSTy->getAs<BuiltinType>()->isSveVLSBuiltinType()) {
5247
+ const BuiltinType *BTy = LHSTy->getAs<BuiltinType>();
5248
+ if (BTy->isSVEBool())
5249
+ return ExprError(Diag(LLoc, diag::err_subscript_svbool_t)
5250
+ << LHSExp->getSourceRange()
5251
+ << RHSExp->getSourceRange());
5252
+ ResultType = BTy->getSveEltType(Context);
5253
+ } else {
5254
+ const VectorType *VTy = LHSTy->getAs<VectorType>();
5255
+ ResultType = VTy->getElementType();
5253
5256
}
5254
- VK = LHSExp->getValueKind();
5255
- if (VK != VK_PRValue)
5256
- OK = OK_VectorComponent;
5257
-
5258
- ResultType = VTy->getElementType();
5259
- QualType BaseType = BaseExpr->getType();
5260
- Qualifiers BaseQuals = BaseType.getQualifiers();
5261
- Qualifiers MemberQuals = ResultType.getQualifiers();
5262
- Qualifiers Combined = BaseQuals + MemberQuals;
5263
- if (Combined != MemberQuals)
5264
- ResultType = Context.getQualifiedType(ResultType, Combined);
5265
- } else if (LHSTy->isBuiltinType() &&
5266
- LHSTy->getAs<BuiltinType>()->isSveVLSBuiltinType()) {
5267
- const BuiltinType *BTy = LHSTy->getAs<BuiltinType>();
5268
- if (BTy->isSVEBool())
5269
- return ExprError(Diag(LLoc, diag::err_subscript_svbool_t)
5270
- << LHSExp->getSourceRange() << RHSExp->getSourceRange());
5271
-
5272
- BaseExpr = LHSExp;
5257
+ BaseExpr = LHSExp; // vectors: V[123]
5273
5258
IndexExpr = RHSExp;
5259
+ // We apply C++ DR1213 to vector subscripting too.
5274
5260
if (getLangOpts().CPlusPlus11 && LHSExp->isPRValue()) {
5275
5261
ExprResult Materialized = TemporaryMaterializationConversion(LHSExp);
5276
5262
if (Materialized.isInvalid())
@@ -5281,8 +5267,6 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
5281
5267
if (VK != VK_PRValue)
5282
5268
OK = OK_VectorComponent;
5283
5269
5284
- ResultType = BTy->getSveEltType(Context);
5285
-
5286
5270
QualType BaseType = BaseExpr->getType();
5287
5271
Qualifiers BaseQuals = BaseType.getQualifiers();
5288
5272
Qualifiers MemberQuals = ResultType.getQualifiers();
0 commit comments