[PATCH] D82279: Handle invalid types in the nullPointerConstant AST matcher

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 04:16:14 PDT 2020


aaron.ballman marked an inline comment as done.
aaron.ballman added inline comments.


================
Comment at: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp:2618
+  )";
+  EXPECT_TRUE(matches(kTest, expr(nullPointerConstant())));
 }
----------------
steveire wrote:
> While this test in ASTMatchers might continue to make sense, shouldn't there be a test in `clang/unittests/AST` for this API? `isNullPointerConstant` seems to be complicated. Does it have a unit test?
> While this test in ASTMatchers might continue to make sense, shouldn't there be a test in clang/unittests/AST for this API? isNullPointerConstant seems to be complicated. Does it have a unit test?

It does not have a unit test; we don't usually unit test AST interfaces directly. AST matching tests are the typical way we'd test this because it gives us an almost direct path to the AST interface we want to exercise, but if you can spot an additional place to perform the test more directly, I can look into adding one.


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

https://reviews.llvm.org/D82279





More information about the cfe-commits mailing list