Add tests for matchers on, onImplicitObjectArgument and hasObjectExpression.
Details
- Reviewers
alexfh steveire aaron.ballman - Commits
- rC354134: Added test for matcher On.
rL354134: Added test for matcher On.
rGe1f0a0e759d4: Added test for matcher On.
rC354135: Remove unnecessary expectation.
rL354135: Remove unnecessary expectation.
rGc11f0743231a: Remove unnecessary expectation.
rL354136: Exteded test of .
rC354136: Exteded test of .
rG5dfddff2424c: Exteded test of .
rG1a8b6ff528ed: Add tests for assorted `CXXMemberCallExpr` matchers.
rC354133: Add tests for assorted `CXXMemberCallExpr` matchers.
rL354133: Add tests for assorted `CXXMemberCallExpr` matchers.
Diff Detail
- Repository
- rL LLVM
Event Timeline
Please always subscribe lists.
The reviews that happen without lists are null and void.
Is this testing pre-existing behavior, and thus NFC?
Thanks for updating my diffs with the relevant list. Noted for next time.
Is this testing pre-existing behavior, and thus NFC?
Yes.
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp | ||
---|---|---|
475 ↗ | (On Diff #182262) | Could you add a test which uses the same c++ snippet as this, but with a matcher using hasName("Y")? |
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp | ||
---|---|---|
475 ↗ | (On Diff #182262) | Good suggestion -- this caught a mistake in the comments. I'll update the other diff to reflect. |
Thanks, do you need someone to commit this for you?
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp | ||
---|---|---|
492 ↗ | (On Diff #182295) | In the OnImplicitObjectArgument test, you don't check snippet 1 because it has no X. This line is probably not needed. |
558 ↗ | (On Diff #182295) | Are we missing a matcher that would reach the type of X in this case? hasImplicitObjectExpression, or something equivalent? |
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp | ||
---|---|---|
558 ↗ | (On Diff #182295) | 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. 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). |
This broke compilation with GCC 5.4 on Ubuntu 16.04:
../tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:474:243: warning: missing terminating " character ../tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:474:3: error: missing terminating " character EXPECT_TRUE(matches( ^ ../tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:480:7: error: stray ‘\’ in program void z(X x) { x.m(); } ^