Skip to content

Commit efb594a

Browse files
committed
Adjust matcher usage examples
1 parent e897eb7 commit efb594a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,8 +2768,11 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
27682768
/// Example: Matches all four of the casts in
27692769
/// \code
27702770
/// struct S { virtual void f(); };
2771-
/// void* ptr = dynamic_cast<void*>(reinterpret_cast<S*>(
2772-
/// const_cast<int*>(static_cast<int*>(nullptr))));
2771+
/// S* p = nullptr;
2772+
/// S* ptr1 = static_cast<S*>(p);
2773+
/// S* ptr2 = reinterpret_cast<S*>(p);
2774+
/// S* ptr3 = dynamic_cast<S*>(p);
2775+
/// S* ptr4 = const_cast<S*>(p);
27732776
/// \endcode
27742777
extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNamedCastExpr>
27752778
cxxNamedCastExpr;
@@ -7003,9 +7006,9 @@ extern const internal::VariadicDynCastAllOfMatcher<
70037006
/// Given
70047007
/// \code
70057008
/// using t1 = int;
7006-
/// template <typename T> class C { using t2 = int; };
7009+
/// template <typename T> struct S { using t2 = int; };
70077010
/// t1 var1;
7008-
/// const C<char>::t2* var2;
7011+
/// const S<char>::t2* var2;
70097012
/// \endcode
70107013
/// typedefTypeLoc()
70117014
/// matches `t1` (in the declaration of var1) and `C<char>::t2`.

0 commit comments

Comments
 (0)