================ @@ -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:
> It would be superfluous if not for the part about struct initialization. To > me that is really not very obvious. That’s fair. I might just be to used to this as a pattern. Commenting *why* we don’t just throw the entire thing out of the window here and still try to keep operating on it even if this fails is probably fine. > I've changed the comments to just be. > > ``` > // Note the return value isn't used to return a ExprError() when > // initialization fails . For struct initialization allows all field > // assignments to be checked rather than bailing on the first error. > ``` I’d honestly shorten it even more to just: ``` // Don't return here so we can still check field assingments. ``` because e.g. the fact that ‘the return value isn't used to return a ExprError() when initialization fails’ is apparent from the fact that... there is no `return` statement here. ;Þ https://github.com/llvm/llvm-project/pull/106321 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits