[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 09:04:15 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:

> The return value isn't always ignored in our fork.

Just saw this comment; I think it’s fine to keep the return value then, but I’m not sure we want to copy-paste the same comment across like 4 different calls to this function. Having it in one location where it’s maybe the least self-evident seems fine, but I think we generally want to eschew code duplication, even if it’s just a comment and not code.

Some places have (or at one point had) a cast to `void`; that I think we can remove everywhere.

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


More information about the cfe-commits mailing list