[clang] Warning for incorrect useof 'pure' attribute (PR #78200)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 15 11:52:39 PST 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 ba131b7017ce99d56a0584e630ed542d8cd48488 3c5e6bcb2295f142f37f9bbd0d7801b3c67c3593 -- clang/test/Sema/incorrect_pure.cpp clang/lib/Sema/SemaDecl.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1951177c4c..f5a0ef327b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -11890,11 +11890,10 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
}
if (NewFD->hasAttr<PureAttr>() || NewFD->hasAttr<ConstAttr>()) {
- if (const CXXConstructorDecl* ctor = dyn_cast<NewFD>()) {
+ if (const CXXConstructorDecl *ctor = dyn_cast<NewFD>()) {
if (!ctor->getParent().isEmpty())
Diag(NewFD->getLocation(), diag::warn_pure_attr_on_cxx_constructor);
- }
- else if (NewFD->getReturnType()->isVoidType())
+ } else if (NewFD->getReturnType()->isVoidType())
Diag(NewFD->getLocation(), diag::warn_pure_function_returns_void);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/78200
More information about the cfe-commits
mailing list