Currently, using the nullPointerConstant AST matcher can lead to assertions in situations where a node to be matched does not have a valid type associated with it, such as a ParenListExpr. This patch addresses that by saying such nodes cannot be a null pointer constant. This addresses PR46353.
Diff Detail
Event Timeline
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
---|---|---|
2618 | 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? |
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
---|---|---|
2618 |
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. |
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
---|---|---|
2618 | Fair enough! |
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?