[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 12:52:03 PDT 2024
================
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes,
return false;
}
+SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) {
----------------
delcypher wrote:
Yeah this isn't great. The whole function is essentially a workaround for the fact we don't have a good way to get `CountAttributedTypeLoc` from a `CountAttributedType`.
Given that I don't want to solve this problem right now I think simplest thing to do is just use the SourceRange from the count expression (which is the fallback for this function anyway). It does mean the SourceRange is slightly wrong (doesn't actually include the attribute text) but this isn't a deal breaker.
I can then tackle fixing this as part of the work to fix the issue mentioned in this comment: https://github.com/llvm/llvm-project/pull/106321#discussion_r1735207309
Does that sound reasonable to you?
https://github.com/llvm/llvm-project/pull/106321
More information about the cfe-commits
mailing list