diff options
| author | Yitzhak Mandelbaum <yitzhakm@google.com> | 2019-08-08 17:41:44 +0000 |
|---|---|---|
| committer | Yitzhak Mandelbaum <yitzhakm@google.com> | 2019-08-08 17:41:44 +0000 |
| commit | 57f471f4ff431cfc29ea0849a42829cc52e5f40a (patch) | |
| tree | 8a457461e0d6b7f147a537ddac528be0cc23c3e6 /clang/docs/LibASTMatchersReference.html | |
| parent | 8faf2f3c406329323d04513a53c91ea07be80ac2 (diff) | |
| download | bcm5719-llvm-57f471f4ff431cfc29ea0849a42829cc52e5f40a.tar.gz bcm5719-llvm-57f471f4ff431cfc29ea0849a42829cc52e5f40a.zip | |
[clang] Update `ignoringElidableConstructorCall` matcher to ignore `ExprWithCleanups`.
Summary:
The `ExprWithCleanups` node is added to the AST along with the elidable
CXXConstructExpr. If it is the outermost node of the node being matched, ignore
it as well.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65944
llvm-svn: 368319
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
| -rw-r--r-- | clang/docs/LibASTMatchersReference.html | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 31f71b76ae0..68d536a0704 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -5805,14 +5805,15 @@ Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X"))))) <tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('ignoringElidableConstructorCall0')"><a name="ignoringElidableConstructorCall0Anchor">ignoringElidableConstructorCall</a></td><td>ast_matchers::Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="ignoringElidableConstructorCall0"><pre>Matches expressions that match InnerMatcher that are possibly wrapped in an -elidable constructor. +elidable constructor and other corresponding bookkeeping nodes. -In C++17 copy elidable constructors are no longer being -generated in the AST as it is not permitted by the standard. They are -however part of the AST in C++14 and earlier. Therefore, to write a matcher -that works in all language modes, the matcher has to skip elidable -constructor AST nodes if they appear in the AST. This matcher can be used to -skip those elidable constructors. +In C++17, elidable copy constructors are no longer being generated in the +AST as it is not permitted by the standard. They are, however, part of the +AST in C++14 and earlier. So, a matcher must abstract over these differences +to work in all language modes. This matcher skips elidable constructor-call +AST nodes, `ExprWithCleanups` nodes wrapping elidable constructor-calls and +various implicit nodes inside the constructor calls, all of which will not +appear in the C++17 AST. Given @@ -5822,10 +5823,8 @@ void f() { H D = G(); } -``varDecl(hasInitializer(any( - ignoringElidableConstructorCall(callExpr()), - exprWithCleanups(ignoringElidableConstructorCall(callExpr()))))`` -matches ``H D = G()`` +``varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))`` +matches ``H D = G()`` in C++11 through C++17 (and beyond). </pre></td></tr> |

