[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.

llvm-svn: 356677
This commit is contained in:
Roman Lebedev 2019-03-21 15:33:43 +00:00
parent c816195759
commit 408eb44f49
2 changed files with 12 additions and 0 deletions

View File

@ -2640,6 +2640,9 @@ Example matches y(x) but not y(42) or NS::y(x).
Example: matches the implicit cast around 0 Example: matches the implicit cast around 0
(matcher = castExpr(hasCastKind(CK_NullToPointer))) (matcher = castExpr(hasCastKind(CK_NullToPointer)))
int *p = 0; 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> </pre></td></tr>
@ -4086,6 +4089,9 @@ Given
int s = sizeof(x) + alignof(x) int s = sizeof(x) + alignof(x)
unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf)) unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
matches sizeof(x) 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> </pre></td></tr>

View File

@ -2492,6 +2492,9 @@ AST_MATCHER_P(UnaryExprOrTypeTraitExpr, hasArgumentOfType,
/// \endcode /// \endcode
/// unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf)) /// unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
/// matches \c sizeof(x) /// 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) { AST_MATCHER_P(UnaryExprOrTypeTraitExpr, ofKind, UnaryExprOrTypeTrait, Kind) {
return Node.getKind() == Kind; return Node.getKind() == Kind;
} }
@ -4483,6 +4486,9 @@ AST_POLYMORPHIC_MATCHER_P(hasSourceExpression,
/// \code /// \code
/// int *p = 0; /// int *p = 0;
/// \endcode /// \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) { AST_MATCHER_P(CastExpr, hasCastKind, CastKind, Kind) {
return Node.getCastKind() == Kind; return Node.getCastKind() == Kind;
} }