Home | History | Annotate | Download | only in ASTMatchers

Lines Matching full:matches

60   EXPECT_TRUE(matches("namespace x { class X {}; } using x::X;",
66 EXPECT_TRUE(matches("typedef int X;", NamedX));
67 EXPECT_TRUE(matches("int X;", NamedX));
68 EXPECT_TRUE(matches("class foo { virtual void X(); };", NamedX));
69 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", NamedX));
70 EXPECT_TRUE(matches("void foo() { int X; }", NamedX));
71 EXPECT_TRUE(matches("namespace X { }", NamedX));
72 EXPECT_TRUE(matches("enum X { A, B, C };", NamedX));
79 EXPECT_TRUE(matches("typedef int Xa;", NamedX));
80 EXPECT_TRUE(matches("int Xb;", NamedX));
81 EXPECT_TRUE(matches("class foo { virtual void Xc(); };", NamedX));
82 EXPECT_TRUE(matches("void foo() try { } catch(int Xdef) { }", NamedX));
83 EXPECT_TRUE(matches("void foo() { int Xgh; }", NamedX));
84 EXPECT_TRUE(matches("namespace Xij { }", NamedX));
85 EXPECT_TRUE(matches("enum X { A, B, C };", NamedX));
90 EXPECT_TRUE(matches("int no_foo;", StartsWithNo));
91 EXPECT_TRUE(matches("class foo { virtual void nobody(); };", StartsWithNo));
94 EXPECT_TRUE(matches("int abc;", Abc));
95 EXPECT_TRUE(matches("int aFOObBARc;", Abc));
97 EXPECT_TRUE(matches("int cabc;", Abc));
100 EXPECT_TRUE(matches("int k;", StartsWithK));
101 EXPECT_TRUE(matches("int kAbc;", StartsWithK));
102 EXPECT_TRUE(matches("namespace x { int kTest; }", StartsWithK));
103 EXPECT_TRUE(matches("class C { int k; };", StartsWithK));
112 EXPECT_FALSE(matches("", ClassMatcher));
114 // Matches class type_info.
115 EXPECT_TRUE(matches("", ClassMatcher));
118 EXPECT_TRUE(matches("class X;", ClassX));
119 EXPECT_TRUE(matches("class X {};", ClassX));
120 EXPECT_TRUE(matches("template<class T> class X {};", ClassX));
127 EXPECT_TRUE(matches("class X {}; class Y : public X {};", IsDerivedFromX));
135 EXPECT_TRUE(matches("class X {}; class Y : public X {};", IsAX));
136 EXPECT_TRUE(matches("class X {};", IsAX));
137 EXPECT_TRUE(matches("class X;", IsAX));
144 matches("class X {}; class Y : public X {}; class Z : public Y {};",
147 matches("class X {};"
150 EXPECT_TRUE(matches("class X {}; template<class T> class Z : public X {};",
153 matches("template<class T> class X {}; "
157 matches("template<class T, class U=T> class X {}; "
164 matches("template<class X> class A { public: class Z : public X {}; }; "
167 matches("template <class T> class X {}; "
174 matches("template<template<class T> class X> class A { "
182 matches("template<class X> class A { public: "
187 matches("class X {}; typedef X Y; class Z : public Y {};",
190 matches("template<class T> class Y { typedef typename T::U X; "
192 EXPECT_TRUE(matches("class X {}; class Z : public ::X {};",
199 matches("template<class T> class X { public: typedef X<T> D; }; "
207 matches("class X {}; typedef X V; typedef V W; class Z : public W {};",
210 matches("class X {}; class Y : public X {}; "
214 matches("template<class T, class U> class X {}; "
222 matches("class X {}; typedef X A; typedef A B; "
225 matches("class X {}; typedef X A; typedef A B; typedef B C; "
228 matches("class U {}; typedef U X; typedef X V; "
231 matches("class Base {}; typedef Base X; "
234 matches("class Base {}; typedef Base Base2; typedef Base2 X; "
240 matches("class A {}; typedef A X; typedef A Y; "
248 matches("template <typename T> class X;"
252 EXPECT_TRUE(matches(
262 EXPECT_TRUE(matches(
282 EXPECT_TRUE(matches(
290 EXPECT_TRUE(matches(
307 EXPECT_TRUE(matches(
315 EXPECT_TRUE(matches(
320 EXPECT_TRUE(matches(
327 EXPECT_TRUE(matches(
331 EXPECT_TRUE(matches(
339 EXPECT_TRUE(matches("class A { void func(); };",
346 EXPECT_TRUE(matches(
356 EXPECT_TRUE(matches(
371 EXPECT_TRUE(matches("namespace {"
379 EXPECT_TRUE(matches("class D{};", decl(hasDeclContext(decl()))));
387 EXPECT_TRUE(matches(
389 EXPECT_FALSE(matches(
391 EXPECT_TRUE(matches(
398 EXPECT_TRUE(matches("extern \"C\" { void foo() {}; }", linkageSpecDecl()));
410 EXPECT_TRUE(matches("template<typename T> class X {};", ClassX));
411 EXPECT_TRUE(matches("class Z { template<class T> class X {}; };", ClassX));
433 EXPECT_TRUE(matches(Program,
436 EXPECT_TRUE(matches(Program,
441 EXPECT_TRUE(matches(Program,
447 EXPECT_TRUE(matches(Program,
458 matches("const int a = 0;",
469 EXPECT_TRUE(matches("class X {}; class Z : public X {};", YOrZDerivedFromX));
470 EXPECT_TRUE(matches("class Y {};", YOrZDerivedFromX));
477 EXPECT_TRUE(matches("class X {};", XOrYOrZOrU));
483 EXPECT_TRUE(matches("class X {};", XOrYOrZOrUOrV));
484 EXPECT_TRUE(matches("class Y {};", XOrYOrZOrUOrV));
485 EXPECT_TRUE(matches("class Z {};", XOrYOrZOrUOrV));
486 EXPECT_TRUE(matches("class U {};", XOrYOrZOrUOrV));
487 EXPECT_TRUE(matches("class V {};", XOrYOrZOrUOrV));
491 EXPECT_TRUE(matches("int F() { return 1 + 2; }", MixedTypes));
492 EXPECT_TRUE(matches("int F() { if (true) return 1; }", MixedTypes));
496 matches("void f() try { } catch (int) { } catch (...) { }",
502 EXPECT_TRUE(matches("class Y { class X {}; };", HasClassX));
503 EXPECT_TRUE(matches("class X {};", HasClassX));
507 EXPECT_TRUE(matches("class Y { class X {}; };", YHasClassX));
526 EXPECT_TRUE(matches(
538 EXPECT_TRUE(matches(
552 EXPECT_TRUE(matches(
591 EXPECT_TRUE(matches("class F {};", Recursive));
592 EXPECT_TRUE(matches("class Z {};", Recursive));
593 EXPECT_TRUE(matches("class C {};", Recursive));
594 EXPECT_TRUE(matches("class M { class N { class X {}; }; };", Recursive));
595 EXPECT_TRUE(matches("class M { class N { class B {}; }; };", Recursive));
597 matches("class O1 { class O2 {"
609 EXPECT_TRUE(matches("class Y {}; class Z : public Y {};", NotClassX));
621 EXPECT_TRUE(matches("class X { class Z {}; };", ClassXHasNotClassY));
627 EXPECT_TRUE(matches("void Foo(){}", NamedNotRecord));
636 EXPECT_TRUE(matches("class Z { class X {}; };", ZDescendantClassX));
638 matches("class Z { class Y { class X {}; }; };", ZDescendantClassX));
640 matches("class Z { class A { class Y { class X {}; }; }; };",
643 matches("class Z { class A { class B { class Y { class X {}; }; }; }; };",
652 EXPECT_TRUE(matches("class Z { class X { class Y {}; }; };",
655 matches("class Z { class A { class B { class X { class Y {}; }; }; }; };",
676 matches("class Z { class A { class X { class B { class Y {}; }; }; }; };",
678 EXPECT_TRUE(matches(
694 EXPECT_TRUE(matches("void f() { int i; }", CannotMemoize));
707 EXPECT_TRUE(matches("void f() { int i; }",
712 EXPECT_TRUE(matches("struct __attribute__((warn_unused)) X {};",
714 EXPECT_FALSE(matches("struct X {};",
737 // Does not check for a certain number of matches.
742 // Checks that there were exactly \c ExpectedCount matches.
803 EXPECT_TRUE(matches("void f() { int i = 3; }",
805 EXPECT_TRUE(matches("void f() { int i = 3; }",
808 EXPECT_TRUE(matches("void f() { int i = 3; }",
810 EXPECT_TRUE(matches("void f() { int i = 3; }",
824 EXPECT_TRUE(matches("void f() { int*** i; }",
826 EXPECT_TRUE(matches("void f() { int*** i; }",
829 EXPECT_TRUE(matches("void f() { int*** i; }",
839 matches("int i;",
850 EXPECT_TRUE(matches(
858 TEST(ValueDecl, Matches) {
859 EXPECT_TRUE(matches("enum EnumType { EnumValue };",
861 EXPECT_TRUE(matches("void FunctionDecl();",
870 EXPECT_TRUE(matches("enum X {};", enumDecl(hasName("X"))));
873 TEST(EnumConstant, Matches) {
875 EXPECT_TRUE(matches("enum X{ A };", Matcher));
885 EXPECT_TRUE(matches(
896 EXPECT_TRUE(matches(
907 EXPECT_TRUE(matches("class A { public: A *a; };", TypeA));
913 EXPECT_TRUE(matches("class A {}; class B : public A { public: B *b; };",
921 matches("class A { public: A *a; class B {}; };", TypeAHasClassB));
929 EXPECT_TRUE(matches("typedef int I; void f(I i);",
939 EXPECT_TRUE(matches("template <typename T> void f(T t);",
942 EXPECT_TRUE(matches("template <typename T> void f(T t);",
945 EXPECT_TRUE(matches("template <typename T> struct S {"
954 EXPECT_TRUE(matches("template <typename T> struct S {"
970 EXPECT_TRUE(matches(Using, unresolvedUsingTypenameDecl(hasName("Foo"))));
972 EXPECT_TRUE(matches(Using, parmVarDecl(hasType(namedDecl(hasName("Foo"))))));
1029 EXPECT_TRUE(matches("enum X {}; void y(X *x) { x; }",
1041 EXPECT_TRUE(matches("typedef int X; X a;",
1049 EXPECT_TRUE(matches("template <typename T> class A {}; A<int> a;",
1057 matches("class X {}; void y(X &x) { x; }", expr(hasType(ClassX))));
1062 matches("class X {}; void y(X *x) { x; }",
1069 matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
1073 matches("class X {}; void y() { X *x; }",
1080 matches("class X {}; void y(X &x) { x; }", expr(hasType(ClassX))));
1089 matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
1095 EXPECT_TRUE(matches("int x;",
1109 EXPECT_TRUE(matches("class Y { void x() { x(); } };", MethodX));
1116 matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
1119 matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
1135 matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }",
1138 matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }",
1141 matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }",
1152 EXPECT_TRUE(matches("auto f = [] (int i) { return i; };",
1157 EXPECT_TRUE(matches("int as[] = { 1, 2, 3 };"
1165 EXPECT_FALSE(matches("template<int N>\n"
1169 EXPECT_TRUE(matches("template<int N>\n"
1176 EXPECT_TRUE(matches("template <int N> void f();",
1183 EXPECT_TRUE(matches("template <typename T> void f();",
1190 EXPECT_TRUE(matches("constexpr char operator \"\" _inc (const char i) {"
1198 EXPECT_TRUE(matches("void f() { while(true) { break; } }", breakStmt()));
1199 EXPECT_TRUE(matches("void f() { while(true) { continue; } }",
1201 EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", gotoStmt()));
1202 EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", labelStmt()));
1203 EXPECT_TRUE(matches("void f() { return; }", returnStmt()));
1208 matches("class Y { public: void x(); }; void z() {Y* y; y->x(); }",
1211 matches("class X { void x(int x) {} };",
1213 EXPECT_TRUE(matches("namespace ns { struct A {}; } struct B { ns::A a; };",
1215 EXPECT_TRUE(matches("namespace { struct A {}; } struct B { A a; };",
1222 EXPECT_TRUE(matches("class Y { }; "
1236 EXPECT_TRUE(matches("class Y { }; "
1248 EXPECT_TRUE(matches("class Y { }; "
1259 EXPECT_TRUE(matches("class Y; int operator*(Y &); void f(Y &y) { *y; }",
1263 EXPECT_TRUE(matches("class Y { int operator*(); };",
1268 EXPECT_TRUE(matches("class Y; int operator*(Y &);", AnyOpStar));
1269 EXPECT_TRUE(matches("class Y { int operator*(); };", AnyOpStar));
1279 EXPECT_TRUE(matches("class Y { }; "
1284 matches("class Y { }; "
1295 matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
1298 matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
1301 matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }",
1304 matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }",
1307 matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }",
1310 EXPECT_TRUE(matches(
1326 EXPECT_TRUE(matches(
1348 EXPECT_TRUE(matches("void f() { int X; }", M));
1354 EXPECT_TRUE(matches("int X;", M));
1355 EXPECT_TRUE(matches("void f() { static int X; }", M));
1362 EXPECT_TRUE(matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration())));
1368 EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration())));
1369 EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration())));
1382 EXPECT_TRUE(matches(
1391 EXPECT_TRUE(matches(
1393 EXPECT_TRUE(matches(
1395 EXPECT_TRUE(matches(
1398 EXPECT_TRUE(matches(
1408 EXPECT_TRUE(matches("void x() { int a = sizeof(a); }",
1413 // EXPECT_TRUE(matches("void x() { int a = alignof(a); }",
1420 EXPECT_TRUE(matches("void x() { int a = sizeof(a); }", sizeOfExpr(
1424 EXPECT_TRUE(matches(
1436 EXPECT_TRUE(matches("class Y { void x() { x(); } };", memberExpr()));
1441 matches("class Y { void x() { this->y; } int y; };", memberExpr()));
1443 matches("class Y { void x() { y; } int y; };", memberExpr()));
1445 matches("class Y { void x() { Y y; y.y; } int y; };", memberExpr()));
1449 EXPECT_TRUE(matches("class Y { void x() { this->y; } static int y; };",
1458 EXPECT_TRUE(matches("int i = 0;", varDecl(hasType(isInteger()))));
1459 EXPECT_TRUE(matches(
1473 EXPECT_TRUE(matches("char i = 0;", varDecl(hasType(isAnyCharacter()))));
1481 EXPECT_TRUE(matches("class Y { void x() { this->y; } int y; };",
1483 EXPECT_TRUE(matches("class Y { void x() { y; } int y; };",
1490 EXPECT_TRUE(matches("class Y { void x() { this->y; } static int y; };",
1499 EXPECT_TRUE(matches("class Y { void x() { this->x(); } };",
1501 EXPECT_TRUE(matches("class Y { void x() { x(); } };",
1510 EXPECT_TRUE(matches("class Y { void x() { x(); } };", CallMethodX));
1515 matches("struct Y { operator int() const; }; int i = Y();", CallMethodX));
1521 EXPECT_TRUE(matches("struct S { explicit operator int(); };",
1528 EXPECT_TRUE(matches("class Y { void x() { this->x(); } };",
1537 EXPECT_TRUE(matches("void f() { f(); }", CallFunctionF));
1544 EXPECT_TRUE(matches("void f(); template <int N> void g() { f(); }",
1547 matches("void f(); template <int N> struct S { void g() { f(); } };",
1560 EXPECT_TRUE(matches("void f(...);", functionDecl(isVariadic())));
1570 matches("template <typename T> void f(T t) {}",
1593 EXPECT_TRUE(matches("void x(int) { int y; x(y); }", CallArgumentY));
1595 matches("class X { void x(int) { int y; x(y); } };", CallArgumentY));
1606 EXPECT_TRUE(matches("void x(int, int) { int y; x(1, y); }", CallArgumentY));
1607 EXPECT_TRUE(matches("void x(int, int) { int y; x(y, 42); }", CallArgumentY));
1614 EXPECT_TRUE(matches("void x(int) { x(0); }", Call1Arg));
1615 EXPECT_TRUE(matches("class X { void x(int) { x(0); } };", Call1Arg));
1621 EXPECT_TRUE(matches("void f(int i) {}", Function1Arg));
1622 EXPECT_TRUE(matches("class X { void f(int i) {} };", Function1Arg));
1630 EXPECT_TRUE(matches("class X {}; void y(X y) { X &x = y; }",
1633 matches("class X {}; void y(X y) { const X &x = y; }", ReferenceClassX));
1637 matches("class X {}; void y(X y) { X x = y; }", ReferenceClassX));
1650 matches("typedef int &int_ref;"
1659 EXPECT_TRUE(matches("int *const j = nullptr;",
1661 EXPECT_TRUE(matches("int *volatile k;",
1668 EXPECT_TRUE(matches("class X { void x(int) {} };",
1680 EXPECT_TRUE(matches(
1686 EXPECT_TRUE(matches("class X { void x(const X *x) {} };",
1689 EXPECT_TRUE(matches("class X { void x(const X &x) {} };",
1695 EXPECT_TRUE(matches(
1698 EXPECT_TRUE(matches(
1704 EXPECT_TRUE(matches("class Y { int f() { return 1; } };",
1708 EXPECT_TRUE(matches("class Y { Y getMe() { return *this; } };",
1714 EXPECT_TRUE(matches("extern \"C\" void f() {}", functionDecl(isExternC())));
1715 EXPECT_TRUE(matches("extern \"C\" { void f() {} }",
1723 EXPECT_TRUE(matches("void Func() = delete;",
1732 EXPECT_TRUE(matches("void f() throw();", functionDecl(isNoThrow())));
1733 EXPECT_TRUE(matches("void f() noexcept;", functionDecl(isNoThrow())));
1737 EXPECT_TRUE(matches("constexpr int foo = 42;",
1739 EXPECT_TRUE(matches("constexpr int bar();",
1756 EXPECT_TRUE(matches("class Y {}; class X { void x(int x) {} };",
1763 EXPECT_TRUE(matches("template<typename T> struct A {};"
1766 EXPECT_TRUE(matches("template<typename T> struct A {}; A<int> a;",
1773 EXPECT_TRUE(matches("int x;", declaratorDecl()));
1778 EXPECT_TRUE(matches("void f(int x);", parmVarDecl()));
1783 EXPECT_TRUE(matches(
1791 EXPECT_TRUE(matches(
1804 EXPECT_TRUE(matches(
1819 EXPECT_TRUE(matches(
1830 EXPECT_TRUE(matches(
1842 TEST(TemplateArgument, Matches) {
1843 EXPECT_TRUE(matches("template<typename T> struct C {}; C<int> c;",
1846 EXPECT_TRUE(matches(
1851 TEST(TemplateArgumentCountIs, Matches) {
1853 matches("template<typename T> struct C {}; C<int> c;",
1859 EXPECT_TRUE(matches("template<typename T> struct C {}; C<int> c;",
1866 TEST(IsIntegral, Matches) {
1867 EXPECT_TRUE(matches("template<int T> struct C {}; C<42> c;",
1875 TEST(RefersToIntegralType, Matches) {
1876 EXPECT_TRUE(matches("template<int T> struct C {}; C<42> c;",
1885 TEST(EqualsIntegralValue, Matches) {
1886 EXPECT_TRUE(matches("template<int T> struct C {}; C<42> c;",
1889 EXPECT_TRUE(matches("template<int T> struct C {}; C<-42> c;",
1892 EXPECT_TRUE(matches("template<int T> struct C {}; C<-0042> c;",
1901 EXPECT_TRUE(matches("class C { public: int i; };", accessSpecDecl()));
1903 matches("class C { public: int i; };", accessSpecDecl(isPublic())));
1913 EXPECT_TRUE(matches("class X final {};", cxxRecordDecl(isFinal())));
1914 EXPECT_TRUE(matches("class X { virtual void f() final; };",
1922 EXPECT_TRUE(matches("class X { virtual int f(); };",
1928 EXPECT_TRUE(matches("class X { virtual int f() = 0; };",
1934 EXPECT_TRUE(matches("class X { X &operator=(X); };",
1936 EXPECT_TRUE(matches("class X { X &operator=(X &); };",
1938 EXPECT_TRUE(matches("class X { X &operator=(const X &); };",
1940 EXPECT_TRUE(matches("class X { X &operator=(volatile X &); };",
1942 EXPECT_TRUE(matches("class X { X &operator=(const volatile X &); };",
1950 matches("struct A { void foo() const; };", cxxMethodDecl(isConst())));
1956 EXPECT_TRUE(matches("class X { virtual int f(); }; "
1968 matches("template <typename Base> struct Y : Base { void f() override;};",
1976 matches("class X { public: X(); }; void x() { X x; }", Constructor));
1978 matches("class X { public: X(); }; void x() { X x = X(); }",
1981 matches("class X { public: X(int); }; void x() { X x = 0; }",
1983 EXPECT_TRUE(matches("class X {}; void x(int) { X x; }", Constructor));
1991 matches("class X { public: X(int); }; void x() { int y; X x(y); }",
1994 matches("class X { public: X(int); }; void x() { int y; X x = X(y); }",
1997 matches("class X { public: X(int); }; void x() { int y; X x = y; }",
2014 matches("class X { public: X(int); }; void x() { X x(0); }",
2017 matches("class X { public: X(int); }; void x() { X x = X(0); }",
2020 matches("class X { public: X(int); }; void x() { X x = 0; }",
2032 matches("class X { public: X(int); }; void x() { X x{0}; }",
2035 matches("class X { public: X(int); }; void x() { X x(0); }",
2041 matches("struct X { int a; int f () { return a; } };", cxxThisExpr()));
2052 matches(ClassString +
2082 matches(ClassString +
2113 EXPECT_TRUE(matches("class Foo { Foo(int i); };",
2125 EXPECT_TRUE(matches("class Foo { }; Foo* f = new Foo();",
2127 EXPECT_TRUE(matches("class Foo { Foo(){} };",
2130 EXPECT_TRUE(matches("struct A { int x; } a = {0}, b = a; void f() { a = b; }",
2135 EXPECT_TRUE(matches("struct S { explicit S(int); };",
2142 EXPECT_TRUE(matches("struct S { S(); };",
2151 EXPECT_TRUE(matches("struct S { S(const S&); };",
2160 EXPECT_TRUE(matches("struct S { S(S&&); };",
2165 EXPECT_TRUE(matches("class Foo { virtual ~Foo(); };",
2179 matches("class Foo {"
2194 EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
2196 EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
2208 EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
2222 EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
2226 EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
2240 EXPECT_TRUE(matches(Code, cxxConstructorDecl(allOf(
2246 EXPECT_TRUE(matches(Code, cxxConstructorDecl(allOf(
2257 EXPECT_TRUE(matches("class X { public: X(); }; void x() { new X; }", New));
2259 matches("class X { public: X(); }; void x() { new X(); }", New));
2261 matches("class X { public: X(int); }; void x() { new X(0); }", New));
2262 EXPECT_TRUE(matches("class X {}; void x(int) { new X; }", New));
2270 matches("class X { public: X(int); }; void x() { int y; new X(y); }",
2273 matches("class X { public: X(int); }; void x() { int y; new X(y); }",
2290 matches("class X { public: X(int); }; void x() { new X(0); }", New));
2297 EXPECT_TRUE(matches("struct A {}; void f(A* a) { delete a; }",
2304 EXPECT_TRUE(matches("void x(int, int = 0) { int y; x(y); }", Arg));
2306 matches("class X { void x(int, int = 0) { int y; x(y); } };", Arg));
2312 EXPECT_TRUE(matches("const char *s = \"string\";", Literal));
2314 EXPECT_TRUE(matches("const wchar_t *s = L\"string\";", Literal));
2316 EXPECT_TRUE(matches("const char *s = \"\x05five\";", Literal));
2323 EXPECT_TRUE(matches("const char c = 'c';", CharLiteral));
2325 EXPECT_TRUE(matches("const char c = L'c';", CharLiteral));
2333 EXPECT_TRUE(matches("int i = 10;", HasIntLiteral));
2334 EXPECT_TRUE(matches("int i = 0x1AB;", HasIntLiteral));
2335 EXPECT_TRUE(matches("int i = 10L;", HasIntLiteral));
2336 EXPECT_TRUE(matches("int i = 10U;", HasIntLiteral));
2349 EXPECT_TRUE(matches("float i = 10.0;", HasFloatLiteral));
2350 EXPECT_TRUE(matches("float i = 10.0f;", HasFloatLiteral));
2351 EXPECT_TRUE(matches("double i = 10.0;", HasFloatLiteral));
2352 EXPECT_TRUE(matches("double i = 10.0L;", HasFloatLiteral));
2353 EXPECT_TRUE(matches("double i = 1e10;", HasFloatLiteral));
2354 EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0))));
2355 EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0f))));
2357 matches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(5.0)))));
2367 EXPECT_TRUE(matches("int* i = nullptr;", cxxNullPtrLiteralExpr()));
2371 EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
2375 EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt()));
2382 EXPECT_TRUE(matches("void x() { if (true) {} }", Condition));
2390 EXPECT_TRUE(matches("void f() { if (false) true; else false; }",
2394 EXPECT_TRUE(matches("void f() { if (false) false; else true; }",
2403 EXPECT_TRUE(matches("void x() { true || false; }", OperatorOr));
2412 EXPECT_TRUE(matches("void x() { true || false; }", OperatorTrueFalse));
2413 EXPECT_TRUE(matches("void x() { true && false; }", OperatorTrueFalse));
2418 EXPECT_TRUE(matches("void x() { 1[\"abc\"]; }", OperatorIntPointer));
2426 EXPECT_TRUE(matches("void x() { true || false; }", HasOperand));
2427 EXPECT_TRUE(matches("void x() { false && true; }", HasOperand));
2436 matches("void x() { 3, 4; }", binaryOperator(hasOperatorName(","))));
2438 matches("bool b; bool c = (b = true);",
2441 matches("bool b = 1 != 2;", binaryOperator(hasOperatorName("!="))));
2443 matches("bool b = 1 == 2;", binaryOperator(hasOperatorName("=="))));
2444 EXPECT_TRUE(matches("bool b = 1 < 2;", binaryOperator(hasOperatorName("<"))));
2446 matches("bool b = 1 <= 2;", binaryOperator(hasOperatorName("<="))));
2448 matches("int i = 1 << 2;", binaryOperator(hasOperatorName("<<"))));
2450 matches("int i = 1; int j = (i <<= 2);",
2452 EXPECT_TRUE(matches("bool b = 1 > 2;", binaryOperator(hasOperatorName(">"))));
2454 matches("bool b = 1 >= 2;", binaryOperator(hasOperatorName(">="))));
2456 matches("int i = 1 >> 2;", binaryOperator(hasOperatorName(">>"))));
2458 matches("int i = 1; int j = (i >>= 2);",
2461 matches("int i = 42 ^ 23;", binaryOperator(hasOperatorName("^"))));
2463 matches("int i = 42; int j = (i ^= 42);",
2466 matches("int i = 42 % 23;", binaryOperator(hasOperatorName("%"))));
2468 matches("int i = 42; int j = (i %= 42);",
2471 matches("bool b = 42 &23;", binaryOperator(hasOperatorName("&"))));
2473 matches("bool b = true && false;",
2476 matches("bool b = true; bool c = (b &= false);",
2479 matches("bool b = 42 | 23;", binaryOperator(hasOperatorName("|"))));
2481 matches("bool b = true || false;",
2484 matches("bool b = true; bool c = (b |= false);",
2487 matches
2489 matches("int i = 42; int j = (i *= 23);",
2492 matches("int i = 42 / 23;", binaryOperator(hasOperatorName("/"))));
2494 matches("int i = 42; int j = (i /= 23);",
2497 matches("int i = 42 + 23;", binaryOperator(hasOperatorName("+"))));
2499 matches("int i = 42; int j = (i += 23);",
2502 matches("int i = 42 - 23;", binaryOperator(hasOperatorName("-"))));
2504 matches("int i = 42; int j = (i -= 23);",
2507 matches("struct A { void x() { void (A::*a)(); (this->*a)(); } };",
2510 matches("struct A { void x() { void (A::*a)(); ((*this).*a)(); } };",
2513 // Member expressions as operators are not supported in matches.
2535 EXPECT_TRUE(matches("void x() { !true; } ", OperatorNot));
2543 EXPECT_TRUE(matches("void x() { !false; }", OperatorOnFalse));
2550 EXPECT_TRUE(matches("bool b = !true;", unaryOperator(hasOperatorName("!"))));
2552 matches("bool b; bool *p = &b;", unaryOperator(hasOperatorName("&"))));
2553 EXPECT_TRUE(matches("int i = ~ 1;", unaryOperator(hasOperatorName("~"))));
2555 matches("bool *p; bool b = *p;", unaryOperator(hasOperatorName("*"))));
2557 matches("int i; int j = +i;", unaryOperator(hasOperatorName("+"))));
2559 matches("int i; int j = -i;", unaryOperator(hasOperatorName("-"))));
2561 matches("int i; int j = ++i;", unaryOperator(hasOperatorName("++"))));
2563 matches("int i; int j = i++;", unaryOperator(hasOperatorName("++"))));
2565 matches("int i; int j = --i;", unaryOperator(hasOperatorName("--"))));
2567 matches("int i; int j = i--;", unaryOperator(hasOperatorName("--"))));
2587 EXPECT_TRUE(matches("void x() { true ? false : true; }", Conditional));
2594 EXPECT_TRUE(matches("void x() { true ? true : false; }", ConditionalFalse));
2600 EXPECT_TRUE(matches("int i[2]; void f() { i[1] = 1; }",
2607 EXPECT_TRUE(matches(
2610 EXPECT_TRUE(matches(
2619 EXPECT_TRUE(matches(
2626 EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
2628 EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
2630 EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
2632 EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
2654 matches("class A { class B { class C; }; };",
2657 matches("class A { class B { class C; }; };",
2660 matches("class A { class B { class C; }; };",
2663 matches("class A { class B { class C; }; };",
2690 EXPECT_TRUE(matches("class A {};", DefinitionOfClassA));
2695 EXPECT_TRUE(matches("int a;", DefinitionOfVariableA));
2700 EXPECT_TRUE(matches("class A { void a() {} };", DefinitionOfMethodA));
2709 matches("class X { public: X(); }; void x(int) { X x; }", Constructor));
2711 matches("class X { public: X(); }; void x(int) { X x = X(); }",
2719 EXPECT_TRUE(matches(
2725 EXPECT_TRUE(matches(
2745 EXPECT_TRUE(matches(
2767 return AMatcher.matches(Node, Finder, Builder);
2808 EXPECT_TRUE(matches("void x() { class B {}; }", StatementHasClassB));
2812 EXPECT_TRUE(matches("void f() { for(;;); }", forStmt()));
2813 EXPECT_TRUE(matches("void f() { if(true) for(;;); }", forStmt()));
2820 EXPECT_TRUE(matches("void f(){ int i; for (; i < 3 ; ); }",
2822 EXPECT_TRUE(matches("void f() { for (int i = 0; ;); }",
2827 EXPECT_TRUE(matches("void f(){ int a[] {1, 2}; for (int i : a); }",
2829 EXPECT_TRUE(matches(
2848 EXPECT_TRUE(matches("void f() {}", compoundStmt()));
2849 EXPECT_TRUE(matches("void f() {{}}", compoundStmt()));
2857 EXPECT_TRUE(matches("namespace n { struct S { void f() {{}} }; }",
2862 EXPECT_TRUE(matches("void f() { for(;;) {} }",
2866 EXPECT_TRUE(matches("void f() { while(true) {} }",
2868 EXPECT_TRUE(matches("void f() { do {} while(true); }",
2870 EXPECT_TRUE(matches("void f() { int p[2]; for (auto x : p) {} }",
2878 EXPECT_TRUE(matches("void f() { for (;;); }",
2889 EXPECT_TRUE(matches("void f() { if (true) { for (;;); } }",
2894 EXPECT_TRUE(matches("void f() { 1; 2; 3; for (;;); 4; 5; 6; }",
2899 EXPECT_TRUE(matches("void f() { }",
2906 EXPECT_TRUE(matches("void f() { 1; }",
2915 EXPECT_TRUE(matches("void f() { 1; 2; 3; }",
2920 EXPECT_TRUE(matches("void f() { { 1; } { 1; 2; 3; 4; } }",
2922 EXPECT_TRUE(matches("void f() { { 1; } { 1; 2; 3; 4; } }",
2926 EXPECT_TRUE(matches("void f() { { 1; } { 1; 2; 3; 4; } }",
2931 EXPECT_TRUE(matches("struct { int first; } s; int i(s.first);",
2943 EXPECT_TRUE(matches("void f() {"
2951 EXPECT_TRUE(matches(
2960 EXPECT_TRUE(matches(
2971 EXPECT_TRUE(matches(
2976 EXPECT_TRUE(matches("class A { protected: int i; };",
2994 EXPECT_TRUE(matches("class X { void operator delete(void*); };",
3011 EXPECT_TRUE(matches(
3014 EXPECT_TRUE(matches(
3022 EXPECT_TRUE(matches(
3026 EXPECT_TRUE(matches(
3040 EXPECT_TRUE(matches("class X { int m; };", fieldDecl(hasName("m"))));
3044 EXPECT_TRUE(matches("volatile int i = 42;",
3048 EXPECT_TRUE(matches("typedef volatile int v_int; v_int i = 42;",
3053 EXPECT_TRUE(matches("const int i = 42;",
3058 EXPECT_TRUE(matches("int i = 42; int* const p(&i);",
3063 EXPECT_TRUE(matches("typedef const int const_int; const_int i = 42;",
3065 EXPECT_TRUE(matches("typedef int* int_ptr; const int_ptr p(0);",
3077 EXPECT_TRUE(matches("char *p = reinterpret_cast<char *>(&p);",castExpr()));
3078 EXPECT_TRUE(matches("void *p = (void *)(&p);", castExpr()));
3079 EXPECT_TRUE(matches("char q, *p = const_cast<char *>(&q);", castExpr()));
3080 EXPECT_TRUE(matches("char c = char(0);", castExpr()));
3084 EXPECT_TRUE(matches("char c = 0;", castExpr()));
3086 EXPECT_TRUE(matches("char c = 0, d = c;", castExpr()));
3097 EXPECT_TRUE(matches("char* p = reinterpret_cast<char*>(&p);",
3115 EXPECT_TRUE(matches(foo_class + "void r() { Foo f = Foo(\"hello world\"); }",
3130 EXPECT_TRUE(matches("struct B { virtual ~B() {} }; struct D : B {};"
3137 EXPECT_TRUE(matches("void* p(static_cast<void*>(&p));",
3154 EXPECT_TRUE(matches("int i = (int) 2.2f;", cStyleCastExpr()));
3168 EXPECT_TRUE(matches("char* p = static_cast<char*>(0);",
3175 EXPECT_TRUE(matches("int x; const int i = x;",
3179 EXPECT_TRUE(matches("int arr[3]; int *p = arr;",
3197 EXPECT_TRUE(matches("int x = 0; const int y = x;",
3200 EXPECT_TRUE(matches("char c = 0;",
3203 EXPECT_TRUE(matches("int arr[6]; int *p = arr;",
3208 // This test verifies that implicitCastExpr() matches exactly when implicit casts
3227 // This test checks that ignoringImpCasts matches when implicit casts are
3230 EXPECT_TRUE(matches("int x = 0; const int y = x;",
3234 EXPECT_TRUE(matches("char x = 0;",
3269 EXPECT_TRUE(matches("int x = 0; int &y = x;",
3275 // This test checks that ignoringParenCasts matches when parentheses and/or
3277 EXPECT_TRUE(matches("int x = (0);",
3280 EXPECT_TRUE(matches("int x = (((((0)))));",
3286 EXPECT_TRUE(matches("char x = (0);",
3290 EXPECT_TRUE(matches("char x = (char)0;",
3293 EXPECT_TRUE(matches("char* p = static_cast<char*>(0);",
3300 EXPECT_TRUE(matches("int x = 0;",
3324 // This test checks that ignoringParenAndImpCasts matches when
3328 EXPECT_TRUE(matches("int x = 0; const int y = x;",
3332 EXPECT_TRUE(matches("const char x = (0);",
3340 EXPECT_TRUE(matches("int x = 0; int &y = x;",
3343 EXPECT_TRUE(matches("int x = 0;",
3369 EXPECT_TRUE(matches("class string {}; class URL { public: URL(string s); };"
3376 EXPECT_TRUE(matches("float x = static_cast<float>(42);",
3387 EXPECT_TRUE(matches("void x() {}", stmt()));
3395 EXPECT_TRUE(matches("void x() { int a; }", declStmt()));
3399 EXPECT_TRUE(matches("struct Foo { ~Foo(); };"
3402 EXPECT_FALSE(matches("struct Foo { };"
3408 EXPECT_TRUE(matches("int a[] = { 1, 2 };",
3410 EXPECT_TRUE(matches("struct B { int x, y; }; B b = { 5, 6 };",
3412 EXPECT_TRUE(matches("struct S { S(void (*a)()); };"
3417 matches("int i[1] = {42, [0] = 43};", integerLiteral(equals(42))));
3421 EXPECT_TRUE(matches("namespace X { int x; } using X::x;",
3426 EXPECT_TRUE(matches("namespace f { int a; } using f::a;",
3431 EXPECT_TRUE(matches("namespace f { int a; void b(); } using f::b;",
3440 EXPECT_TRUE(matches(
3449 EXPECT_TRUE(matches("namespace X { int x; } using namespace X;",
3452 matches("namespace X { int x; } using X::x;", usingDirectiveDecl()));
3458 EXPECT_TRUE(matches("void f() {int a = 4;}", SingleDeclStmt));
3467 EXPECT_TRUE(matches("void f() {int a = 4;}",
3469 EXPECT_TRUE(matches("void f() {int a = 4, b = 3;}",
3479 EXPECT_TRUE(matches("void f() {int i,j;}",
3489 EXPECT_TRUE(matches("void x() { while(true); }", whileStmt()));
3494 EXPECT_TRUE(matches("void x() { do {} while(true); }", doStmt()));
3495 EXPECT_TRUE(matches("void x() { do ; while(false); }", doStmt()));
3503 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchCase()));
3504 EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchCase()));
3505 EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchCase()));
3510 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchStmt()));
3511 EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchStmt()));
3512 EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchStmt()));
3519 EXPECT_TRUE(matches("void x() { switch(42) case 42:; }",
3521 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }",
3526 EXPECT_TRUE(matches("void x() { switch(42) { case 1+1: case 4:; } }",
3542 EXPECT_TRUE(matches(
3548 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxCatchStmt()));
3549 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxTryStmt()));
3552 EXPECT_TRUE(matches("void foo() try { throw; } catch(int X) { }",
3554 EXPECT_TRUE(matches("void foo() try { throw 5;} catch(int X) { }",
3556 EXPECT_TRUE(matches("void foo() try { throw; } catch(...) { }",
3560 EXPECT_TRUE(matches("void foo() try {} catch(int X) { }",
3576 EXPECT_TRUE(matches(
3662 // ... return InnerMatcher.matches(...); ...
3665 // On the other hand, if there are multiple alternative matches
3666 // (for example forEach*) or matches might be discarded (for example has*)
3667 // the implementation must make sure that the discarded matches do not
3670 // - matches a simple node, and binds it as the first thing in the matcher:
3675 // the direct parent matches the inner matcher.
3821 EXPECT_TRUE(matches(
3825 EXPECT_TRUE(matches(
3832 EXPECT_TRUE(matches(
3839 EXPECT_TRUE(matches(
3848 EXPECT_TRUE(matches(
3856 EXPECT_TRUE(matches(
3869 EXPECT_TRUE(matches(
3893 matches("template<typename T> class A { T i; }; class Y { A<int> a; };",
3903 EXPECT_TRUE(matches("template<typename T> struct A { A() { T i; } };"
3915 matches("template<typename T> void A(T t) { T i; } void x() { A(0); }",
3926 matches("template<typename T> void A(T t) { T i; } void x() { A(0); }",
3942 EXPECT_TRUE(matches(
3981 EXPECT_TRUE(matches(
3985 EXPECT_TRUE(matches(
3992 EXPECT_TRUE(matches(
4004 EXPECT_TRUE(matches(
4011 EXPECT_TRUE(matches(
4017 EXPECT_TRUE(matches(
4056 EXPECT_TRUE(matches(
4064 EXPECT_TRUE(matches(
4072 EXPECT_TRUE(matches(
4084 EXPECT_TRUE(matches(
4095 EXPECT_TRUE(matches(
4103 matches("template <typename T> struct C { static void f() { 42; } };"
4109 EXPECT_TRUE(matches(
4146 EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
4150 EXPECT_TRUE(matches("struct S { void func(); };",
4155 EXPECT_TRUE(matches("int a[] = {2,3};", arrayType()));
4156 EXPECT_TRUE(matches("int a[42];", arrayType()));
4157 EXPECT_TRUE(matches("void f(int b) { int a[b]; }", arrayType()));
4162 EXPECT_TRUE(matches(
4165 EXPECT_TRUE(matches(
4168 EXPECT_TRUE(matches(
4183 EXPECT_TRUE(matches("int a[2];",
4185 EXPECT_TRUE(matches("const int a = 0;", qualType(isInteger())));
4189 EXPECT_TRUE(matches("void f(int i[]);", valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))));
4194 EXPECT_TRUE(matches("_Complex float f;", complexType()));
4195 EXPECT_TRUE(matches(
4204 EXPECT_TRUE(matches("int a[2];", constantArrayType()));
4209 EXPECT_TRUE(matches("int a[42];", constantArrayType(hasSize(42))));
4210 EXPECT_TRUE(matches("int b[2*21];", constantArrayType(hasSize(42))));
4215 EXPECT_TRUE(matches(
4224 EXPECT_TRUE(matches("int a[] = { 2, 3 };", incompleteArrayType()));
4225 EXPECT_TRUE(matches("void f(int a[]) {}", incompleteArrayType()));
4232 EXPECT_TRUE(matches("void f(int b) { int a[b]; }", variableArrayType()));
4235 EXPECT_TRUE(matches(
4245 EXPECT_TRUE(matches("_Atomic(int) i;", atomicType()));
4247 EXPECT_TRUE(matches("_Atomic(int) i;",
4255 EXPECT_TRUE(matches("auto i = 2;", autoType()));
4256 EXPECT_TRUE(matches("int v[] = { 2, 3 }; void f() { for (int i : v) {} }",
4261 //EXPECT_TRUE(matches("auto a = 1;",
4268 EXPECT_TRUE(matches("int (*f)(int);", functionType()));
4269 EXPECT_TRUE(matches("void f(int i) {}", functionType()));
4274 matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType())))));
4277 EXPECT_TRUE(matches(
4297 EXPECT_TRUE(matches(
4300 EXPECT_TRUE(matches(
4303 EXPECT_TRUE(matches(
4310 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
4326 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
4338 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
4340 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
4352 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
4356 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
4370 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
4372 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
4376 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
4378 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
4382 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
4386 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
4391 EXPECT_TRUE(matches("int b; int &a = b;",
4393 EXPECT_TRUE(matches("int *a;", pointerType(pointee(builtinType()))));
4395 EXPECT_TRUE(matches("int *a;",
4398 EXPECT_TRUE(matches(
4407 EXPECT_TRUE(matches("int b; int * const a = &b;",
4409 EXPECT_TRUE(matches("int b; int * const a = &b;",
4411 EXPECT_TRUE(matches(
4414 EXPECT_TRUE(matches(
4420 EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
4425 EXPECT_TRUE(matches("template <typename T> class A{}; A<int> a;",
4430 EXPECT_TRUE(matches("class C{}; C c;", recordType()));
4431 EXPECT_TRUE(matches("struct S{}; S s;",
4438 EXPECT_TRUE(matches(
4445 EXPECT_TRUE(matches("class C {} c;", elaboratedType()));
4450 EXPECT_TRUE(matches(
4471 EXPECT_TRUE(matches(
4494 EXPECT_FALSE(matches(code, binaryOperator(hasLHS(
4496 EXPECT_TRUE(matches(code, binaryOperator(hasRHS(
4501 EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;",
4503 EXPECT_TRUE(matches("template <typename T> class A { typename T::B b; };",
4505 EXPECT_TRUE(matches("struct A { void f(); }; void A::f() {}",
4507 EXPECT_TRUE(matches("namespace a { namespace b {} } namespace ab = a::b;",
4510 EXPECT_TRUE(matches(
4519 EXPECT_TRUE(matches("void f() {int i;;}", nullStmt()));
4525 EXPECT_TRUE(matches("namespace {}", namespaceDecl(isAnonymous())));
4529 EXPECT_TRUE(matches("namespace test {} namespace alias = ::test;",
4536 EXPECT_TRUE(matches("struct A { struct B {}; }; A::B b;", Matcher));
4537 EXPECT_TRUE(matches("struct A { struct B { struct C {}; }; }; A::B::C c;",
4545 EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;", Matcher));
4565 EXPECT_TRUE(matches(
4568 EXPECT_TRUE(matches(
4578 EXPECT_TRUE(matches(
4588 EXPECT_TRUE(matches(
4607 EXPECT_TRUE(matches(
4623 EXPECT_TRUE(matches(
4633 EXPECT_TRUE(matches(
4650 EXPECT_TRUE(matches(
4842 EXPECT_TRUE(matches(
4861 matches("void f() { if(true) {} }",
4871 EXPECT_TRUE(matches(
4882 EXPECT_TRUE(matches(
4945 EXPECT_FALSE(matches(
4962 EXPECT_TRUE(matches("typedef int typedefDeclTest;",
4967 EXPECT_TRUE(matches("void g(); inline void f();",
4969 EXPECT_TRUE(matches("namespace n { inline namespace m {} }",
4977 EXPECT_TRUE(matches("class X {};",