Skip to content

Commit 55076a2

Browse files
fubowenflovent
authored andcommitted
don't traverse all DeclRefEx[r
1 parent 5b8b6d4 commit 55076a2

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ AST_MATCHER(CXXMethodDecl, usesThis) {
6262
return false; // Stop traversal.
6363
}
6464

65-
bool VisitDeclRefExpr(const DeclRefExpr *E) {
66-
if (const auto *PVD = dyn_cast_if_present<ParmVarDecl>(E->getDecl());
67-
PVD && PVD->isExplicitObjectParameter()) {
68-
Used = true;
69-
return false; // Stop traversal.
70-
}
71-
72-
return true;
73-
}
74-
7565
// If we enter a class declaration, don't traverse into it as any usages of
7666
// `this` will correspond to the nested class.
7767
bool TraverseCXXRecordDecl(CXXRecordDecl *RD) { return true; }
@@ -89,10 +79,10 @@ void ConvertMemberFunctionsToStatic::registerMatchers(MatchFinder *Finder) {
8979
cxxMethodDecl(
9080
isDefinition(), isUserProvided(),
9181
unless(anyOf(
92-
isExpansionInSystemHeader(), isVirtual(), isStatic(),
93-
hasTrivialBody(), isOverloadedOperator(), cxxConstructorDecl(),
94-
cxxDestructorDecl(), cxxConversionDecl(), isTemplate(),
95-
isDependentContext(),
82+
isExplicitObjectMemberFunction(), isExpansionInSystemHeader(),
83+
isVirtual(), isStatic(), hasTrivialBody(), isOverloadedOperator(),
84+
cxxConstructorDecl(), cxxDestructorDecl(), cxxConversionDecl(),
85+
isTemplate(), isDependentContext(),
9686
ofClass(anyOf(
9787
isLambda(),
9888
hasAnyDependentBases()) // Method might become virtual

0 commit comments

Comments
 (0)