diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 0f6c727f6f9ca..3c78833a3f069 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -1564,8 +1564,8 @@ class ASTContext : public RefCountedBase { /// Return a non-unique reference to the type for a variable array of /// the specified element type. QualType getVariableArrayType(QualType EltTy, Expr *NumElts, - ArraySizeModifier ASM, unsigned IndexTypeQuals, - SourceRange Brackets) const; + ArraySizeModifier ASM, + unsigned IndexTypeQuals) const; /// Return a non-unique reference to the type for a dependently-sized /// array of the specified element type. @@ -1574,8 +1574,7 @@ class ASTContext : public RefCountedBase { /// point. QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, - unsigned IndexTypeQuals, - SourceRange Brackets) const; + unsigned IndexTypeQuals) const; /// Return a unique reference to the type for an incomplete array of /// the specified element type. diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index fe62120a25643..74886ef0cd824 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -3827,14 +3827,9 @@ class VariableArrayType : public ArrayType { /// a function block. Stmt *SizeExpr; - /// The range spanned by the left and right array brackets. - SourceRange Brackets; - - VariableArrayType(QualType et, QualType can, Expr *e, - ArraySizeModifier sm, unsigned tq, - SourceRange brackets) - : ArrayType(VariableArray, et, can, sm, tq, e), - SizeExpr((Stmt*) e), Brackets(brackets) {} + VariableArrayType(QualType et, QualType can, Expr *e, ArraySizeModifier sm, + unsigned tq) + : ArrayType(VariableArray, et, can, sm, tq, e), SizeExpr((Stmt *)e) {} public: friend class StmtIteratorBase; @@ -3845,10 +3840,6 @@ class VariableArrayType : public ArrayType { return (Expr*) SizeExpr; } - SourceRange getBracketsRange() const { return Brackets; } - SourceLocation getLBracketLoc() const { return Brackets.getBegin(); } - SourceLocation getRBracketLoc() const { return Brackets.getEnd(); } - bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } @@ -3884,12 +3875,8 @@ class DependentSizedArrayType : public ArrayType { /// type will have its size deduced from an initializer. Stmt *SizeExpr; - /// The range spanned by the left and right array brackets. - SourceRange Brackets; - DependentSizedArrayType(QualType et, QualType can, Expr *e, - ArraySizeModifier sm, unsigned tq, - SourceRange brackets); + ArraySizeModifier sm, unsigned tq); public: friend class StmtIteratorBase; @@ -3900,10 +3887,6 @@ class DependentSizedArrayType : public ArrayType { return (Expr*) SizeExpr; } - SourceRange getBracketsRange() const { return Brackets; } - SourceLocation getLBracketLoc() const { return Brackets.getBegin(); } - SourceLocation getRBracketLoc() const { return Brackets.getEnd(); } - bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td index 3bf9239e9cbf5..f4b8ce0994ba8 100644 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -154,40 +154,22 @@ let Class = IncompleteArrayType in { } let Class = VariableArrayType in { - def : Property<"leftBracketLoc", SourceLocation> { - let Read = [{ node->getLBracketLoc() }]; - } - def : Property<"rightBracketLoc", SourceLocation> { - let Read = [{ node->getRBracketLoc() }]; - } def : Property<"size", ExprRef> { let Read = [{ node->getSizeExpr() }]; } def : Creator<[{ return ctx.getVariableArrayType(elementType, size, sizeModifier, - indexQualifiers.getCVRQualifiers(), - SourceRange(leftBracketLoc, - rightBracketLoc)); + indexQualifiers.getCVRQualifiers()); }]>; } let Class = DependentSizedArrayType in { - def : Property<"size", ExprRef> { - let Read = [{ node->getSizeExpr() }]; - } - def : Property<"leftBracketLoc", SourceLocation> { - let Read = [{ node->getLBracketLoc() }]; - } - def : Property<"rightBracketLoc", SourceLocation> { - let Read = [{ node->getRBracketLoc() }]; - } + def : Property<"size", ExprRef> { let Read = [{ node->getSizeExpr() }]; } def : Creator<[{ return ctx.getDependentSizedArrayType(elementType, size, sizeModifier, - indexQualifiers.getCVRQualifiers(), - SourceRange(leftBracketLoc, - rightBracketLoc)); + indexQualifiers.getCVRQualifiers()); }]>; } diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 46bd1977d688d..dfae2f5511b43 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4261,11 +4261,8 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const { case Type::DependentSizedArray: { const auto *dat = cast(ty); result = getDependentSizedArrayType( - getVariableArrayDecayedType(dat->getElementType()), - dat->getSizeExpr(), - dat->getSizeModifier(), - dat->getIndexTypeCVRQualifiers(), - dat->getBracketsRange()); + getVariableArrayDecayedType(dat->getElementType()), dat->getSizeExpr(), + dat->getSizeModifier(), dat->getIndexTypeCVRQualifiers()); break; } @@ -4275,17 +4272,17 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const { result = getVariableArrayType(getVariableArrayDecayedType(iat->getElementType()), /*size*/ nullptr, ArraySizeModifier::Normal, - iat->getIndexTypeCVRQualifiers(), SourceRange()); + iat->getIndexTypeCVRQualifiers()); break; } // Turn VLA types into [*] types. case Type::VariableArray: { const auto *vat = cast(ty); - result = getVariableArrayType( - getVariableArrayDecayedType(vat->getElementType()), - /*size*/ nullptr, ArraySizeModifier::Star, - vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange()); + result = + getVariableArrayType(getVariableArrayDecayedType(vat->getElementType()), + /*size*/ nullptr, ArraySizeModifier::Star, + vat->getIndexTypeCVRQualifiers()); break; } } @@ -4298,8 +4295,7 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const { /// variable array of the specified element type. QualType ASTContext::getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, - unsigned IndexTypeQuals, - SourceRange Brackets) const { + unsigned IndexTypeQuals) const { // Since we don't unique expressions, it isn't possible to unique VLA's // that have an expression provided for their size. QualType Canon; @@ -4309,12 +4305,12 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, Expr *NumElts, if (!EltTy.isCanonical() || EltTy.hasLocalQualifiers()) { SplitQualType canonSplit = getCanonicalType(EltTy).split(); Canon = getVariableArrayType(QualType(canonSplit.Ty, 0), NumElts, ASM, - IndexTypeQuals, Brackets); + IndexTypeQuals); Canon = getQualifiedType(Canon, canonSplit.Quals); } auto *New = new (*this, alignof(VariableArrayType)) - VariableArrayType(EltTy, Canon, NumElts, ASM, IndexTypeQuals, Brackets); + VariableArrayType(EltTy, Canon, NumElts, ASM, IndexTypeQuals); VariableArrayTypes.push_back(New); Types.push_back(New); @@ -4324,11 +4320,10 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, Expr *NumElts, /// getDependentSizedArrayType - Returns a non-unique reference to /// the type for a dependently-sized array of the specified element /// type. -QualType ASTContext::getDependentSizedArrayType(QualType elementType, - Expr *numElements, - ArraySizeModifier ASM, - unsigned elementTypeQuals, - SourceRange brackets) const { +QualType +ASTContext::getDependentSizedArrayType(QualType elementType, Expr *numElements, + ArraySizeModifier ASM, + unsigned elementTypeQuals) const { assert((!numElements || numElements->isTypeDependent() || numElements->isValueDependent()) && "Size must be type- or value-dependent!"); @@ -4354,7 +4349,7 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, auto *newType = new (*this, alignof(DependentSizedArrayType)) DependentSizedArrayType(elementType, QualType(), numElements, ASM, - elementTypeQuals, brackets); + elementTypeQuals); DependentSizedArrayTypes.InsertNode(newType, insertPos); Types.push_back(newType); return QualType(newType, 0); @@ -4364,7 +4359,7 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, if (!canonTy) { canonTy = new (*this, alignof(DependentSizedArrayType)) DependentSizedArrayType(QualType(canonElementType.Ty, 0), QualType(), - numElements, ASM, elementTypeQuals, brackets); + numElements, ASM, elementTypeQuals); DependentSizedArrayTypes.InsertNode(canonTy, insertPos); Types.push_back(canonTy); } @@ -4383,7 +4378,7 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // of the element type. auto *sugaredType = new (*this, alignof(DependentSizedArrayType)) DependentSizedArrayType(elementType, canon, numElements, ASM, - elementTypeQuals, brackets); + elementTypeQuals); Types.push_back(sugaredType); return QualType(sugaredType, 0); } @@ -6775,17 +6770,14 @@ QualType ASTContext::getUnqualifiedArrayType(QualType type, } if (const auto *VAT = dyn_cast(AT)) { - return getVariableArrayType(unqualElementType, - VAT->getSizeExpr(), + return getVariableArrayType(unqualElementType, VAT->getSizeExpr(), VAT->getSizeModifier(), - VAT->getIndexTypeCVRQualifiers(), - VAT->getBracketsRange()); + VAT->getIndexTypeCVRQualifiers()); } const auto *DSAT = cast(AT); return getDependentSizedArrayType(unqualElementType, DSAT->getSizeExpr(), - DSAT->getSizeModifier(), 0, - SourceRange()); + DSAT->getSizeModifier(), 0); } /// Attempt to unwrap two types that may both be array types with the same bound @@ -7729,19 +7721,14 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) const { IAT->getIndexTypeCVRQualifiers())); if (const auto *DSAT = dyn_cast(ATy)) - return cast( - getDependentSizedArrayType(NewEltTy, - DSAT->getSizeExpr(), - DSAT->getSizeModifier(), - DSAT->getIndexTypeCVRQualifiers(), - DSAT->getBracketsRange())); + return cast(getDependentSizedArrayType( + NewEltTy, DSAT->getSizeExpr(), DSAT->getSizeModifier(), + DSAT->getIndexTypeCVRQualifiers())); const auto *VAT = cast(ATy); - return cast(getVariableArrayType(NewEltTy, - VAT->getSizeExpr(), - VAT->getSizeModifier(), - VAT->getIndexTypeCVRQualifiers(), - VAT->getBracketsRange())); + return cast( + getVariableArrayType(NewEltTy, VAT->getSizeExpr(), VAT->getSizeModifier(), + VAT->getIndexTypeCVRQualifiers())); } QualType ASTContext::getAdjustedParameterType(QualType T) const { @@ -13846,10 +13833,7 @@ static QualType getCommonNonSugarTypeNode(ASTContext &Ctx, const Type *X, return Ctx.getDependentSizedArrayType( getCommonArrayElementType(Ctx, AX, QX, AY, QY), getCommonSizeExpr(Ctx, AX, AY), getCommonSizeModifier(AX, AY), - getCommonIndexTypeCVRQualifiers(AX, AY), - AX->getBracketsRange() == AY->getBracketsRange() - ? AX->getBracketsRange() - : SourceRange()); + getCommonIndexTypeCVRQualifiers(AX, AY)); } case Type::ConstantArray: { const auto *AX = cast(X), diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 5baff6c1e13e9..5c8acde452dbc 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -142,13 +142,13 @@ QualType clang::desugarForDiagnostic(ASTContext &Context, QualType QT, ElementTy, CAT->getSize(), CAT->getSizeExpr(), CAT->getSizeModifier(), CAT->getIndexTypeCVRQualifiers()); else if (const auto *VAT = dyn_cast(AT)) - QT = Context.getVariableArrayType( - ElementTy, VAT->getSizeExpr(), VAT->getSizeModifier(), - VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange()); + QT = Context.getVariableArrayType(ElementTy, VAT->getSizeExpr(), + VAT->getSizeModifier(), + VAT->getIndexTypeCVRQualifiers()); else if (const auto *DSAT = dyn_cast(AT)) QT = Context.getDependentSizedArrayType( ElementTy, DSAT->getSizeExpr(), DSAT->getSizeModifier(), - DSAT->getIndexTypeCVRQualifiers(), DSAT->getBracketsRange()); + DSAT->getIndexTypeCVRQualifiers()); else if (const auto *IAT = dyn_cast(AT)) QT = Context.getIncompleteArrayType(ElementTy, IAT->getSizeModifier(), IAT->getIndexTypeCVRQualifiers()); diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 378734e9c1909..b55b8f2c14147 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -1295,12 +1295,11 @@ ASTNodeImporter::VisitVariableArrayType(const VariableArrayType *T) { Error Err = Error::success(); QualType ToElementType = importChecked(Err, T->getElementType()); Expr *ToSizeExpr = importChecked(Err, T->getSizeExpr()); - SourceRange ToBracketsRange = importChecked(Err, T->getBracketsRange()); if (Err) return std::move(Err); return Importer.getToContext().getVariableArrayType( ToElementType, ToSizeExpr, T->getSizeModifier(), - T->getIndexTypeCVRQualifiers(), ToBracketsRange); + T->getIndexTypeCVRQualifiers()); } ExpectedType ASTNodeImporter::VisitDependentSizedArrayType( @@ -1308,7 +1307,6 @@ ExpectedType ASTNodeImporter::VisitDependentSizedArrayType( Error Err = Error::success(); QualType ToElementType = importChecked(Err, T->getElementType()); Expr *ToSizeExpr = importChecked(Err, T->getSizeExpr()); - SourceRange ToBracketsRange = importChecked(Err, T->getBracketsRange()); if (Err) return std::move(Err); // SizeExpr may be null if size is not specified directly. @@ -1316,7 +1314,7 @@ ExpectedType ASTNodeImporter::VisitDependentSizedArrayType( return Importer.getToContext().getDependentSizedArrayType( ToElementType, ToSizeExpr, T->getSizeModifier(), - T->getIndexTypeCVRQualifiers(), ToBracketsRange); + T->getIndexTypeCVRQualifiers()); } ExpectedType ASTNodeImporter::VisitDependentSizedExtVectorType( diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 4d14614fc1ec7..88f6926929ea9 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -3312,7 +3312,7 @@ void MicrosoftCXXNameMangler::mangleArrayType(const ArrayType *T) { const DependentSizedArrayType *DSAT = getASTContext().getAsDependentSizedArrayType(ElementTy); Error(DSAT->getSizeExpr()->getExprLoc(), "dependent-length") - << DSAT->getBracketsRange(); + << DSAT->getSizeExpr()->getSourceRange(); return; } else { break; diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index be8d609974d81..837477c112f3d 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -1941,16 +1941,12 @@ void TextNodeDumper::VisitConstantArrayType(const ConstantArrayType *T) { } void TextNodeDumper::VisitVariableArrayType(const VariableArrayType *T) { - OS << " "; - dumpSourceRange(T->getBracketsRange()); VisitArrayType(T); } void TextNodeDumper::VisitDependentSizedArrayType( const DependentSizedArrayType *T) { VisitArrayType(T); - OS << " "; - dumpSourceRange(T->getBracketsRange()); } void TextNodeDumper::VisitDependentSizedExtVectorType( diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 7898e6b90bf4b..62e48062cf241 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -279,10 +279,8 @@ QualType ArrayParameterType::getConstantArrayType(const ASTContext &Ctx) const { DependentSizedArrayType::DependentSizedArrayType(QualType et, QualType can, Expr *e, ArraySizeModifier sm, - unsigned tq, - SourceRange brackets) - : ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((Stmt *)e), - Brackets(brackets) {} + unsigned tq) + : ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((Stmt *)e) {} void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, @@ -1099,8 +1097,7 @@ struct SimpleTransformVisitor : public TypeVisitor { return Ctx.getVariableArrayType(elementType, T->getSizeExpr(), T->getSizeModifier(), - T->getIndexTypeCVRQualifiers(), - T->getBracketsRange()); + T->getIndexTypeCVRQualifiers()); } QualType VisitIncompleteArrayType(const IncompleteArrayType *T) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 5736864d4cc6b..918b064c3cfd5 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -3797,7 +3797,7 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc, RValue::get(NumOfElements)); KmpTaskAffinityInfoArrayTy = C.getVariableArrayType( KmpTaskAffinityInfoTy, OVE, ArraySizeModifier::Normal, - /*IndexTypeQuals=*/0, SourceRange(Loc, Loc)); + /*IndexTypeQuals=*/0); // Properly emit variable-sized array. auto *PD = ImplicitParamDecl::Create(C, KmpTaskAffinityInfoArrayTy, ImplicitParamKind::Other); @@ -4260,7 +4260,7 @@ std::pair CGOpenMPRuntime::emitDependClause( RValue::get(NumOfElements)); KmpDependInfoArrayTy = C.getVariableArrayType(KmpDependInfoTy, OVE, ArraySizeModifier::Normal, - /*IndexTypeQuals=*/0, SourceRange(Loc, Loc)); + /*IndexTypeQuals=*/0); // CGF.EmitVariablyModifiedType(KmpDependInfoArrayTy); // Properly emit variable-sized array. auto *PD = ImplicitParamDecl::Create(C, KmpDependInfoArrayTy, diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index efe2d03882f31..a1e4bb4321d53 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -7740,27 +7740,11 @@ ExprResult InitializationSequence::Perform(Sema &S, // introduced and such). So, we fall back to making the array // type a dependently-sized array type with no specified // bound. - if (isa((Expr *)Args[0])) { - SourceRange Brackets; - - // Scavange the location of the brackets from the entity, if we can. - if (auto *DD = dyn_cast_or_null(Entity.getDecl())) { - if (TypeSourceInfo *TInfo = DD->getTypeSourceInfo()) { - TypeLoc TL = TInfo->getTypeLoc(); - if (IncompleteArrayTypeLoc ArrayLoc = - TL.getAs()) - Brackets = ArrayLoc.getBracketsRange(); - } - } - - *ResultType - = S.Context.getDependentSizedArrayType(ArrayT->getElementType(), - /*NumElts=*/nullptr, - ArrayT->getSizeModifier(), - ArrayT->getIndexTypeCVRQualifiers(), - Brackets); - } - + if (isa((Expr *)Args[0])) + *ResultType = S.Context.getDependentSizedArrayType( + ArrayT->getElementType(), + /*NumElts=*/nullptr, ArrayT->getSizeModifier(), + ArrayT->getIndexTypeCVRQualifiers()); } } if (Kind.getKind() == InitializationKind::IK_Direct && diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index a382947455aef..0e44cfab6f216 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -19120,7 +19120,7 @@ static bool actOnOMPReductionKindClause( Type, new (Context) OpaqueValueExpr(ELoc, Context.getSizeType(), VK_PRValue), - ArraySizeModifier::Normal, /*IndexTypeQuals=*/0, SourceRange()); + ArraySizeModifier::Normal, /*IndexTypeQuals=*/0); } else if (!ASE && !OASE && Context.getAsArrayType(D->getType().getNonReferenceType())) { PrivateTy = D->getType().getNonReferenceType(); @@ -19360,7 +19360,7 @@ static bool actOnOMPReductionKindClause( OpaqueValueExpr(ELoc, S.Context.getSizeType(), VK_PRValue); QualType ArrayTy = S.Context.getVariableArrayType( PrivateTy, Dim, ArraySizeModifier::Normal, - /*IndexTypeQuals=*/0, {ELoc, ELoc}); + /*IndexTypeQuals=*/0); VarDecl *TempArrayVD = buildVarDecl(S, ELoc, ArrayTy, D->getName(), D->hasAttrs() ? &D->getAttrs() : nullptr); diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e711a5c5d2a18..33b1d8ca4dfa0 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -2213,12 +2213,12 @@ QualType Sema::BuildArrayType(QualType T, ArraySizeModifier ASM, if (VLAIsError) return QualType(); - T = Context.getVariableArrayType(T, nullptr, ASM, Quals, Brackets); + T = Context.getVariableArrayType(T, nullptr, ASM, Quals); } else { T = Context.getIncompleteArrayType(T, ASM, Quals); } } else if (ArraySize->isTypeDependent() || ArraySize->isValueDependent()) { - T = Context.getDependentSizedArrayType(T, ArraySize, ASM, Quals, Brackets); + T = Context.getDependentSizedArrayType(T, ArraySize, ASM, Quals); } else { ExprResult R = checkArraySize(*this, ArraySize, ConstVal, VLADiag, VLAIsError); @@ -2229,7 +2229,7 @@ QualType Sema::BuildArrayType(QualType T, ArraySizeModifier ASM, // C99: an array with a non-ICE size is a VLA. We accept any expression // that we can fold to a non-zero positive value as a non-VLA as an // extension. - T = Context.getVariableArrayType(T, ArraySize, ASM, Quals, Brackets); + T = Context.getVariableArrayType(T, ArraySize, ASM, Quals); } else if (!T->isDependentType() && !T->isIncompleteType() && !T->isConstantSizeType()) { // C99: an array with an element type that has a non-constant-size is a @@ -2238,7 +2238,7 @@ QualType Sema::BuildArrayType(QualType T, ArraySizeModifier ASM, Diag(Loc, VLADiag); if (VLAIsError) return QualType(); - T = Context.getVariableArrayType(T, ArraySize, ASM, Quals, Brackets); + T = Context.getVariableArrayType(T, ArraySize, ASM, Quals); } else { // C99 6.7.5.2p1: If the expression is a constant expression, it shall // have a value greater than zero. @@ -6947,9 +6947,9 @@ namespace { if (const auto *VAT = dyn_cast(Old)) { QualType New = wrap(C, VAT->getElementType(), I); - return C.getVariableArrayType( - New, VAT->getSizeExpr(), VAT->getSizeModifier(), - VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange()); + return C.getVariableArrayType(New, VAT->getSizeExpr(), + VAT->getSizeModifier(), + VAT->getIndexTypeCVRQualifiers()); } const auto *IAT = cast(Old); diff --git a/clang/test/AST/ast-dump-array.cpp b/clang/test/AST/ast-dump-array.cpp index 418e4292680ee..15771f227df8a 100644 --- a/clang/test/AST/ast-dump-array.cpp +++ b/clang/test/AST/ast-dump-array.cpp @@ -22,9 +22,9 @@ class array { T data[Size]; using array_T_size = T[Size]; - // CHECK: `-DependentSizedArrayType 0x{{[^ ]*}} 'T[Size]' dependent + // CHECK: `-DependentSizedArrayType 0x{{[^ ]*}} 'T[Size]' dependent using const_array_T_size = const T[Size]; - // CHECK: `-DependentSizedArrayType 0x{{[^ ]*}} 'const T[Size]' dependent + // CHECK: `-DependentSizedArrayType 0x{{[^ ]*}} 'const T[Size]' dependent }; struct V {}; diff --git a/clang/test/SemaTemplate/deduction-guide.cpp b/clang/test/SemaTemplate/deduction-guide.cpp index 6db132ca37c7e..2888453a12f5b 100644 --- a/clang/test/SemaTemplate/deduction-guide.cpp +++ b/clang/test/SemaTemplate/deduction-guide.cpp @@ -475,7 +475,7 @@ A a{.f1 = {1}}; // CHECK-NEXT: `-RValueReferenceType {{.+}} 'int (&&)[N]' dependent // CHECK-NEXT: `-DependentSizedArrayType {{.+}} 'int[N]' dependent // CHECK-NEXT: |-BuiltinType {{.+}} 'int' -// CHECK-NEXT: `-DeclRefExpr {{.+}} 'int' NonTypeTemplateParm {{.+}} 'N' 'int' +// CHECK-NEXT: `-DeclRefExpr {{.+}} <{{.+}}:10> 'int' NonTypeTemplateParm {{.+}} 'N' 'int' } // namespace GH83368