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 | cf97c2e1f4398d1e14c0174722fdf5711563b7c3 (patch) | |
tree | bd266b0fd2c275365b9958493e1c71c8b456d5ac /docs | |
parent | 58cb9c6941e2cc1d8d44eba3f8dcf1d659e6de82 (diff) | |
download | clang-cf97c2e1f4398d1e14c0174722fdf5711563b7c3.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LibASTMatchersReference.html | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index 31f71b76ae..68d536a070 100644 --- a/docs/LibASTMatchersReference.html +++ b/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> |