Clang-tidy matcher for pointers of a given type


I am trying to create a matcher that finds all declared objects of a given class name. So far I managed to create these matchers:

 Finder->addMatcher(varDecl(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(superClassNames))))).bind("qWidgetVar"), this);
  Finder->addMatcher(fieldDecl(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(superClassNames))))).bind("qWidgetField"), this);

The problem I am encountering is that for pointers to objects of the classes I’m interested in these checkers don’t work. I tried different matchers but I couldn’t get it working. An example of what I’m struggling with:

class InterestingClass

InterestingClass interestingClassVar; // works
InterestingClass* interestingClassPtrVar; // doesn't work

class DerivedInterestingClass : public InterestingClass

DerivedInterestingClass derivedInterestingClassVar; // works
DerivedInterestingClass* derivedInterestingClassVarPtr; // doesn't work

Any ideas for a matcher that does the trick?