[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 7 09:43:29 PST 2025
================
@@ -19,13 +19,12 @@ struct on_member_pointer_complete_ty {
};
struct on_member_pointer_incomplete_ty {
- struct size_unknown * buf __counted_by(count); // expected-error{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct size_unknown' is an incomplete type}}
+ struct size_unknown * buf __counted_by(count); // ok
----------------
AaronBallman wrote:
IMO, this seems slightly problematic for API designers, which is why I was asking about delaying checks to the end of the TU above. For someone designing an API with poor testing, they can miss the fact that this attribute is incorrect because nothing ever completes the type in this TU; I think both of these cases should still be diagnosed.
WDYT?
https://github.com/llvm/llvm-project/pull/106321
More information about the cfe-commits
mailing list