================ @@ -1419,6 +1419,28 @@ is not specified. }]; } +def ExplicitInitDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``clang::explicit_init`` attribute indicates that the field must be +initialized explicitly by the caller when the class is constructed. ---------------- ilya-biryukov wrote:
Maybe document that the caveats here? I could see us exploring the extension of this analysis to make sure the "explicit_init" fields are all written before they're read, but that's not what's happening today IIUC. Another caveat, is that the attribute is ignored on non-aggregate classes. ```cpp struct NonAgg { NonAgg() {} int x [[clang::explicit_init]]; // attribute ignored. } ``` And maybe also mention that these warnings do not aim to comprehensively prevent uses of uninitialized memory, but are, rather, supporting tools for aiding to write code in certain code style if people choose to (e.g. using it for parameter objects in combination with C++20 designated initializer). https://github.com/llvm/llvm-project/pull/102040 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits