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 | da488a65e2239c568b3994d69537f13c719822ad (patch) | |
| tree | 9154d00395ada8778a16940f99416520b50c3797 /clang/docs/LibASTMatchersReference.html | |
| parent | eb5bfd9889ce9c35fba7bfd71df50c3424647d0e (diff) | |
| download | bcm5719-llvm-da488a65e2239c568b3994d69537f13c719822ad.tar.gz bcm5719-llvm-da488a65e2239c568b3994d69537f13c719822ad.zip | |
[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.
llvm-svn: 318909
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
| -rw-r--r-- | clang/docs/LibASTMatchersReference.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index e82bc3e5dc3..bcd236adf5d 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/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. |

