[PATCH] D111242: Add `TypeLoc`-related matchers.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 6 13:42:31 PDT 2021


ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6400
+/// pointerTypeLoc(hasPointeeLoc(loc(asString("int"))))
+///   matches `int*`.
+AST_MATCHER_P(PointerTypeLoc, hasPointeeLoc, TypeLocMatcher, PointeeMatcher) {
----------------
jcking1034 wrote:
> ymandel wrote:
> > I think `int` not `int*`?
> I think this should be correct. If we were to look at `int** x`, `pointerTypeLoc(hasPointeeLoc(pointerTypeLoc(hasPointeeLoc(loc(asString("int"))))))` will match the whole `TypeLoc` and `pointerTypeLoc(hasPointeeLoc(loc(asString("int"))))` will match `int*`.
Sorry -- misread -- i was focused on the pointee part. you're absolutely right.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111242/new/

https://reviews.llvm.org/D111242



More information about the cfe-commits mailing list