If I read the documentation at http://clang.llvm.org/docs/LibASTMatchersReference.html correctly, the partial matcher “hasType(qualType(…))” is not legal.
I ask because I’ve seen it used several times, it’s an example in the documentation for “isCanonicalType” (see below), and I’m wrapping the ASTMatcher library in my Common Lisp environment to write refactoring tools in Common Lisp and I’ve used the documentation at http://clang.llvm.org/docs/LibASTMatchersReference.html to define what matchers are legal and which are not.
I think I need to use hasType(qualType(…)) for a matcher that I’m writing and I need to figure out how to work it into my rules.
isCanonicalType documentation follows
Matches QualTypes whose canonical type matches InnerMatcher.
Given:
typedef int &int_ref;
int a;
int_ref b = a;
varDecl(hasType(qualType(referenceType()))))) will not match the
declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
The predicate hasType(…) requires a Matcher as the inner matcher and qualType(…) is of type Matcher, not Matcher.
Any insight that anyone can provide would be very helpful.
Best,
Christian Schafmeister
Associate Professor
Chemistry Department
Temple University