Index: docs/LibASTMatchersReference.html =================================================================== --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -499,7 +499,7 @@ int X; namespace NS { int Y; - } namespace NS + } // namespace NS decl(hasDeclContext(translationUnitDecl())) matches "int X", but not "int Y". @@ -1152,7 +1152,7 @@
Matches float literals of all sizes encodings, e.g. +@@ -2162,11 +2161,11 @@ Given struct S { - S(); #1 - S(int) {} #2 - S(S &&) : S() {} #3 + S(); // #1 + S(int) {} // #2 + S(S &&) : S() {} // #3 }; - S::S() : S(0) {} #4 + S::S() : S(0) {} // #4 cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not #1 or #2. Matches float literals of all sizes / encodings, e.g. 1.0, 1.0f, 1.0L and 1e10. Does not match implicit conversions such as @@ -1230,7 +1230,7 @@- Matcher<Stmt> integerLiteral Matcher<IntegerLiteral>... @@ -2149,9 +2148,9 @@ Given struct S { - S(); #1 - S(const S &); #2 - S(S &&); #3 + S(); // #1 + S(const S &); // #2 + S(S &&); // #3 }; cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3. Matches integer literals of all sizes encodings, e.g. +@@ -2136,9 +2135,9 @@ Given struct S { - S(); #1 - S(const S &); #2 - S(S &&); #3 + S(); // #1 + S(const S &); // #2 + S(S &&); // #3 }; cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3. Matches integer literals of all sizes / encodings, e.g. 1, 1L, 0x1 and 1U. Does not match character-encoded integers such as L'a'. @@ -1911,8 +1911,8 @@ template <typename T> class C { }; - template class C<int>; A - C<char> var; B + template class C<int>; // A + C<char> var; // B templateSpecializationType() matches the type of the explicit instantiation in A and the type of the variable declaration in B. @@ -2091,13 +2091,12 @@ Given try { - ... + // ... } catch (int) { - ... + // ... } catch (...) { - ... + // ... } -endcode cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
Matches a declaration that has been implicitly added -by the compiler (eg. implicit defaultcopy constructors). +by the compiler (eg. implicit default/copy constructors).
Matches variablefunction declarations that have "static" storage +@@ -3401,7 +3400,7 @@ CGRect bodyFrame = webView.frame; bodyFrame.size.height = self.bodyContentHeight; webView.frame = bodyFrame; - ^---- matches here + // ^---- matches here Matches variable/function declarations that have "static" storage class specifier ("static" keyword) written in the source. Given: @@ -3360,7 +3359,7 @@ Given namespace n { - namespace {} #1 + namespace {} // #1 } namespaceDecl(isAnonymous()) will match #1 but not ::n.
Matches variablefunction declarations that have "static" storage +@@ -5256,8 +5255,8 @@ namespace a { void f() {} } using a::f; void g() { - f(); Matches this .. - a::f(); .. but not this. + f(); // Matches this .. + a::f(); // .. but not this. } declRefExpr(throughUsingDecl(anything())) matches f() Index: docs/tools/dump_ast_matchers.py =================================================================== --- docs/tools/dump_ast_matchers.py +++ docs/tools/dump_ast_matchers.py @@ -354,7 +354,7 @@ allowed_types += [m.group(1)] continue if line.strip() and line.lstrip()[0] == '/': - comment += re.sub(r'/+\s?', '', line) + '\n' + comment += re.sub(r'^/+\s?', '', line) + '\n' else: declaration += ' ' + line if ((not line.strip()) or Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3528,7 +3528,7 @@ /// } catch (...) { /// // ... /// } -/// /endcode +/// \endcode /// cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int). AST_MATCHER(CXXCatchStmt, isCatchAll) { return Node.getExceptionDecl() == nullptr; Matches variable/function declarations that have "static" storage class specifier ("static" keyword) written in the source. Given: @@ -4205,7 +4204,7 @@ Given: void *v1 = NULL; void *v2 = nullptr; - void *v3 = __null; GNU extension + void *v3 = __null; // GNU extension char *cp = (char *)0; int *ip = 0; int i = 0; @@ -4295,8 +4294,8 @@ Example matches X, A, A::X, B, B::C, B::C::X (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X"))))) class X {}; - class A { class X {}; }; Matches A, because A::X is a class of name - X inside A. + class A { class X {}; }; // Matches A, because A::X is a class of name + // X inside A. class B { class C { class X {}; }; }; DescendantT must be an AST base type. @@ -4322,9 +4321,9 @@ Example matches X, Y, Y::X, Z::Y, Z::Y::X (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X"))) class X {}; - class Y { class X {}; }; Matches Y, because Y::X is a class of name X - inside Y. - class Z { class Y { class X {}; }; }; Does not match Z. + class Y { class X {}; }; // Matches Y, because Y::X is a class of name X + // inside Y. + class Z { class Y { class X {}; }; }; // Does not match Z. ChildT must be an AST base type. @@ -4354,7 +4353,7 @@ Example matches X, Y, Z (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X"))))) - class X {}; Matches X, because X::X is a class of name X inside 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 {}; }; }; @@ -4370,9 +4369,9 @@ Example matches X, Y (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X"))) - class X {}; Matches X, because X::X is a class of name X inside 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. + class Z { class Y { class X {}; }; }; // Does not match Z. ChildT must be an AST base type. @@ -4951,16 +4950,16 @@ Example matches Y, Z, C (Base == hasName("X")) class X; - class Y : public X {}; directly derived - class Z : public Y {}; indirectly derived + class Y : public X {}; // directly derived + class Z : public Y {}; // indirectly derived typedef X A; typedef A B; - class C : public B {}; derived from a typedef of X + class C : public B {}; // derived from a typedef of X In the following example, Bar matches isDerivedFrom(hasName("X")): class Foo; typedef Foo X; - class Bar : public Foo {}; derived from a type that X is a typedef of + class Bar : public Foo {}; // derived from a type that X is a typedef of