[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 24 11:15:33 PDT 2024
================
@@ -119,6 +119,15 @@ FIELD(HasInitMethod, 1, NO_MERGE)
/// within anonymous unions or structs.
FIELD(HasInClassInitializer, 1, NO_MERGE)
+/// Custom attribute that is True if any field is marked as requiring explicit
+/// initialization with [[clang::requires_explicit_initialization]] in a type
+/// without a user-provided default constructor, or if this is the case for any
+/// base classes and/or member variables whose types are aggregates.
+///
+/// In this case, default-construction is diagnosed, as it would not explicitly
+/// initialize the field.
+FIELD(HasUninitializedExplicitInitFields, 1, NO_MERGE)
----------------
higher-performance wrote:
I'm confused - below, you agree that having this field makes sense as the alternative cost is too high. This is merely declaring that field, so that we can use it. What am I doing wrong here?
https://github.com/llvm/llvm-project/pull/102040
More information about the cfe-commits
mailing list