1515#include " clang/ASTMatchers/ASTMatchFinder.h"
1616#include " clang/ASTMatchers/ASTMatchers.h"
1717#include " clang/ASTMatchers/ASTMatchersMacros.h"
18+ #include " clang/Basic/LangOptions.h"
1819
1920using namespace clang ::ast_matchers;
2021using namespace clang ::tidy::matchers;
@@ -29,9 +30,10 @@ static constexpr StringRef DefaultIncludeTypeRegex =
2930
3031AST_MATCHER (VarDecl, isLocalVarDecl) { return Node.isLocalVarDecl (); }
3132AST_MATCHER (VarDecl, isReferenced) { return Node.isReferenced (); }
32- AST_MATCHER_P (VarDecl, explicitMarkUnused, LangOptions, LangOpts ) {
33+ AST_MATCHER (VarDecl, explicitMarkUnused) {
3334 // Implementations should not emit a warning that a name-independent
3435 // declaration is used or unused.
36+ LangOptions const &LangOpts = Finder->getASTContext ().getLangOpts ();
3537 return Node.hasAttr <UnusedAttr>() ||
3638 (LangOpts.CPlusPlus26 && Node.isPlaceholderVar (LangOpts));
3739}
@@ -66,7 +68,7 @@ void UnusedLocalNonTrivialVariableCheck::registerMatchers(MatchFinder *Finder) {
6668 varDecl (isLocalVarDecl (), unless (isReferenced ()),
6769 unless (isExceptionVariable ()), hasLocalStorage (), isDefinition (),
6870 unless (hasType (isReferenceType ())), unless (hasType (isTrivial ())),
69- unless (explicitMarkUnused (getLangOpts () )),
71+ unless (explicitMarkUnused ()),
7072 hasType (hasUnqualifiedDesugaredType (
7173 anyOf (recordType (hasDeclaration (namedDecl (
7274 matchesAnyListedName (IncludeTypes),
0 commit comments