[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 15:24:26 PDT 2024


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
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>


================
@@ -2282,6 +2306,9 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
   const NamedDecl *D = walker.getDecl();
   CurrentFunction = dyn_cast<FunctionDecl>(D);
 
+  if (CurrentFunction)
+    checkMismatchedFunctionAttrs(CurrentFunction);
----------------
aaronpuchert wrote:

We also analyze `ObjCMethodDecl`. You might want to do the same check for them. In fact I don't think your check needs a `FunctionDecl`, it seems like it only checks for attributes which can be done for any `Decl`.

However, in #110523 we add support for attributes on parameters. So we might also turn `checkMismatchedFunctionAttrs` into a template that can handle both kinds of declarations.

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


More information about the cfe-commits mailing list