[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
Tue Jan 7 07:56:32 PST 2025


================
@@ -8207,6 +8207,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.
----------------
delcypher wrote:

It would be superfluous if not for the part about struct initialization. To me that is really not very obvious. When possible I think it's very useful to comment **why** the code is doing something. All too often I come across code where I understand what it's doing but I understand **why**.

So I would prefer to keep it. If you prefer I could only keep the bit about struct initialization.

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


More information about the cfe-commits mailing list