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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 10:20:11 PST 2024


================
@@ -1599,6 +1599,55 @@ is not specified.
   }];
 }
 
+def ExplicitInitDocs : Documentation {
+  let Category = DocCatField;
+  let Content = [{
+The ``clang::requires_explicit_initialization`` attribute indicates that the
+field of an aggregate must be initialized explicitly by users when the type
+is constructed. The attribute supports both C and C++, but its usage is invalid
+on non-aggregates.
----------------
AaronBallman wrote:

```suggestion
The ``clang::requires_explicit_initialization`` attribute indicates that a
field of an aggregate must be initialized explicitly by the user when an object of the aggregate type
is constructed. The attribute supports both C and C++, but its usage is invalid
on non-aggregates.
```

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


More information about the cfe-commits mailing list