diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index b547f7ece62d..b5e6199c314e 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -499,7 +499,7 @@ Given int X; namespace NS { int Y; - } namespace NS + } // namespace NS decl(hasDeclContext(translationUnitDecl())) matches "int X", but not "int Y". @@ -1152,7 +1152,7 @@ Example matches std::string()
Matches float literals of all sizes encodings, e.g. + 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 @@ initListExpr()- Matcher<Stmt> integerLiteral Matcher<IntegerLiteral>... Matches integer literals of all sizes encodings, e.g. + 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 @@ Given 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 @@ Usable as: Matcher<Decl>isImplicit @@ -2942,7 +2941,7 @@ Given: class A { int operator*(); }; const A &operator<<(const A &a, const A &b); A a; - a << a; <-- This matches + a << a; // <-- This matches cxxOperatorCallExpr(hasOverloadedOperatorName("<<"))) matches the specified line and @@ -2995,13 +2994,13 @@ functionDecl(isDefaulted()) Example matches A, va, fa class A {}; - class B; Doesn't match, as it has no body. + class B; // Doesn't match, as it has no body. int va; - extern int vb; Doesn't match, as it doesn't define the variable. + extern int vb; // Doesn't match, as it doesn't define the variable. void fa() {} - void fb(); Doesn't match, as it has no body. + void fb(); // Doesn't match, as it has no body. @interface X - - (void)ma; Doesn't match, interface is declaration. + - (void)ma; // Doesn't match, interface is declaration. @end @implementation X - (void)ma {} @@ -3104,7 +3103,7 @@ functionDecl(isNoThrow()) and functionProtoType(isNoThrow()) Matches a declaration that has been implicitly added -by the compiler (eg. implicit defaultcopy constructors). +by the compiler (eg. implicit default/copy constructors).- Matcher<FunctionDecl> isStaticStorageClass @@ -3473,13 +3472,13 @@ a substring matched by the given RegExp. Example matches A, va, fa class A {}; - class B; Doesn't match, as it has no body. + class B; // Doesn't match, as it has no body. int va; - extern int vb; Doesn't match, as it doesn't define the variable. + extern int vb; // Doesn't match, as it doesn't define the variable. void fa() {} - void fb(); Doesn't match, as it has no body. + void fb(); // Doesn't match, as it has no body. @interface X - - (void)ma; Doesn't match, interface is declaration. + - (void)ma; // Doesn't match, interface is declaration. @end @implementation X - (void)ma {} @@ -3773,13 +3772,13 @@ stringLiteral(hasSize(4)) Example matches A, va, fa class A {}; - class B; Doesn't match, as it has no body. + class B; // Doesn't match, as it has no body. int va; - extern int vb; Doesn't match, as it doesn't define the variable. + extern int vb; // Doesn't match, as it doesn't define the variable. void fa() {} - void fb(); Doesn't match, as it has no body. + void fb(); // Doesn't match, as it has no body. @interface X - - (void)ma; Doesn't match, interface is declaration. + - (void)ma; // Doesn't match, interface is declaration. @end @implementation X - (void)ma {} @@ -4073,13 +4072,13 @@ ifStmt(isConstexpr()) Example matches A, va, fa class A {}; - class B; Doesn't match, as it has no body. + class B; // Doesn't match, as it has no body. int va; - extern int vb; Doesn't match, as it doesn't define the variable. + extern int vb; // Doesn't match, as it doesn't define the variable. void fa() {} - void fb(); Doesn't match, as it has no body. + void fb(); // Doesn't match, as it has no body. @interface X - - (void)ma; Doesn't match, interface is declaration. + - (void)ma; // Doesn't match, interface is declaration. @end @implementation X - (void)ma {} @@ -4147,7 +4146,7 @@ static int z; Matches variablefunction declarations that have "static" storage +@@ -3401,7 +3400,7 @@ message expression in 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 @@ Example matches X (regexp is one of "::X", "^foo::.*X", among others) Given namespace n { - namespace {} #1 + namespace {} // #1 } namespaceDecl(isAnonymous()) will match #1 but not ::n.- Matcher<VarDecl> isStaticStorageClass Matches variablefunction declarations that have "static" storage +@@ -5256,8 +5255,8 @@ Given 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() diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 792f911e689a..2c0cbafa8ab7 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -354,7 +354,7 @@ for line in open(MATCHERS_FILE).read().splitlines(): 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 diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index f42ac5b701ba..ea3448ac62f9 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -3528,7 +3528,7 @@ AST_MATCHER_P2(DeclStmt, containsDeclaration, unsigned, N, /// } 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 @@ GNU's __null, C++11's nullptr, or C's NULL macro. 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 @@ provided matcher. 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 @@ provided matcher. 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 @@ provided matcher. 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 @@ provided matcher. 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 @@ Note that a class is not considered to be derived from itself. 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