[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 9 09:36:52 PST 2025
================
@@ -26,6 +29,17 @@ bool isOverrideMethod(const FunctionDecl *Function) {
return MD->size_overridden_methods() > 0 || MD->hasAttr<OverrideAttr>();
return false;
}
+
+bool hasAttrAfterParam(const SourceManager *SourceManager,
+ const ParmVarDecl *Param) {
+ for (const auto *Attr : Param->attrs()) {
+ if (SourceManager->isBeforeInTranslationUnit(Param->getLocation(),
+ Attr->getLocation())) {
+ return true;
+ }
+ }
+ return false;
+}
----------------
usx95 wrote:
The behaviour seems correct then. Please add this test case in the tests.
`isBeforeInTranslationUnit` seems to be the correct function here.
https://github.com/llvm/llvm-project/pull/122286
More information about the cfe-commits
mailing list