diff options
author | Gauthier Harnisch <tyker1@outlook.com> | 2019-06-19 18:27:56 +0000 |
---|---|---|
committer | Gauthier Harnisch <tyker1@outlook.com> | 2019-06-19 18:27:56 +0000 |
commit | e1f4ba85e5c206011b316d3fc571eb8e7a9510c6 (patch) | |
tree | 7df41d57684241d90cd3d6e18bff8347ca001985 /clang/docs/LibASTMatchersReference.html | |
parent | 61d7e35b22bd544a9acb4bfb4b14be1a593b3a3d (diff) | |
download | bcm5719-llvm-e1f4ba85e5c206011b316d3fc571eb8e7a9510c6.tar.gz bcm5719-llvm-e1f4ba85e5c206011b316d3fc571eb8e7a9510c6.zip |
[clang] Adapt ASTMatcher to explicit(bool) specifier
Summary:
Changes:
- add an ast matcher for deductiong guide.
- allow isExplicit matcher for deductiong guide.
- add hasExplicitSpecifier matcher which give access to the expression of the explicit specifier if present.
Reviewers: klimek, rsmith, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: aaron.ballman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61552
llvm-svn: 363855
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
-rw-r--r-- | clang/docs/LibASTMatchersReference.html | 85 |
1 files changed, 79 insertions, 6 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 47f2c8a489e..c93394096f2 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -194,6 +194,16 @@ Example matches the operator. </pre></td></tr> +<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('cxxDeductionGuideDecl0')"><a name="cxxDeductionGuideDecl0Anchor">cxxDeductionGuideDecl</a></td><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDeductionGuideDecl.html">CXXDeductionGuideDecl</a>>...</td></tr> +<tr><td colspan="4" class="doc" id="cxxDeductionGuideDecl0"><pre>Matches user-defined and implicitly generated deduction guide. + +Example matches the deduction guide. + template<typename T> + class X { X(int) }; + X(int) -> X<int>; +</pre></td></tr> + + <tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('cxxDestructorDecl0')"><a name="cxxDestructorDecl0Anchor">cxxDestructorDecl</a></td><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDestructorDecl.html">CXXDestructorDecl</a>>...</td></tr> <tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations. @@ -2222,18 +2232,26 @@ cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not <tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>></td><td class="name" onclick="toggle('isExplicit0')"><a name="isExplicit0Anchor">isExplicit</a></td><td></td></tr> -<tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor and conversion declarations that are marked with -the explicit keyword. +<tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor, conversion function, and deduction guide declarations +that have an explicit specifier if this explicit specifier is resolved to +true. Given + template<bool b> struct S { S(int); // #1 explicit S(double); // #2 operator int(); // #3 explicit operator bool(); // #4 + explicit(false) S(bool) // # 7 + explicit(true) S(char) // # 8 + explicit(b) S(S) // # 9 }; -cxxConstructorDecl(isExplicit()) will match #2, but not #1. + S(int) -> S<true> // #5 + explicit S(double) -> S<false> // #6 +cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. cxxConversionDecl(isExplicit()) will match #4, but not #3. +cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5. </pre></td></tr> @@ -2251,18 +2269,26 @@ cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2. <tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConversionDecl.html">CXXConversionDecl</a>></td><td class="name" onclick="toggle('isExplicit1')"><a name="isExplicit1Anchor">isExplicit</a></td><td></td></tr> -<tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor and conversion declarations that are marked with -the explicit keyword. +<tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor, conversion function, and deduction guide declarations +that have an explicit specifier if this explicit specifier is resolved to +true. Given + template<bool b> struct S { S(int); // #1 explicit S(double); // #2 operator int(); // #3 explicit operator bool(); // #4 + explicit(false) S(bool) // # 7 + explicit(true) S(char) // # 8 + explicit(b) S(S) // # 9 }; -cxxConstructorDecl(isExplicit()) will match #2, but not #1. + S(int) -> S<true> // #5 + explicit S(double) -> S<false> // #6 +cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. cxxConversionDecl(isExplicit()) will match #4, but not #3. +cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5. </pre></td></tr> @@ -2317,6 +2343,30 @@ cxxConstructorDecl(hasAnyConstructorInitializer(isWritten())) </pre></td></tr> +<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDeductionGuideDecl.html">CXXDeductionGuideDecl</a>></td><td class="name" onclick="toggle('isExplicit2')"><a name="isExplicit2Anchor">isExplicit</a></td><td></td></tr> +<tr><td colspan="4" class="doc" id="isExplicit2"><pre>Matches constructor, conversion function, and deduction guide declarations +that have an explicit specifier if this explicit specifier is resolved to +true. + +Given + template<bool b> + struct S { + S(int); // #1 + explicit S(double); // #2 + operator int(); // #3 + explicit operator bool(); // #4 + explicit(false) S(bool) // # 7 + explicit(true) S(char) // # 8 + explicit(b) S(S) // # 9 + }; + S(int) -> S<true> // #5 + explicit S(double) -> S<false> // #6 +cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. +cxxConversionDecl(isExplicit()) will match #4, but not #3. +cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5. +</pre></td></tr> + + <tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>></td><td class="name" onclick="toggle('isArrow2')"><a name="isArrow2Anchor">isArrow</a></td><td></td></tr> <tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '->' as opposed to '.'. @@ -6007,6 +6057,29 @@ with compoundStmt() </pre></td></tr> +<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('hasExplicitSpecifier0')"><a name="hasExplicitSpecifier0Anchor">hasExplicitSpecifier</a></td><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> +<tr><td colspan="4" class="doc" id="hasExplicitSpecifier0"><pre>Matches the expression in an explicit specifier if present in the given +declaration. + +Given + template<bool b> + struct S { + S(int); // #1 + explicit S(double); // #2 + operator int(); // #3 + explicit operator bool(); // #4 + explicit(false) S(bool) // # 7 + explicit(true) S(char) // # 8 + explicit(b) S(S) // # 9 + }; + S(int) -> S<true> // #5 + explicit S(double) -> S<false> // #6 +cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2. +cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4. +cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6. +</pre></td></tr> + + <tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('hasParameter0')"><a name="hasParameter0Anchor">hasParameter</a></td><td>unsigned N, Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method declaration or a block. |