[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 3 12:59:13 PST 2025
================
@@ -1596,12 +1596,14 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
QualType ProblemTy;
if (T->isAnyPointerType() || T->isReferenceType() ||
- T->isMemberPointerType()) {
+ T->isMemberPointerType() || T->isArrayType()) {
QualType EltTy;
if (T->isObjCObjectPointerType())
EltTy = T;
else if (const MemberPointerType *PTy = T->getAs<MemberPointerType>())
EltTy = PTy->getPointeeType();
+ else if (T->isArrayType())
+ EltTy = BuildQualifiedType(Context.getBaseElementType(T), Loc, Qs);
----------------
efriedma-quic wrote:
I guess I wasn't clear enough.
My suggestion was to call `Context.getBaseElementType(T)`, and then perform all the pointer type/object type/etc. on the result of that, instead of recursively calling BuildQualifiedType.
https://github.com/llvm/llvm-project/pull/120896
More information about the cfe-commits
mailing list