r356677 - [ASTMatcher] Add clang-query disclaimer to two more matchers that take enum
Roman Lebedev via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 21 08:33:44 PDT 2019
Author: lebedevri
Date: Thu Mar 21 08:33:43 2019
New Revision: 356677
URL: http://llvm.org/viewvc/llvm-project?rev=356677&view=rev
Log:
[ASTMatcher] Add clang-query disclaimer to two more matchers that take enum
As we have figured out in
https://reviews.llvm.org/D57112
and
https://bugs.llvm.org/show_bug.cgi?id=41176
this kind-of works, but needs special care.
Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=356677&r1=356676&r2=356677&view=diff
==============================================================================
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Thu Mar 21 08:33:43 2019
@@ -2640,6 +2640,9 @@ Example matches y(x) but not y(42) or NS
Example: matches the implicit cast around 0
(matcher = castExpr(hasCastKind(CK_NullToPointer)))
int *p = 0;
+
+If the matcher is use from clang-query, CastKind parameter
+should be passed as a quoted string. e.g., ofKind("CK_NullToPointer").
</pre></td></tr>
@@ -4086,6 +4089,9 @@ Given
int s = sizeof(x) + alignof(x)
unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
matches sizeof(x)
+
+If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter
+should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
</pre></td></tr>
Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=356677&r1=356676&r2=356677&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Thu Mar 21 08:33:43 2019
@@ -2492,6 +2492,9 @@ AST_MATCHER_P(UnaryExprOrTypeTraitExpr,
/// \endcode
/// unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
/// matches \c sizeof(x)
+///
+/// If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter
+/// should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
AST_MATCHER_P(UnaryExprOrTypeTraitExpr, ofKind, UnaryExprOrTypeTrait, Kind) {
return Node.getKind() == Kind;
}
@@ -4483,6 +4486,9 @@ AST_POLYMORPHIC_MATCHER_P(hasSourceExpre
/// \code
/// int *p = 0;
/// \endcode
+///
+/// If the matcher is use from clang-query, CastKind parameter
+/// should be passed as a quoted string. e.g., ofKind("CK_NullToPointer").
AST_MATCHER_P(CastExpr, hasCastKind, CastKind, Kind) {
return Node.getCastKind() == Kind;
}
More information about the cfe-commits
mailing list