aboutsummaryrefslogtreecommitdiff
path: root/include/clang/ASTMatchers/ASTMatchers.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
commit6a0372513edbc473b538d2f724efac50405d6fef (patch)
tree8f7776b7310bebaf415ac5b69e46e9f928c37144 /include/clang/ASTMatchers/ASTMatchers.h
parent809500fc2c13c8173a16b052304d983864e4a1e1 (diff)
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3vendor/clang/clang-release_33-r183502
Notes
Notes: svn path=/vendor/clang/dist/; revision=251609 svn path=/vendor/clang/clang-release_33-r183502/; revision=251610; tag=vendor/clang/clang-release_33-r183502
Diffstat (limited to 'include/clang/ASTMatchers/ASTMatchers.h')
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index f10addcb7af6..ab62dd0c3e81 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -129,7 +129,8 @@ typedef internal::Matcher<NestedNameSpecifierLoc> NestedNameSpecifierLocMatcher;
/// \endcode
///
/// Usable as: Any Matcher
-inline internal::PolymorphicMatcherWithParam0<internal::TrueMatcher> anything() {
+inline internal::PolymorphicMatcherWithParam0<internal::TrueMatcher>
+anything() {
return internal::PolymorphicMatcherWithParam0<internal::TrueMatcher>();
}
@@ -157,6 +158,17 @@ const internal::VariadicAllOfMatcher<Decl> decl;
/// \endcode
const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
+/// \brief Matches a declaration of a namespace.
+///
+/// Given
+/// \code
+/// namespace {}
+/// namespace test {}
+/// \endcode
+/// namespaceDecl()
+/// matches "namespace {}" and "namespace test {}"
+const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl;
+
/// \brief Matches C++ class declarations.
///
/// Example matches \c X, \c Z
@@ -2514,6 +2526,38 @@ AST_MATCHER_P(CXXMethodDecl, ofClass,
InnerMatcher.matches(*Parent, Finder, Builder));
}
+/// \brief Matches if the given method declaration is virtual.
+///
+/// Given
+/// \code
+/// class A {
+/// public:
+/// virtual void x();
+/// };
+/// \endcode
+/// matches A::x
+AST_MATCHER(CXXMethodDecl, isVirtual) {
+ return Node.isVirtual();
+}
+
+/// \brief Matches if the given method declaration overrides another method.
+///
+/// Given
+/// \code
+/// class A {
+/// public:
+/// virtual void x();
+/// };
+/// class B : public A {
+/// public:
+/// virtual void x();
+/// };
+/// \endcode
+/// matches B::x
+AST_MATCHER(CXXMethodDecl, isOverride) {
+ return Node.size_overridden_methods() > 0;
+}
+
/// \brief Matches member expressions that are called with '->' as opposed
/// to '.'.
///