diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2019-08-22 18:26:44 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2019-08-22 18:26:44 +0000 |
| commit | 9148302a2ae5ac6e5d69ae84042361889247ce64 (patch) | |
| tree | f38bc304f7fde8c0763faa38249d08ee3631fb0b /clang | |
| parent | ed184b03d252835f27f3eb6fe81af9468618f5b6 (diff) | |
| download | bcm5719-llvm-9148302a2ae5ac6e5d69ae84042361889247ce64.tar.gz bcm5719-llvm-9148302a2ae5ac6e5d69ae84042361889247ce64.zip | |
Implement nullPointerConstant() using a better API.
Instead of manually attempting to identify whether something is a null pointer constant, use Expr::isNullPointerConstant().
llvm-svn: 369683
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/ASTMatchers/ASTMatchers.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 909e4d29fb2..e34b31cbda8 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -6445,10 +6445,9 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr> /// expr(nullPointerConstant()) /// matches the initializer for v1, v2, v3, cp, and ip. Does not match the /// initializer for i. -AST_MATCHER_FUNCTION(internal::Matcher<Expr>, nullPointerConstant) { - return anyOf( - gnuNullExpr(), cxxNullPtrLiteralExpr(), - integerLiteral(equals(0), hasParent(expr(hasType(pointerType()))))); +AST_MATCHER(Expr, nullPointerConstant) { + return Node.isNullPointerConstant(Finder->getASTContext(), + Expr::NPC_ValueDependentIsNull); } /// Matches declaration of the function the statement belongs to |

