[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 27 10:45:31 PDT 2024


================
@@ -743,6 +743,14 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
         ILE->updateInit(SemaRef.Context, Init, Filler);
       return;
     }
+
+    if (!VerifyOnly && Field->hasAttr<ExplicitInitAttr>()) {
+      SemaRef.Diag(ILE->getExprLoc(), diag::warn_field_requires_explicit_init)
+          << false << Field;
----------------
erichkeane wrote:

Same here.

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


More information about the cfe-commits mailing list