================
@@ -802,9 +842,19 @@ InitListChecker::FillInEmptyInitializations(const
InitializedEntity &Entity,
}
}
} else {
+ InitListExpr *SForm =
+ ILE->isSyntacticForm() ? ILE : ILE->getSyntacticForm();
// The fields beyond ILE->getNumInits() are default initialized, so in
// order to leave them uninitialized, the ILE is expanded and the extra
// fields are then filled with NoInitExpr.
+
+ // Some checks that required for MFI warning are bound to how many
+ // elements the initializer list originally was provided, perform them
+ // before the list is expanded
+ bool MaybeEmitMFIWarning =
+ !SForm->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) &&
+ ILE->getNumInits() &&
+ !(hasAnyDesignatedInits(SForm) && !SemaRef.getLangOpts().CPlusPlus);
----------------
zygoloid wrote:
Reverse the order of these checks to avoid scanning the whole initializer list
here in C++ mode. Please also add a comment here to say we're doing this for
GCC compatibility. (Though I question whether we should be! This seems like
emulating a GCC warning bug, which we usually don't do.)
https://github.com/llvm/llvm-project/pull/70829
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits