Fixes PR26740.
Details
Diff Detail
Event Timeline
clang-tidy/misc/UnusedParametersCheck.cpp | ||
---|---|---|
20 | There's a matcher for this: isOverride. |
clang-tidy/misc/UnusedParametersCheck.cpp | ||
---|---|---|
81 | I meant, you can use it inside UsedByRef. |
clang-tidy/misc/UnusedParametersCheck.cpp | ||
---|---|---|
81 | Looks like we can't make it in UsedByRef. The ast_matchers::match argument passed in UsedByRef is a TranslationUnitDecl type, which isn't used to match CXXMethodDecl. the code below is always true: ast_matchers::match( cxxMethodDecl(isOverride()), *Result.Context->getTranslationUnitDecl(), *Result.Context).empty() |
clang-tidy/misc/UnusedParametersCheck.cpp | ||
---|---|---|
72–73 | It looks like the two-parameter ast_matchers::match function would be better here (and it will allow to get rid of the decl(hasDescendant( part). Something like this: return !ast_matchers::match(declRefExpr(...), *Result.Context).empty(); | |
81 | That's why I don't like default lambda captures: They make it totally unclear which actual parameters the lambda accepts. Then the initial solution looks better than the current one using ast_matchers::match. Sorry for the noise. |
clang-tidy/misc/UnusedParametersCheck.cpp | ||
---|---|---|
72–73 | Done. I also removed this lambda function. |
clang-tidy/misc/UnusedParametersCheck.cpp | ||
---|---|---|
80–81 | nit: Please update formatting. |
There's a matcher for this: isOverride.