diff options
author | Adam Balogh <adam.balogh@ericsson.com> | 2017-11-23 12:43:20 +0000 |
---|---|---|
committer | Adam Balogh <adam.balogh@ericsson.com> | 2017-11-23 12:43:20 +0000 |
commit | be065bce297cc2dd2773caf4346c218d04492913 (patch) | |
tree | 35e24f0b6e4e31add4e8e5ba5309932445289525 /docs | |
parent | 6428eaf621c44d0cf2c16536e6e28c796feed958 (diff) |
[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
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LibASTMatchersReference.html | 20 |
1 files changed, 20 insertions, 0 deletions
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 </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>></td><td class="name" onclick="toggle('isArray0')"><a name="isArray0Anchor">isArray</a></td><td></td></tr> +<tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions. + +Given: + MyClass *p1 = new MyClass[10]; +cxxNewExpr(isArray()) + matches the expression 'new MyClass[10]'. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>></td><td class="name" onclick="toggle('hasOverloadedOperatorName1')"><a name="hasOverloadedOperatorName1Anchor">hasOverloadedOperatorName</a></td><td>StringRef Name</td></tr> <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names. @@ -4476,6 +4486,16 @@ Example matches A() in the last line </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>></td><td class="name" onclick="toggle('hasArraySize0')"><a name="hasArraySize0Anchor">hasArraySize</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> +<tr><td colspan="4" class="doc" id="hasArraySize0"><pre>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]'. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>></td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node matches the given matcher. |