[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 9 03:02:43 PDT 2024
================
@@ -1472,3 +1472,25 @@ template<typename T> struct Outer {
};
};
Outer<int>::Inner outerinner;
+
+void aggregate() {
----------------
ilya-biryukov wrote:
Could we add examples from @AaronBallman's [RFC comment](https://discourse.llvm.org/t/rfc-add-clang-attribute-to-ensure-that-fields-are-initialized-explicitly/80626/20)?
This raises all the same interesting questions that he mentioned, I am leaning towards limiting the support on any cases that require significant work to support (e.g. empty struct, zero-width bitfields or all bitfields altogether) in the initial implementation and simply filing bugs to address those limitations later.
I do feel we should warn that an attribute has no effect on those fields / structs if we choose to do so and test those warnings show up.
https://github.com/llvm/llvm-project/pull/102040
More information about the cfe-commits
mailing list