aaron.ballman added a comment. Aside from the question about member function references and whether those should or should not be matched, I think this LGTM.
================ Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6361-6362 +/// \endcode +/// qualifiedTypeLoc(hasUnqualifiedLoc(pointerTypeLoc())) +/// matches the `TypeLoc` of the variable declaration of `x`, but not `y`. +AST_MATCHER_P(QualifiedTypeLoc, hasUnqualifiedLoc, TypeLocMatcher, ---------------- jcking1034 wrote: > aaron.ballman wrote: > > I'm trying to reason my way through this. You want to match a qualified > > type location and `int * const` matches that. Then you want it to match an > > unqualified type loc and `int` matches that. Then it should be a pointer > > type... but `int` does not match that. So I wouldn't expect `x` to be > > matched. What have I misunderstood? > The `hasUnqualifiedLoc` will actually be matched by `int *` (the `*` is part > of the unqualified `TypeLoc`), which will then be a pointer `TypeLoc` that > can be matched by `pointerTypeLoc`. Thus, the `TypeLoc` of `x` should be > matched. > > I just realized that the unit test `BindsToConstVolatilePointerVarDecl` which > covers a similar situation is broken, where the match is producing a false > positive (probably matching some hidden boiler plate code) - I've gone ahead > and fixed the test, which hopefully clarifies things. I'll also add a unit > test for these cases, as well. Ah, okay, I see where my confusion came in then. Thank you for the explanation and the additional unit test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111242/new/ https://reviews.llvm.org/D111242 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits