diff options
Diffstat (limited to 'include/clang/ASTMatchers/ASTMatchers.h')
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchers.h | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index 6a5224febab5..fb029470c830 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -180,6 +180,16 @@ const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl> /// matches "using Y = int", but not "typedef int X" const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl; +/// \brief Matches type alias template declarations. +/// +/// typeAliasTemplateDecl() matches +/// \code +/// template <typename T> +/// using Y = X<T>; +/// \endcode +const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl> + typeAliasTemplateDecl; + /// \brief Matches AST nodes that were expanded within the main-file. /// /// Example matches X but not Y @@ -1118,6 +1128,69 @@ const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl> objcInterfaceDecl; +/// \brief Matches Objective-C protocol declarations. +/// +/// Example matches FooDelegate +/// \code +/// @protocol FooDelegate +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCProtocolDecl> objcProtocolDecl; + +/// \brief Matches Objective-C category declarations. +/// +/// Example matches Foo (Additions) +/// \code +/// @interface Foo (Additions) +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCCategoryDecl> objcCategoryDecl; + +/// \brief Matches Objective-C method declarations. +/// +/// Example matches both declaration and definition of -[Foo method] +/// \code +/// @interface Foo +/// - (void)method; +/// @end +/// +/// @implementation Foo +/// - (void)method {} +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCMethodDecl> objcMethodDecl; + +/// \brief Matches Objective-C instance variable declarations. +/// +/// Example matches _enabled +/// \code +/// @implementation Foo { +/// BOOL _enabled; +/// } +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCIvarDecl> objcIvarDecl; + +/// \brief Matches Objective-C property declarations. +/// +/// Example matches enabled +/// \code +/// @interface Foo +/// @property BOOL enabled; +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCPropertyDecl> objcPropertyDecl; + /// \brief Matches expressions that introduce cleanups to be run at the end /// of the sub-expression's evaluation. /// @@ -2522,7 +2595,7 @@ AST_MATCHER_P(CXXMemberCallExpr, on, internal::Matcher<Expr>, /// \brief Matches on the receiver of an ObjectiveC Message expression. /// /// Example -/// matcher = objCMessageExpr(hasRecieverType(asString("UIWebView *"))); +/// matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *"))); /// matches the [webView ...] message invocation. /// \code /// NSString *webViewJavaScript = ... @@ -5507,7 +5580,7 @@ AST_MATCHER_FUNCTION(internal::Matcher<Expr>, nullPointerConstant) { integerLiteral(equals(0), hasParent(expr(hasType(pointerType()))))); } -/// \brief Matches declaration of the function the statemenet belongs to +/// \brief Matches declaration of the function the statement belongs to /// /// Given: /// \code |