[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
Thu Oct 24 23:06:48 PDT 2024


================
@@ -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.
----------------
Sirraide wrote:

I still think the comment is superfluous. This pattern of potentially diagnosing something, but not returning `ExprError()`/`true`/whatever so we can still construct a somewhat valid AST is fairly common in Sema, so I don’t think every (or any) call to this function in this fashion really needs to be commented (and the same applies to the call in `InitializationSequence::Perform()`).

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


More information about the cfe-commits mailing list