[llvm-branch-commits] [cfe-branch] r159564 - /cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchers.h

Manuel Klimek klimek at google.com
Mon Jul 2 12:43:22 PDT 2012


Author: klimek
Date: Mon Jul  2 14:43:21 2012
New Revision: 159564

URL: http://llvm.org/viewvc/llvm-project?rev=159564&view=rev
Log:
Comment fixes...


Modified:
    cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchers.h

Modified: cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchers.h?rev=159564&r1=159563&r2=159564&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchers.h Mon Jul  2 14:43:21 2012
@@ -14,21 +14,21 @@
 //  a functional in-language DSL to express queries over the C++ AST.
 //
 //  For example, to match a class with a certain name, one would call:
-//    Class(HasName("MyClass"))
+//    record(hasName("MyClass"))
 //  which returns a matcher that can be used to find all AST nodes that declare
 //  a class named 'MyClass'.
 //
 //  For more complicated match expressions we're often interested in accessing
 //  multiple parts of the matched AST nodes once a match is found. In that case,
-//  use the Id(...) matcher around the match expressions that match the nodes
+//  use the id(...) matcher around the match expressions that match the nodes
 //  you want to access.
 //
 //  For example, when we're interested in child classes of a certain class, we
 //  would write:
-//    Class(HasName("MyClass"), HasChild(Id("child", Class())))
+//    record(hasName("MyClass"), hasChild(id("child", record())))
 //  When the match is found via the MatchFinder, a user provided callback will
 //  be called with a BoundNodes instance that contains a mapping from the
-//  strings that we provided for the Id(...) calls to the nodes that were
+//  strings that we provided for the id(...) calls to the nodes that were
 //  matched.
 //  In the given example, each time our matcher finds a match we get a callback
 //  where "child" is bound to the CXXRecordDecl node of the matching child
@@ -54,7 +54,7 @@
 
 /// \brief Maps string IDs to AST nodes matched by parts of a matcher.
 ///
-/// The bound nodes are generated by adding Id(...) matchers into the
+/// The bound nodes are generated by adding id(...) matchers into the
 /// match expression around the matchers for the nodes we want to access later.
 ///
 /// The instances of BoundNodes are created by MatchFinder when the user's
@@ -97,7 +97,7 @@
   friend class internal::BoundNodesTree;
 };
 
-/// \brief If the provided matcher matches a node, binds the node to 'id'.
+/// \brief If the provided matcher matches a node, binds the node to 'ID'.
 ///
 /// FIXME: Add example for accessing it.
 template <typename T>
@@ -120,7 +120,7 @@
 /// additional constraint. This will often be used with an explicit conversion
 /// to a internal::Matcher<> type such as TypeMatcher.
 ///
-/// Example: DeclarationMatcher(True()) matches all declarations, e.g.,
+/// Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
 /// "int* p" and "void f()" in
 ///   int* p;
 ///   void f();
@@ -186,7 +186,7 @@
 ///
 /// Given
 ///   class X { int m; };
-/// Field()
+/// field()
 ///   matches 'm'.
 const internal::VariadicDynCastAllOfMatcher<
   clang::Decl,
@@ -205,7 +205,7 @@
 ///
 /// Given
 ///   { ++a; }
-/// Statement()
+/// statement()
 ///   matches both the compound statement '{ ++a; }' and '++a'.
 const internal::VariadicDynCastAllOfMatcher<clang::Stmt, clang::Stmt> statement;
 
@@ -213,7 +213,7 @@
 ///
 /// Given
 ///   int a;
-/// DeclarationStatement()
+/// declarationStatement()
 ///   matches 'int a'.
 const internal::VariadicDynCastAllOfMatcher<
   clang::Stmt,
@@ -325,7 +325,8 @@
 ///
 /// Example matches 'for (;;) {}'
 ///   for (;;) {}
-const internal::VariadicDynCastAllOfMatcher<clang::Stmt, clang::ForStmt> forStmt;
+const internal::VariadicDynCastAllOfMatcher<
+  clang::Stmt, clang::ForStmt> forStmt;
 
 /// \brief Matches while statements.
 ///
@@ -628,7 +629,7 @@
 /// \brief Matches AST nodes that have child AST nodes that match the
 /// provided matcher.
 ///
-/// Example matches X, Y (matcher = Class(Has(Class(HasName("X")))
+/// Example matches X, Y (matcher = record(Has(record(hasName("X")))
 ///   class X {};  // Matches X, because X::X is a class of name X inside X.
 ///   class Y { class X {}; };
 ///   class Z { class Y { class X {}; }; };  // Does not match Z.
@@ -645,7 +646,7 @@
 /// provided matcher.
 ///
 /// Example matches X, Y, Z
-///     (matcher = Class(HasDescendant(Class(HasName("X")))))
+///     (matcher = record(HasDescendant(record(hasName("X")))))
 ///   class X {};  // Matches X, because X::X is a class of name X inside X.
 ///   class Y { class X {}; };
 ///   class Z { class Y { class X {}; }; };
@@ -663,7 +664,7 @@
 /// \brief Matches AST nodes that have child AST nodes that match the
 /// provided matcher.
 ///
-/// Example matches X, Y (matcher = Class(ForEach(Class(HasName("X")))
+/// Example matches X, Y (matcher = record(ForEach(record(hasName("X")))
 ///   class X {};  // Matches X, because X::X is a class of name X inside X.
 ///   class Y { class X {}; };
 ///   class Z { class Y { class X {}; }; };  // Does not match Z.
@@ -684,7 +685,7 @@
 /// provided matcher.
 ///
 /// Example matches X, A, B, C
-///     (matcher = Class(ForEachDescendant(Class(HasName("X")))))
+///     (matcher = record(ForEachDescendant(record(hasName("X")))))
 ///   class X {};  // Matches X, because X::X is a class of name X inside X.
 ///   class A { class X {}; };
 ///   class B { class C { class X {}; }; };
@@ -695,7 +696,7 @@
 /// each result that matches instead of only on the first one.
 ///
 /// Note: Recursively combined ForEachDescendant can cause many matches:
-///   Class(ForEachDescendant(Class(ForEachDescendant(Class()))))
+///   record(ForEachDescendant(record(ForEachDescendant(record()))))
 /// will match 10 times (plus injected class name matches) on:
 ///   class A { class B { class C { class D { class E {}; }; }; }; };
 template <typename DescendantT>
@@ -709,7 +710,7 @@
 
 /// \brief Matches if the provided matcher does not match.
 ///
-/// Example matches Y (matcher = Class(Not(HasName("X"))))
+/// Example matches Y (matcher = record(Not(hasName("X"))))
 ///   class X {};
 ///   class Y {};
 template <typename M>
@@ -730,7 +731,7 @@
 
 /// \brief Matches on the implicit object argument of a member call expression.
 ///
-/// Example matches y.x() (matcher = Call(On(HasType(Class(HasName("Y"))))))
+/// Example matches y.x() (matcher = Call(On(HasType(record(hasName("Y"))))))
 ///   class Y { public: void x(); };
 ///   void z() { Y y; y.x(); }",
 ///
@@ -768,7 +769,7 @@
 /// \brief Matches if the call expression's callee's declaration matches the
 /// given matcher.
 ///
-/// Example matches y.x() (matcher = Call(Callee(Method(HasName("x")))))
+/// Example matches y.x() (matcher = Call(Callee(Method(hasName("x")))))
 ///   class Y { public: void x(); };
 ///   void z() { Y y; y.x();
 inline internal::Matcher<clang::CallExpr> callee(
@@ -780,9 +781,9 @@
 /// matcher.
 ///
 /// Example matches x (matcher = Expression(HasType(
-///                        HasDeclaration(Class(HasName("X"))))))
+///                        HasDeclaration(record(hasName("X"))))))
 ///             and z (matcher = Variable(HasType(
-///                        HasDeclaration(Class(HasName("X"))))))
+///                        HasDeclaration(record(hasName("X"))))))
 ///  class X {};
 ///  void y(X &x) { x; X z; }
 AST_POLYMORPHIC_MATCHER_P(hasType, internal::Matcher<clang::QualType>,
@@ -798,12 +799,12 @@
 ///
 /// In case of a value declaration (for example a variable declaration),
 /// this resolves one layer of indirection. For example, in the value
-/// declaration "X x;", Class(HasName("X")) matches the declaration of X,
-/// while Variable(HasType(Class(HasName("X")))) matches the declaration
+/// declaration "X x;", record(hasName("X")) matches the declaration of X,
+/// while Variable(HasType(record(hasName("X")))) matches the declaration
 /// of x."
 ///
-/// Example matches x (matcher = Expression(HasType(Class(HasName("X")))))
-///             and z (matcher = Variable(HasType(Class(HasName("X")))))
+/// Example matches x (matcher = Expression(HasType(record(hasName("X")))))
+///             and z (matcher = Variable(HasType(record(hasName("X")))))
 ///  class X {};
 ///  void y(X &x) { x; X z; }
 inline internal::PolymorphicMatcherWithParam1<
@@ -818,7 +819,7 @@
 /// matches the specified matcher.
 ///
 /// Example matches y->x()
-///     (matcher = Call(On(HasType(PointsTo(Class(HasName("Y")))))))
+///     (matcher = Call(On(HasType(PointsTo(record(hasName("Y")))))))
 ///   class Y { public: void x(); };
 ///   void z() { Y *y; y->x(); }
 AST_MATCHER_P(
@@ -839,7 +840,7 @@
 /// type matches the specified matcher.
 ///
 /// Example matches X &x and const X &y
-///     (matcher = Variable(HasType(References(Class(HasName("X"))))))
+///     (matcher = Variable(HasType(References(record(hasName("X"))))))
 ///   class X {
 ///     void a(X b) {
 ///       X &x = b;
@@ -885,7 +886,7 @@
 /// specified matcher.
 ///
 /// Example matches x in if(x)
-///     (matcher = DeclarationReference(To(Variable(HasName("x")))))
+///     (matcher = DeclarationReference(To(Variable(hasName("x")))))
 ///   bool x;
 ///   if (x) {}
 AST_MATCHER_P(clang::DeclRefExpr, to, internal::Matcher<clang::Decl>,
@@ -947,7 +948,7 @@
 ///     Foo() : foo_(1) { }
 ///     int foo_;
 ///   };
-/// Class(Has(Constructor(HasAnyConstructorInitializer(True()))))
+/// record(Has(Constructor(HasAnyConstructorInitializer(anything()))))
 ///   Class matches Foo, HasAnyConstructorInitializer matches foo_(1)
 AST_MATCHER_P(clang::CXXConstructorDecl, hasAnyConstructorInitializer,
               internal::Matcher<clang::CXXCtorInitializer>, InnerMatcher) {
@@ -967,8 +968,8 @@
 ///     Foo() : foo_(1) { }
 ///     int foo_;
 ///   };
-/// Class(Has(Constructor(HasAnyConstructorInitializer(
-///     ForField(HasName("foo_"))))))
+/// record(Has(Constructor(HasAnyConstructorInitializer(
+///     Forfield(hasName("foo_"))))))
 ///   matches Foo
 /// with ForField matching foo_
 AST_MATCHER_P(clang::CXXCtorInitializer, forField,
@@ -985,7 +986,7 @@
 ///     Foo() : foo_(1) { }
 ///     int foo_;
 ///   };
-/// Class(Has(Constructor(HasAnyConstructorInitializer(
+/// record(Has(Constructor(HasAnyConstructorInitializer(
 ///     WithInitializer(IntegerLiteral(Equals(1)))))))
 ///   matches Foo
 /// with WithInitializer matching (1)
@@ -1063,7 +1064,7 @@
 ///
 /// Given
 ///   class X { void f(int x, int y, int z) {} };
-/// Method(HasAnyParameter(HasName("y")))
+/// Method(HasAnyParameter(hasName("y")))
 ///   matches f(int x, int y, int z) {}
 /// with HasAnyParameter(...)
 ///   matching int y
@@ -1297,7 +1298,7 @@
 ///
 /// Example matches A() in the last line
 ///     (matcher = ConstructorCall(HasDeclaration(Method(
-///         OfClass(HasName("A"))))))
+///         ofClass(hasName("A"))))))
 ///   class A {
 ///    public:
 ///     A();
@@ -1351,7 +1352,7 @@
 ///   struct { int first, second; } first, second;
 ///   int i(second.first);
 ///   int j(first.second);
-/// MemberExpression(Member(HasName("first")))
+/// MemberExpression(Member(hasName("first")))
 ///   matches second.first
 ///   but not first.second (because the member name there is "second").
 AST_MATCHER_P(clang::MemberExpr, member,
@@ -1365,7 +1366,7 @@
 /// Given
 ///   struct X { int m; };
 ///   void f(X x) { x.m; m; }
-/// MemberExpression(HasObjectExpression(HasType(Class(HasName("X")))))))
+/// MemberExpression(HasObjectExpression(HasType(record(hasName("X")))))))
 ///   matches "x.m" and "m"
 /// with HasObjectExpression(...)
 ///   matching "x" and the implicit object expression of "m" which has type X*.
@@ -1381,13 +1382,13 @@
 ///   template <typename T> class X {}; class A {}; X<A> x;
 /// or
 ///   template <typename T> class X {}; class A {}; template class X<A>;
-/// Class(HasName("::X"), IsTemplateInstantiation())
+/// record(hasName("::X"), IsTemplateInstantiation())
 ///   matches the template instantiation of X<A>.
 ///
 /// But given
 ///   template <typename T> class X {}; class A {};
 ///   template <> class X<A> {}; X<A> x;
-/// Class(HasName("::X"), IsTemplateInstantiation())
+/// record(hasName("::X"), IsTemplateInstantiation())
 ///   does not match, as X<A> is an explicit template specialization.
 inline internal::PolymorphicMatcherWithParam0<
   internal::IsTemplateInstantiationMatcher>





More information about the llvm-branch-commits mailing list