[PATCH] D73562: [ASTMatchers] Add isPlacement traversal matcher for CXXNewExpr
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 13:11:11 PST 2020
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6763
+/// matches the expression 'new (Storage) MyClass()'.
+AST_MATCHER(CXXNewExpr, isPlacement) { return Node.getNumPlacementArgs() > 0; }
+
----------------
I think a better design would be something like `hasPlacementExpr()` as a traversal matcher. Then `isPlacement()` can be trivially done in the project as `hasPlacementExpr(anything())` (we could still consider adding it as a dedicated matcher, but it doesn't seem critical to me), but this would also allow people to check for specific placement new argument expressions.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73562/new/
https://reviews.llvm.org/D73562
More information about the cfe-commits
mailing list