rapidsna wrote:

Thanks @AaronBallman! 

> I think AttributedType might be a reasonable way forward. That's how we model 
> nullability qualifiers, for example:

The difference from nullability qualifiers is that they are actually encoded as 
`AttributeKind`, whereas `__counted_by` has to store more than `Kind`, i.e., an 
expression and some dependent declarations.   

And the reason why we created a new sugar type instead of using 
`AttributedType` is that `AttributedType` itself doesn't have an extended data 
other than `AttributeKind` as an integer value. And more data seems to be 
stored in `TypeLoc`.  

Related to this, I remember we talked about having `CountAttributedType` to 
inherit `AttributedType`. I didn't want this to be picked up by 
`getAs<AttributedType>` so that we won't have to conditionalize 
`CountAttributedType` where `AttributeType` is generally handled and there's no 
other type inheriting `AttributedType` so far. E.g., BTagAttributedType is a 
sugar type that doesn't inherit `AttributedType`.

https://github.com/llvm/llvm-project/pull/78000
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to