[clang] [clang-tools-extra] [clang] Make `InitListExpr::isExplicit()` work (PR #195175)

Andrey Ali Khan Bolshakov via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 13:54:22 PDT 2026


================
@@ -3550,21 +3552,22 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index,
       ExpectedNumInits = IList->getNumInits() - Index;
   }
 
-  InitListExpr *Result =
-      createInitListExpr(CurrentObjectType, InitRange, ExpectedNumInits);
+  InitListExpr *Result = createInitListExpr(
+      CurrentObjectType, InitRange, ExpectedNumInits, /*IsExplicit=*/false);
----------------
bolshakov-a wrote:

This looks somewhat fragile because it makes use of the knowledge that `getStructuredSubobjectInit` is called only to obtain implicit initializer lists. OTOH, if the list is created here, and not bound to any explicit list, that probably means that it is actually implicit.

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


More information about the cfe-commits mailing list