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

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 11:13:47 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff a9ffb719bc323588b6b60fbf227db8104a81310e 1695451175d65cdda8647e273d8b8643629aea54 --extensions cpp,h -- clang/include/clang/AST/DeclCXX.h clang/lib/AST/DeclCXX.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaInit.cpp clang/test/SemaCXX/uninitialized.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 60e35f92f8..6ec7159413 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -4557,7 +4557,8 @@ static void TryConstructorInitialization(Sema &S,
     if (!IsListInit && Kind.getKind() == InitializationKind::IK_Default &&
         DestRecordDecl != nullptr && DestRecordDecl->isAggregate() &&
         DestRecordDecl->hasUninitializedExplicitInitFields()) {
-      S.Diag(Kind.getLocation(), diag::warn_field_requires_explicit_init) << "in class";
+      S.Diag(Kind.getLocation(), diag::warn_field_requires_explicit_init)
+          << "in class";
     }
 
     // C++11 [dcl.init]p6:

``````````

</details>


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


More information about the cfe-commits mailing list