[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 30 05:55:13 PDT 2024
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/67520 at github.com>
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 9f3728d15721830ef1d29a8ae1af97124bc26b47 96f854242577f3e7f83cb0ea8bd8cde4605459fd --extensions cpp -- clang/lib/Sema/SemaDeclAttr.cpp
``````````
</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 9814710148..9bfda0b9b2 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5798,7 +5798,7 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D,
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
auto collectExprs = [](const FunctionDecl *FuncDecl) {
- std::set<const ValueDecl*> Args;
+ std::set<const ValueDecl *> Args;
for (const auto *A : FuncDecl->specific_attrs<RequiresCapabilityAttr>()) {
for (const Expr *E : A->args()) {
if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
@@ -5811,12 +5811,11 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D,
for (const FunctionDecl *P = FD->getPreviousDecl(); P;
P = P->getPreviousDecl()) {
auto PrevDecl = collectExprs(P);
- // FIXME: It would be nice to mention _what_ attribute isn't matched and maybe
- // even where the previous declaration was?
+ // FIXME: It would be nice to mention _what_ attribute isn't matched and
+ // maybe even where the previous declaration was?
if (ThisDecl.size() != PrevDecl.size())
S.Diag(D->getLocation(), diag::warn_attribute_mismatch) << FD;
}
-
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/67520
More information about the cfe-commits
mailing list