diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2017-03-15 20:14:25 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2017-03-15 20:14:25 +0000 |
commit | 219029ad97df7d75a12bdc390877379e72b463b5 (patch) | |
tree | 811cab76968c17cc5ec9472eb9794d01e008acce /include/clang/ASTMatchers | |
parent | 023b8ac9959be26fa8ad4e898fb583bcb179c78e (diff) |
Add AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ObjCIvarDecl, and ObjCPropertyDecl.
Patch by Dave Lee.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/ASTMatchers')
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchers.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index 6c1c8e4428..1f11c71cf8 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -1118,6 +1118,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. /// |