[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
Mon Jan 13 08:49:46 PST 2025


================
@@ -8192,6 +8192,14 @@ ExprResult InitializationSequence::Perform(Sema &S,
             Kind.getRange().getEnd());
       } else {
         CurInit = new (S.Context) ImplicitValueInitExpr(Step->Type);
+        // Note the return value isn't used to return early
+        // to preserve the AST as best as possible even though an error
+        // might have occurred. For struct initialization it also allows
+        // all field assignments to be checked rather than bailing on the
+        // first error.
+        S.BoundsSafetyCheckInitialization(Entity, Kind, Sema::AA_Initializing,
----------------
Sirraide wrote:

Actually, wait, I just noticed that there are several places we do this. I don’t remember off the top of my head, but is there any place where we actually *do* check for the error? If we always ignore it everywhere, the function should probably just return `void`, and the comment as to why we ‘ignore’ the error should be on the function instead.

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


More information about the cfe-commits mailing list