From be065bce297cc2dd2773caf4346c218d04492913 Mon Sep 17 00:00:00 2001 From: Adam Balogh Date: Thu, 23 Nov 2017 12:43:20 +0000 Subject: [ASTMatchers] Matchers for new[] operators Two new matchers for `CXXNewExpr` are added which may be useful e.g. in `clang-tidy` checkers. One of them is `isArray` which matches `new[]` but not plain `new`. The other one, `hasArraySize` matches `new[]` for a given size. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318909 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LibASTMatchersReference.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'docs') diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index e82bc3e5dc..bcd236adf5 100644 --- a/docs/LibASTMatchersReference.html +++ b/docs/LibASTMatchersReference.html @@ -2276,6 +2276,16 @@ Given +Matcher<CXXNewExpr>isArray +
Matches array new expressions.
+
+Given:
+  MyClass *p1 = new MyClass[10];
+cxxNewExpr(isArray())
+  matches the expression 'new MyClass[10]'.
+
+ + Matcher<CXXOperatorCallExpr>hasOverloadedOperatorNameStringRef Name
Matches overloaded operator names.
 
@@ -4476,6 +4486,16 @@ Example matches A() in the last line
 
+Matcher<CXXNewExpr>hasArraySizeMatcher<Expr> InnerMatcher +
Matches array new expressions with a given array size.
+
+Given:
+  MyClass *p1 = new MyClass[10];
+cxxNewExpr(hasArraySize(intgerLiteral(equals(10))))
+  matches the expression 'new MyClass[10]'.
+
+ + Matcher<CXXNewExpr>hasDeclarationMatcher<Decl> InnerMatcher
Matches a node if the declaration associated with that node
 matches the given matcher.
-- 
cgit v1.2.3