[clang] [clang] Warn on mismatched RequiresCapability attributes (PR #67520)
Aaron Puchert via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 14:08:12 PST 2024
================
@@ -2263,6 +2265,27 @@ static bool neverReturns(const CFGBlock *B) {
return false;
}
+void ThreadSafetyAnalyzer::checkMismatchedFunctionAttrs(const NamedDecl *ND) {
+ auto collectCapabilities = [&](const Decl *D) {
+ CapExprSet Caps;
+ for (const auto *A : D->specific_attrs<RequiresCapabilityAttr>()) {
+ for (const Expr *E : A->args())
+ Caps.push_back_nodup(SxBuilder.translateAttrExpr(E, nullptr));
+ }
+ return Caps;
+ };
+
+ auto NDArgs = collectCapabilities(ND);
----------------
aaronpuchert wrote:
```suggestion
CapExprSet NDArgs = collectCapabilities(ND);
```
Same below.
https://github.com/llvm/llvm-project/pull/67520
More information about the cfe-commits
mailing list