[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 17:24:44 PST 2024


================
@@ -4259,7 +4240,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
       if (const auto *ME = dyn_cast<MemberExpr>(Array);
           ME &&
           ME->isFlexibleArrayMemberLike(getContext(), StrictFlexArraysLevel) &&
-          ME->getMemberDecl()->hasAttr<CountedByAttr>()) {
+          ME->getMemberDecl()->getType()->getAs<CountAttributedType>()) {
----------------
rapidsna wrote:

`ME->getMemberDecl()->getType()` might be wrapped in another sugar type, so `isa` might not work in that case. To deal with that, I just added `isCountAttributedType()`.

https://github.com/llvm/llvm-project/pull/78000


More information about the cfe-commits mailing list