[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 19 10:19:24 PDT 2024
================
@@ -6014,6 +6014,10 @@ static void handleNoMergeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
D->addAttr(NoMergeAttr::Create(S.Context, AL));
}
+static void handleExplicitInitAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ D->addAttr(ExplicitInitAttr::Create(S.Context, AL));
----------------
erichkeane wrote:
I think we need more explicit checking here. This needs to limit to an aggregate type in some way, I'd very much not want us to ignore this silently on non-aggregates. Though perhaps the diagnostic needs to happen later? Perhaps handling this needs to look at the `RecordDecl` and make the determination off of that?
https://github.com/llvm/llvm-project/pull/102040
More information about the cfe-commits
mailing list