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

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 14:24:00 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>


================
@@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D,
       RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size());
 
   D->addAttr(RCA);
+
+  if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+
+    auto collectExprs = [](const FunctionDecl *FuncDecl) {
+      std::set<const ValueDecl*> Args;
----------------
aaronpuchert wrote:

If we compare expressions, we might even require them to be in the same order. Because otherwise we need to check every expression against every expression on the other side.

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


More information about the cfe-commits mailing list