[PATCH] D56850: [ASTMatchers][NFC] Add tests for assorted `CXXMemberCallExpr` matchers.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 22 08:50:06 PST 2019
ymandel added inline comments.
================
Comment at: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:558
+ int m;
+ int f(X x) { return m; }
+ };
----------------
steveire wrote:
> Are we missing a matcher that would reach the type of X in this case? `hasImplicitObjectExpression`, or something equivalent?
Good question. The reason we're not reaching `X` in this case is that we're distinguishing between `T` and `T*` (like `thisPointerType` does). That's separate from the difference between `on` and `onImplicitObjectArgument`. So, I think we'll at least want a matcher that elides this difference, e.g.
`hasObjectType`.
I'm less inclined to add matchers that distinguish the written from the coerced member expression (one variant each for the expression and type matchers) given that I think this issue comes up far less for member expressions that don't involve calls. I'm just afraid that the proliferation of matchers might confuse beginners.
Note that I extended the test to include the hasPointerType() case (especially since it's now mentioned in the comments).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56850/new/
https://reviews.llvm.org/D56850
More information about the cfe-commits
mailing list