[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
Tue Feb 4 17:24:56 PST 2025
================
@@ -1593,34 +1593,31 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
// object or incomplete types shall not be restrict-qualified."
if (Qs.hasRestrict()) {
unsigned DiagID = 0;
- QualType ProblemTy;
-
- if (T->isAnyPointerType() || T->isReferenceType() ||
- T->isMemberPointerType()) {
- QualType EltTy;
- if (T->isObjCObjectPointerType())
- EltTy = T;
- else if (const MemberPointerType *PTy = T->getAs<MemberPointerType>())
+ QualType EltTy = Context.getBaseElementType(T);
+
+ if (EltTy->isAnyPointerType() || EltTy->isReferenceType() ||
+ EltTy->isMemberPointerType() || EltTy->isArrayType()) {
----------------
efriedma-quic wrote:
Drop the isArrayType() here; should be impossible for EltTy to be an array here.
https://github.com/llvm/llvm-project/pull/120896
More information about the cfe-commits
mailing list