[clang] Diagnose problematic uses of constructor/destructor attribute (PR #67673)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 06:38:40 PDT 2023


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 c51857b4e53031753d6b998ce0ef5f59c073aeb3 02565df450927fac88062f526a167c9beb518c2f -- clang/test/Sema/constructor-attribute-diag-group.c clang/lib/Sema/SemaDeclAttr.cpp clang/test/CodeGen/PowerPC/aix-destructor-attribute.c clang/test/CodeGenCXX/aix-destructor-attribute.cpp clang/test/Sema/constructor-attribute.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 133f8f7516cf..de4630954eb5 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -2460,8 +2460,7 @@ static void handleCtorDtorAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
         << AL << FD->getSourceRange();
     return;
   }
-  if (const auto *MD = dyn_cast<CXXMethodDecl>(FD);
-             MD && MD->isInstance()) {
+  if (const auto *MD = dyn_cast<CXXMethodDecl>(FD); MD && MD->isInstance()) {
     S.Diag(AL.getLoc(), diag::err_ctor_dtor_member_func)
         << AL << FD->getSourceRange();
     return;

``````````

</details>


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


More information about the cfe-commits mailing list