[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 23:06:47 PDT 2024


================
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes,
   return false;
 }
 
+SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) {
----------------
Sirraide wrote:

> [#108631](https://github.com/llvm/llvm-project/pull/108631) seems to have similar issues with wanting to access `AttributedTypeLoc` when all they have is `AttributedType`. We might need to improve the infrastructure for accessing `TypeLoc`s in a more ergonomic fashion.

Yeah, ideally, the attribute should really be moved from `AttributedTypeLoc` into `AttributedType` (Aaron and I had a discussion about this a few months back); this isn’t the first time we’ve run into problems because of that, but unfortunately, that wouldn’t even fix this because `CountAttributedType` is not an `AttributedType` (on that note, we have a lot of types that basically just implement an attribute; I wonder if there’d be a way to merge some of them and use just `AttributedType` instead once it actually stores the attribute, but that’s a different matter altogether ;Þ)

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


More information about the cfe-commits mailing list