[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 12:29:18 PDT 2024


================
@@ -4561,6 +4569,13 @@ static void TryConstructorInitialization(Sema &S,
 
   CXXConstructorDecl *CtorDecl = cast<CXXConstructorDecl>(Best->Function);
   if (Result != OR_Deleted) {
+    if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default &&
----------------
erichkeane wrote:

This is more that this line of questioning is leading me to have some significant doubts as to whether this is doing what it is supposed to be doing, and doing so in an acceptable way.  

I'm not sure how the `RecordDecl` itself can contain the information as to whether this initialization is initializing everything necessary, and the goofy diagnostics here making the problem more opaque.  You don't have ot do them just yet (I want to discuss this with Aaron whether that field name needs to be identified), but unless I'm misunderstanding this (and I'll have to spend a few hours debugging to figure it out to convince me), I might be against this patch.

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


More information about the cfe-commits mailing list