aaron.ballman added a comment.

Thanks for the fix! Can you be sure to add test coverage for both clang-tidy 
and Clang to demonstrate the behavior change?



================
Comment at: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp:35
   Finder->addMatcher(
       functionDecl(isDefinition(), hasBody(stmt()), hasAnyParameter(decl()))
           .bind("function"),
----------------
Something along these lines should work instead (you'll have to reformat 
though).


================
Comment at: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp:177-180
+  if (Function->hasAttrs())
+    for (const clang::Attr *A : Function->getAttrs())
+      if (A->getParsedKind() == Attr::AT_Naked)
+        return;
----------------
I think this should be done using matchers instead of from `check()` if 
possible so that we get better memoization. See comment above.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:14635-14645
+        bool FDHasNakedAttr{false};
+        if (FD->hasAttrs())
+          for (const clang::Attr *A : FD->getAttrs())
+            if (A->getParsedKind() == Attr::AT_Naked) {
+              FDHasNakedAttr = true;
+              break;
+            }
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116778/new/

https://reviews.llvm.org/D116778

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to