reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
   39       matches("const int a = 0;",
   92   EXPECT_TRUE(matches("void x() { class B {}; }", StatementHasClassB));
  176   EXPECT_TRUE(matches("void g(); inline void f();",
  178   EXPECT_TRUE(matches("namespace n { inline namespace m {} }",
  187   EXPECT_TRUE(matches("class X {};",
tools/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
   27   EXPECT_TRUE(matches(Program,
   30   EXPECT_TRUE(matches(Program,
   35   EXPECT_TRUE(matches(Program,
   41   EXPECT_TRUE(matches(Program,
   52   EXPECT_TRUE(matches("class Y { class X {}; };", HasClassX));
   53   EXPECT_TRUE(matches("class X {};", HasClassX));
   57   EXPECT_TRUE(matches("class Y { class X {}; };", YHasClassX));
   76   EXPECT_TRUE(matches(
   88   EXPECT_TRUE(matches(
  102   EXPECT_TRUE(matches(
  141   EXPECT_TRUE(matches("class F {};", Recursive));
  142   EXPECT_TRUE(matches("class Z {};", Recursive));
  143   EXPECT_TRUE(matches("class C {};", Recursive));
  144   EXPECT_TRUE(matches("class M { class N { class X {}; }; };", Recursive));
  145   EXPECT_TRUE(matches("class M { class N { class B {}; }; };", Recursive));
  147     matches("class O1 { class O2 {"
  159   EXPECT_TRUE(matches("class Y {}; class Z : public Y {};", NotClassX));
  171   EXPECT_TRUE(matches("class X { class Z {}; };", ClassXHasNotClassY));
  177   EXPECT_TRUE(matches("void Foo(){}", NamedNotRecord));
  182   EXPECT_TRUE(matches("char *p = 0;",
  186   EXPECT_TRUE(matches("char *p = 0;",
  195   EXPECT_TRUE(matches("class Z { class X {}; };", ZDescendantClassX));
  197     matches("class Z { class Y { class X {}; }; };", ZDescendantClassX));
  199     matches("class Z { class A { class Y { class X {}; }; }; };",
  202     matches("class Z { class A { class B { class Y { class X {}; }; }; }; };",
  211   EXPECT_TRUE(matches("class Z { class X { class Y {}; }; };",
  214     matches("class Z { class A { class B { class X { class Y {}; }; }; }; };",
  235     matches("class Z { class A { class X { class B { class Y {}; }; }; }; };",
  237   EXPECT_TRUE(matches(
  253   EXPECT_TRUE(matches("void f() { int i; }", CannotMemoize));
  266   EXPECT_TRUE(matches("void f() { int i; }",
  284   EXPECT_TRUE(matches("struct __attribute__((warn_unused)) X {};",
  286   EXPECT_FALSE(matches("struct X {};",
  294   EXPECT_TRUE(matches("class X {}; class Z : public X {};", YOrZDerivedFromX));
  295   EXPECT_TRUE(matches("class Y {};", YOrZDerivedFromX));
  302   EXPECT_TRUE(matches("class X {};", XOrYOrZOrU));
  308   EXPECT_TRUE(matches("class X {};", XOrYOrZOrUOrV));
  309   EXPECT_TRUE(matches("class Y {};", XOrYOrZOrUOrV));
  310   EXPECT_TRUE(matches("class Z {};", XOrYOrZOrUOrV));
  311   EXPECT_TRUE(matches("class U {};", XOrYOrZOrUOrV));
  312   EXPECT_TRUE(matches("class V {};", XOrYOrZOrUOrV));
  316   EXPECT_TRUE(matches("int F() { return 1 + 2; }", MixedTypes));
  317   EXPECT_TRUE(matches("int F() { if (true) return 1; }", MixedTypes));
  321     matches("void f() try { } catch (int) { } catch (...) { }",
  328   EXPECT_TRUE(matches("class X {}; class Y : public X {};", IsDerivedFromX));
  338       matches("class X {}; class Y : public X {};", IsDirectlyDerivedFromX));
  346   EXPECT_TRUE(matches("class X {}; class Y : public X {};", IsAX));
  347   EXPECT_TRUE(matches("class X {};", IsAX));
  348   EXPECT_TRUE(matches("class X;", IsAX));
  357     matches("class X {}; class Y : public X {}; class Z : public Y {};",
  363     matches("class X {};"
  370   EXPECT_TRUE(matches("class X {}; template<class T> class Z : public X {};",
  373     matches("template<class T> class X {}; "
  377     matches("template<class T, class U=T> class X {}; "
  384     matches("template<class X> class A { public: class Z : public X {}; }; "
  387     matches("template <class T> class X {}; "
  394     matches("template<template<class T> class X> class A { "
  402     matches("template<class X> class A { public: "
  407     matches("class X {}; typedef X Y; class Z : public Y {};",
  410     matches("template<class T> class Y { typedef typename T::U X; "
  412   EXPECT_TRUE(matches("class X {}; class Z : public ::X {};",
  419     matches("template<class T> class X { public: typedef X<T> D; }; "
  427     matches("class X {}; typedef X V; typedef V W; class Z : public W {};",
  430     matches("class X {}; class Y : public X {}; "
  437     matches("template<class T, class U> class X {}; "
  445     matches("class X {}; typedef X A; typedef A B; "
  448     matches("class X {}; typedef X A; typedef A B; typedef B C; "
  451     matches("class U {}; typedef U X; typedef X V; "
  454     matches("class Base {}; typedef Base X; "
  457     matches("class Base {}; typedef Base Base2; typedef Base2 X; "
  463     matches("class A {}; typedef A X; typedef A Y; "
  471     matches("template <typename T> class X;"
  475   EXPECT_TRUE(matches(
  485   EXPECT_TRUE(matches(
  513   EXPECT_TRUE(matches(
  521   EXPECT_TRUE(matches(
  538   EXPECT_TRUE(matches(
  546   EXPECT_TRUE(matches(
  551   EXPECT_TRUE(matches(
  558   EXPECT_TRUE(matches(
  562   EXPECT_TRUE(matches(
  683   EXPECT_TRUE(matches("auto x = []{};", IsLambda));
  742     matches("class Y { public: void x(); }; void z() {Y* y; y->x(); }",
  745     matches("class X { void x(int x) {} };",
  747   EXPECT_TRUE(matches("namespace ns { struct A {}; }  struct B { ns::A a; };",
  749   EXPECT_TRUE(matches("namespace { struct A {}; }  struct B { A a; };",
  756   EXPECT_TRUE(matches("class Y { }; "
  767   EXPECT_TRUE(matches("class Y; int operator*(Y &); void f(Y &y) { *y; }",
  771   EXPECT_TRUE(matches("class Y { int operator*(); };",
  776   EXPECT_TRUE(matches("class Y; int operator*(Y &);", AnyOpStar));
  777   EXPECT_TRUE(matches("class Y { int operator*(); };", AnyOpStar));
  788   EXPECT_TRUE(matches("class Y { }; "
  793     matches("class Y { }; "
  801   EXPECT_TRUE(matches("void f() { int X; }", M));
  807   EXPECT_TRUE(matches("int X;", M));
  808   EXPECT_TRUE(matches("void f() { static int X; }", M));
  813   EXPECT_TRUE(matches("void f() { static int X; }", M));
  823   EXPECT_TRUE(matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration())));
  829   EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration())));
  830   EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration())));
  831   EXPECT_TRUE(matches(T, varDecl(hasName("b"), hasStaticStorageDuration())));
  832   EXPECT_TRUE(matches(T, varDecl(hasName("c"), hasStaticStorageDuration())));
  845   EXPECT_TRUE(matches(
  851   EXPECT_TRUE(matches("void x() { int a = sizeof(a); }", sizeOfExpr(
  855   EXPECT_TRUE(matches(
  863   EXPECT_TRUE(matches("int i = 0;", varDecl(hasType(isInteger()))));
  864   EXPECT_TRUE(matches(
  878   EXPECT_TRUE(matches("int i = 0;", varDecl(hasType(isSignedInteger()))));
  885   EXPECT_TRUE(matches("unsigned i = 0;",
  890   EXPECT_TRUE(matches("int* i = nullptr;", varDecl(hasType(isAnyPointer()))));
  903   EXPECT_TRUE(matches("char i = 0;", varDecl(hasType(isAnyCharacter()))));
  911   EXPECT_TRUE(matches("class Y { void x() { this->y; } int y; };",
  913   EXPECT_TRUE(matches("class Y { void x() { y; } int y; };",
  917   EXPECT_TRUE(matches("template <class T> class Y { void x() { this->m; } };",
  925   EXPECT_TRUE(matches("class Y { void x() { this->y; } static int y; };",
  934   EXPECT_TRUE(matches("class Y { void x() { this->x(); } };",
  936   EXPECT_TRUE(matches("class Y { void x() { x(); } };",
  941       matches("class Y { template <class T> void x() { this->x<T>(); } };",
  943   EXPECT_TRUE(matches("class Y { template <class T> void x() { x<T>(); } };",
  951   EXPECT_TRUE(matches("struct S { explicit operator int(); };",
  969   EXPECT_TRUE(matches("void x(int) { x(0); }", Call1Arg));
  970   EXPECT_TRUE(matches("class X { void x(int) { x(0); } };", Call1Arg));
  976   EXPECT_TRUE(matches("void f(int i) {}", Function1Arg));
  977   EXPECT_TRUE(matches("class X { void f(int i) {} };", Function1Arg));
  980   EXPECT_TRUE(matches("void f(int i, ...) {};", Function1Arg));
  986   EXPECT_TRUE(matches("class X {}; void y(X y) { X &x = y; }",
  989     matches("class X {}; void y(X y) { const X &x = y; }", ReferenceClassX));
  993     matches("class X {}; void y(X y) { X x = y; }", ReferenceClassX));
 1003   EXPECT_TRUE(matches("int *const j = nullptr;",
 1005   EXPECT_TRUE(matches("int *volatile k;",
 1012   EXPECT_TRUE(matches("extern \"C\" void f() {}", functionDecl(isExternC())));
 1013   EXPECT_TRUE(matches("extern \"C\" { void f() {} }",
 1019   EXPECT_TRUE(matches("extern \"C\" int i;", varDecl(isExternC())));
 1020   EXPECT_TRUE(matches("extern \"C\" { int i; }", varDecl(isExternC())));
 1026       matches("static void f() {}", functionDecl(isStaticStorageClass())));
 1027   EXPECT_TRUE(matches("static int i = 1;", varDecl(isStaticStorageClass())));
 1036   EXPECT_TRUE(matches("class B { ~B() = default; };",
 1043   EXPECT_TRUE(matches("void Func() = delete;",
 1052   EXPECT_TRUE(matches("void f() throw();", functionDecl(isNoThrow())));
 1053   EXPECT_TRUE(matches("void f() noexcept;", functionDecl(isNoThrow())));
 1059   EXPECT_TRUE(matches("void f() throw();", functionProtoType(isNoThrow())));
 1060   EXPECT_TRUE(matches("void f() noexcept;", functionProtoType(isNoThrow())));
 1064   EXPECT_TRUE(matches("constexpr int foo = 42;",
 1066   EXPECT_TRUE(matches("constexpr int bar();",
 1068   EXPECT_TRUE(matches("void baz() { if constexpr(1 > 0) {} }",
 1076     matches("template<typename T> struct C {}; C<int> c;",
 1082   EXPECT_TRUE(matches("template<typename T> struct C {}; C<int> c;",
 1090   EXPECT_TRUE(matches("template<int T> struct C {}; C<42> c;",
 1099   EXPECT_TRUE(matches("template<int T> struct C {}; C<42> c;",
 1102   EXPECT_TRUE(matches("template<int T> struct C {}; C<-42> c;",
 1105   EXPECT_TRUE(matches("template<int T> struct C {}; C<-0042> c;",
 1114   EXPECT_TRUE(matches("class C { public: int i; };", accessSpecDecl()));
 1116       matches("class C { public: int i; };", accessSpecDecl(isPublic())));
 1126   EXPECT_TRUE(matches("class X final {};", cxxRecordDecl(isFinal())));
 1127   EXPECT_TRUE(matches("class X { virtual void f() final; };",
 1135   EXPECT_TRUE(matches("class X { virtual int f(); };",
 1141   EXPECT_TRUE(matches("class A { virtual int f(); };"
 1151   EXPECT_TRUE(matches("class X { virtual int f() = 0; };",
 1157   EXPECT_TRUE(matches("class X { X &operator=(X); };",
 1159   EXPECT_TRUE(matches("class X { X &operator=(X &); };",
 1161   EXPECT_TRUE(matches("class X { X &operator=(const X &); };",
 1163   EXPECT_TRUE(matches("class X { X &operator=(volatile X &); };",
 1165   EXPECT_TRUE(matches("class X { X &operator=(const volatile X &); };",
 1174   EXPECT_TRUE(matches("class X { X &operator=(X &&); };",
 1176   EXPECT_TRUE(matches("class X { X &operator=(const X &&); };",
 1178   EXPECT_TRUE(matches("class X { X &operator=(volatile X &&); };",
 1180   EXPECT_TRUE(matches("class X { X &operator=(const volatile X &&); };",
 1188     matches("struct A { void foo() const; };", cxxMethodDecl(isConst())));
 1194   EXPECT_TRUE(matches("class X { virtual int f(); }; "
 1206     matches("template <typename Base> struct Y : Base { void f() override;};",
 1215     matches("class X { public: X(int); }; void x() { int y; X x(y); }",
 1218     matches("class X { public: X(int); }; void x() { int y; X x = X(y); }",
 1221     matches("class X { public: X(int); }; void x() { int y; X x = y; }",
 1238     matches("class X { public: X(int); }; void x() { X x(0); }",
 1241     matches("class X { public: X(int); }; void x() { X x = X(0); }",
 1244     matches("class X { public: X(int); }; void x() { X x = 0; }",
 1256     matches("class X { public: X(int); }; void x() { X x{0}; }",
 1259     matches("class X { public: X(int); }; void x() { X x(0); }",
 1269   EXPECT_TRUE(matches("class Foo { }; Foo* f = new Foo();",
 1271   EXPECT_TRUE(matches("class Foo { Foo(){} };",
 1274   EXPECT_TRUE(matches("struct A { int x; } a = {0}, b = a; void f() { a = b; }",
 1279   EXPECT_TRUE(matches("struct S { explicit S(int); };",
 1318   EXPECT_TRUE(matches(
 1331   EXPECT_TRUE(matches(
 1344   EXPECT_TRUE(matches(
 1357     matches("struct S { S(); };", cxxConstructorDecl(isUserProvided())));
 1358   EXPECT_TRUE(matches("struct S { S(); }; S::S(){}",
 1367   EXPECT_TRUE(matches(
 1370   EXPECT_TRUE(matches(
 1377   EXPECT_TRUE(matches("const char *s = \"abcd\";", Literal));
 1379   EXPECT_TRUE(matches("const wchar_t *s = L\"abcd\";", Literal));
 1381   EXPECT_TRUE(matches("const char *s = \"\x05\x06\x07\x08\";", Literal));
 1387   EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
 1389   EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
 1391   EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
 1393   EXPECT_TRUE(matches("namespace a { namespace b { class C; } }",
 1415     matches("class A { class B { class C; }; };",
 1418     matches("class A { class B { class C; }; };",
 1421     matches("class A { class B { class C; }; };",
 1424     matches("class A { class B { class C; }; };",
 1450   EXPECT_TRUE(matches(code, recordDecl(hasName("a::b::C"))));
 1451   EXPECT_TRUE(matches(code, recordDecl(hasName("a::C"))));
 1452   EXPECT_TRUE(matches(code, recordDecl(hasName("::a::b::C"))));
 1453   EXPECT_TRUE(matches(code, recordDecl(hasName("::a::C"))));
 1459     matches(code, recordDecl(hasName("a::(anonymous namespace)::C"))));
 1460   EXPECT_TRUE(matches(code, recordDecl(hasName("a::C"))));
 1462     matches(code, recordDecl(hasName("::a::(anonymous namespace)::C"))));
 1463   EXPECT_TRUE(matches(code, recordDecl(hasName("::a::C"))));
 1467   EXPECT_TRUE(matches("class A { class { class C; } x; };",
 1469   EXPECT_TRUE(matches("class A { class { class C; } x; };",
 1471   EXPECT_FALSE(matches("class A { class { class C; } x; };",
 1473   EXPECT_TRUE(matches("class A { struct { class C; } x; };",
 1475   EXPECT_TRUE(matches("class A { struct { class C; } x; };",
 1477   EXPECT_FALSE(matches("class A { struct { class C; } x; };",
 1484   EXPECT_TRUE(matches(code, varDecl(hasName("i"))));
 1485   EXPECT_FALSE(matches(code, varDecl(hasName("F()::i"))));
 1487   EXPECT_TRUE(matches(code, fieldDecl(hasName("m"))));
 1488   EXPECT_TRUE(matches(code, fieldDecl(hasName("S::m"))));
 1489   EXPECT_TRUE(matches(code, fieldDecl(hasName("F(int)::S::m"))));
 1490   EXPECT_TRUE(matches(code, fieldDecl(hasName("a::F(int)::S::m"))));
 1491   EXPECT_TRUE(matches(code, fieldDecl(hasName("::a::F(int)::S::m"))));
 1497   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "a::b::C"))));
 1498   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("a::b::C", "XX"))));
 1499   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX::C", "a::b::C"))));
 1500   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "C"))));
 1504     matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C"))));
 1507   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName(Names))));
 1513   EXPECT_TRUE(matches("class A {};", DefinitionOfClassA));
 1518   EXPECT_TRUE(matches("int a;", DefinitionOfVariableA));
 1523   EXPECT_TRUE(matches("class A { void a() {} };", DefinitionOfMethodA));
 1542   EXPECT_TRUE(matches(
 1576   EXPECT_TRUE(matches("void f() { }",
 1583   EXPECT_TRUE(matches("void f() { 1; }",
 1592   EXPECT_TRUE(matches("void f() { 1; 2; 3; }",
 1597   EXPECT_TRUE(matches("void f() { { 1; } { 1; 2; 3; 4; } }",
 1599   EXPECT_TRUE(matches("void f() { { 1; } { 1; 2; 3; 4; } }",
 1603   EXPECT_TRUE(matches("void f() { { 1; } { 1; 2; 3; 4; } }",
 1608   EXPECT_TRUE(matches("struct { int first; } s; int i(s.first);",
 1620   EXPECT_TRUE(matches("void f() {"
 1628   EXPECT_TRUE(matches(
 1637   EXPECT_TRUE(matches("class C { int a : 2; int b; };",
 1641   EXPECT_TRUE(matches("class C { int a : 2; int b : 4; };",
 1647       matches("class C { int a = 2; int b; };",
 1656   EXPECT_TRUE(matches(
 1667   EXPECT_TRUE(matches(
 1672   EXPECT_TRUE(matches("class A { protected: int i; };",
 1692       matches("void j() throw();", functionDecl(hasDynamicExceptionSpec())));
 1694       matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec())));
 1696       matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec())));
 1706       matches("void j() throw();", functionProtoType(hasDynamicExceptionSpec())));
 1708       matches("void k() throw(int);", functionProtoType(hasDynamicExceptionSpec())));
 1710       matches("void l() throw(...);", functionProtoType(hasDynamicExceptionSpec())));
 1720   EXPECT_TRUE(matches(
 1723   EXPECT_TRUE(matches(
 1727   EXPECT_TRUE(matches("template <class T> struct X { void f() { T t; t.m; } };",
 1731       matches("template <class T> struct X { void f() { T t; t->m; } };",
 1737   EXPECT_TRUE(matches(
 1740   EXPECT_TRUE(matches("struct X { template <class T> void f(); };"
 1744   EXPECT_TRUE(matches("template <class T> void f(T t) { t.g(); }",
 1751   EXPECT_TRUE(matches(
 1755   EXPECT_TRUE(matches(
 1769   EXPECT_TRUE(matches("class X { int m; };", fieldDecl(hasName("m"))));
 1773   EXPECT_TRUE(matches("volatile int i = 42;",
 1777   EXPECT_TRUE(matches("typedef volatile int v_int; v_int i = 42;",
 1782   EXPECT_TRUE(matches("const int i = 42;",
 1787   EXPECT_TRUE(matches("int i = 42; int* const p(&i);",
 1792   EXPECT_TRUE(matches("typedef const int const_int; const_int i = 42;",
 1794   EXPECT_TRUE(matches("typedef int* int_ptr; const int_ptr p(0);",
 1806   EXPECT_TRUE(matches("void f() {int i,j;}",
 1844   EXPECT_TRUE(matches(
 1848   EXPECT_TRUE(matches(
 1855   EXPECT_TRUE(matches(
 1862   EXPECT_TRUE(matches(
 1871       matches("template <typename T> class X { void f() { T t; } };"
 1879   EXPECT_TRUE(matches(
 1887   EXPECT_TRUE(matches(
 1900   EXPECT_TRUE(matches(
 1924     matches("template<typename T> class A { T i; }; class Y { A<int> a; };",
 1934   EXPECT_TRUE(matches("template<typename T> struct A { A() { T i; } };"
 1946     matches("template<typename T> void A(T t) { T i; } void x() { A(0); }",
 1957     matches("template<typename T> void A(T t) { T i; } void x() { A(0); }",
 1973   EXPECT_TRUE(matches(
 1979   EXPECT_TRUE(matches(
 1985   EXPECT_TRUE(matches("template<int T> int f() { return T; }",
 1990   EXPECT_TRUE(matches("template<typename T> T f() { return T(); }",
 1995   EXPECT_TRUE(matches("template<typename T> T f() { return T(); }",
 2005   EXPECT_TRUE(matches("template<int T> int f() { return T; }",
 2010   EXPECT_TRUE(matches("template<typename T> T f() { return T(); }",
 2015   EXPECT_TRUE(matches(
 2054   EXPECT_TRUE(matches(
 2058   EXPECT_TRUE(matches(
 2086   EXPECT_TRUE(matches("[[noreturn]] void func();", functionDecl(isNoReturn())));
 2088       matches("[[noreturn]] void func() {}", functionDecl(isNoReturn())));
 2090   EXPECT_TRUE(matches("struct S { [[noreturn]] void func(); };",
 2092   EXPECT_TRUE(matches("struct S { [[noreturn]] void func() {} };",
 2095   EXPECT_TRUE(matches("struct S { [[noreturn]] static void func(); };",
 2097   EXPECT_TRUE(matches("struct S { [[noreturn]] static void func() {} };",
 2101       matches("struct S { [[noreturn]] S(); };", functionDecl(isNoReturn())));
 2102   EXPECT_TRUE(matches("struct S { [[noreturn]] S() {} };",
 2107   EXPECT_TRUE(matches("__attribute__((noreturn)) void func();",
 2109   EXPECT_TRUE(matches("__attribute__((noreturn)) void func() {}",
 2112   EXPECT_TRUE(matches("struct S { __attribute__((noreturn)) void func(); };",
 2114   EXPECT_TRUE(matches("struct S { __attribute__((noreturn)) void func() {} };",
 2118       matches("struct S { __attribute__((noreturn)) static void func(); };",
 2121       matches("struct S { __attribute__((noreturn)) static void func() {} };",
 2124   EXPECT_TRUE(matches("struct S { __attribute__((noreturn)) S(); };",
 2126   EXPECT_TRUE(matches("struct S { __attribute__((noreturn)) S() {} };",
 2143   EXPECT_TRUE(matches("struct S { bool func(); };",
 2150   EXPECT_TRUE(matches("struct S { void func(); };",
 2155   EXPECT_TRUE(matches("struct S { float func(); };",
 2159   EXPECT_TRUE(matches("struct S { long double func(); };",
 2164   EXPECT_TRUE(matches("int a[] = {2,3};", arrayType()));
 2165   EXPECT_TRUE(matches("int a[42];", arrayType()));
 2166   EXPECT_TRUE(matches("void f(int b) { int a[b]; }", arrayType()));
 2171   EXPECT_TRUE(matches(
 2174   EXPECT_TRUE(matches(
 2177   EXPECT_TRUE(matches(
 2192   EXPECT_TRUE(matches("int a[2];",
 2194   EXPECT_TRUE(matches("const int a = 0;", qualType(isInteger())));
 2198   EXPECT_TRUE(matches("void f(int i[]);", valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))));
 2203   EXPECT_TRUE(matches("_Complex float f;", complexType()));
 2204   EXPECT_TRUE(matches(
 2214   EXPECT_TRUE(matches("namespace {}", namespaceDecl(isAnonymous())));
 2229   EXPECT_TRUE(matches("namespace std {"
 2233   EXPECT_TRUE(matches("namespace std {"
 2252       matches("namespace std {"
 2269   EXPECT_TRUE(matches(
 2288     matches("void f() { if(true) {} }",
 2298   EXPECT_TRUE(matches(
 2309   EXPECT_TRUE(matches(
 2372   EXPECT_FALSE(matches(
 2389   EXPECT_TRUE(matches("#define NULL ((void *)0)\n"
 2391   EXPECT_TRUE(matches("void *v2 = nullptr;", expr(nullPointerConstant())));
 2392   EXPECT_TRUE(matches("void *v3 = __null;", expr(nullPointerConstant())));
 2393   EXPECT_TRUE(matches("char *cp = (char *)0;", expr(nullPointerConstant())));
 2394   EXPECT_TRUE(matches("int *ip = 0;", expr(nullPointerConstant())));
 2395   EXPECT_TRUE(matches("int i = 0;", expr(nullPointerConstant())));
 2399   EXPECT_TRUE(matches("int a = 0;", namedDecl(hasExternalFormalLinkage())));
 2404   EXPECT_TRUE(matches("void f(void) { int a = 0; }",
 2410   EXPECT_TRUE(matches("namespace { int a = 0; }",
 2415   EXPECT_TRUE(matches("void x(int val = 0) {}", 
 2422   EXPECT_TRUE(matches("struct MyClass {}; MyClass *p1 = new MyClass[10];",
 2427   EXPECT_TRUE(matches("struct MyClass {}; MyClass *p1 = new MyClass[10];",
 2432   EXPECT_TRUE(matches("struct x {};",
 2439   EXPECT_TRUE(matches("class x {};",
 2446   EXPECT_TRUE(matches("union x {};",
 2453   EXPECT_TRUE(matches("enum class X {};", enumDecl(isScoped())));
 2458   EXPECT_TRUE(matches("auto Y() -> int { return 0; }",
 2460   EXPECT_TRUE(matches("auto X() -> int;", functionDecl(hasTrailingReturn())));
 2468   EXPECT_TRUE(matches(
 2481   EXPECT_TRUE(matches("void x() { int a; a += 1; }", BinAsgmtOperator));
 2482   EXPECT_TRUE(matches("void x() { int a; a = 2; }", BinAsgmtOperator));
 2483   EXPECT_TRUE(matches("void x() { int a; a &= 3; }", BinAsgmtOperator));
 2484   EXPECT_TRUE(matches("struct S { S& operator=(const S&); };"
 2493     matches("int x{0};",
 2496     matches("int x{0};",
 2499     matches("int x;",
 2505     matches("int main() {}", functionDecl(isMain())));
tools/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
   35   EXPECT_TRUE(matches("namespace x { class X {}; } using x::X;",
   41   EXPECT_TRUE(matches("typedef int X;", NamedX));
   42   EXPECT_TRUE(matches("int X;", NamedX));
   43   EXPECT_TRUE(matches("class foo { virtual void X(); };", NamedX));
   44   EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", NamedX));
   45   EXPECT_TRUE(matches("void foo() { int X; }", NamedX));
   46   EXPECT_TRUE(matches("namespace X { }", NamedX));
   47   EXPECT_TRUE(matches("enum X { A, B, C };", NamedX));
   54   EXPECT_TRUE(matches("typedef int Xa;", NamedX));
   55   EXPECT_TRUE(matches("int Xb;", NamedX));
   56   EXPECT_TRUE(matches("class foo { virtual void Xc(); };", NamedX));
   57   EXPECT_TRUE(matches("void foo() try { } catch(int Xdef) { }", NamedX));
   58   EXPECT_TRUE(matches("void foo() { int Xgh; }", NamedX));
   59   EXPECT_TRUE(matches("namespace Xij { }", NamedX));
   60   EXPECT_TRUE(matches("enum X { A, B, C };", NamedX));
   65   EXPECT_TRUE(matches("int no_foo;", StartsWithNo));
   66   EXPECT_TRUE(matches("class foo { virtual void nobody(); };", StartsWithNo));
   69   EXPECT_TRUE(matches("int abc;", Abc));
   70   EXPECT_TRUE(matches("int aFOObBARc;", Abc));
   72   EXPECT_TRUE(matches("int cabc;", Abc));
   75   EXPECT_TRUE(matches("int k;", StartsWithK));
   76   EXPECT_TRUE(matches("int kAbc;", StartsWithK));
   77   EXPECT_TRUE(matches("namespace x { int kTest; }", StartsWithK));
   78   EXPECT_TRUE(matches("class C { int k; };", StartsWithK));
   88   EXPECT_FALSE(matches("", ClassMatcher));
   91   EXPECT_TRUE(matches("class X;", ClassX));
   92   EXPECT_TRUE(matches("class X {};", ClassX));
   93   EXPECT_TRUE(matches("template<class T> class X {};", ClassX));
  102   EXPECT_TRUE(matches(
  104   EXPECT_FALSE(matches(
  106   EXPECT_TRUE(matches(
  113   EXPECT_TRUE(matches("extern \"C\" { void foo() {}; }", linkageSpecDecl()));
  125   EXPECT_TRUE(matches("template<typename T> class X {};", ClassX));
  126   EXPECT_TRUE(matches("class Z { template<class T> class X {}; };", ClassX));
  156   EXPECT_TRUE(matches("enum EnumType { EnumValue };",
  158   EXPECT_TRUE(matches("void FunctionDecl();",
  163   EXPECT_TRUE(matches("class Y { friend class X; };",
  165   EXPECT_TRUE(matches("class Y { friend class X; };",
  168   EXPECT_TRUE(matches("class Y { friend void f(); };",
  177   EXPECT_TRUE(matches("enum X {};", enumDecl(hasName("X"))));
  182   EXPECT_TRUE(matches("enum X{ A };", Matcher));
  221   EXPECT_TRUE(matches(MkStr("NS::X x; f(x);"), ADLMatch));
  227   EXPECT_TRUE(matches(MkStr("NS::X x; x + x;"), ADLMatch));
  228   EXPECT_TRUE(matches(MkStr("NS::X x; x + x;"), ADLMatchOper));
  231   EXPECT_TRUE(matches(MkStr("NS::X x; operator+(x, x);"), ADLMatch));
  241   EXPECT_TRUE(matches("class Y { void x() { x(); } };", MethodX));
  248     matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
  251     matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
  267     matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }",
  270     matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }",
  273     matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }",
  283   EXPECT_TRUE(matches("auto f = [] (int i) { return i; };",
  288   EXPECT_TRUE(matches("int as[] = { 1, 2, 3 };"
  296   EXPECT_FALSE(matches("template<int N>\n"
  300   EXPECT_TRUE(matches("template<int N>\n"
  307   EXPECT_TRUE(matches("template <int N> void f();",
  314   EXPECT_TRUE(matches("template <typename T> void f();",
  321   EXPECT_TRUE(matches("constexpr char operator \"\" _inc (const char i) {"
  329   EXPECT_TRUE(matches("void f() { while(true) { break; } }", breakStmt()));
  330   EXPECT_TRUE(matches("void f() { while(true) { continue; } }",
  332   EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", gotoStmt()));
  333   EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}",
  337   EXPECT_TRUE(matches("void f() { FOO: ; void *ptr = &&FOO; goto *ptr; }",
  339   EXPECT_TRUE(matches("void f() { return; }", returnStmt()));
  345   EXPECT_TRUE(matches("class Y { }; "
  359   EXPECT_TRUE(matches("class Y { }; "
  373     matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
  376     matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
  379     matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }",
  382     matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }",
  385     matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }",
  388   EXPECT_TRUE(matches(
  404   EXPECT_TRUE(matches(
  428   EXPECT_TRUE(matches(
  430   EXPECT_TRUE(matches(
  432   EXPECT_TRUE(matches(
  435   EXPECT_TRUE(matches(
  445   EXPECT_TRUE(matches("void x() { int a = sizeof(a); }",
  464   EXPECT_TRUE(matches("class Y { void x() { x(); } };", memberExpr()));
  465   EXPECT_TRUE(matches("class Y { template <class T> void x() { x<T>(); } };",
  467   EXPECT_TRUE(matches("template <class T> void x() { T t; t.f(); }",
  473     matches("class Y { void x() { this->y; } int y; };", memberExpr()));
  475     matches("class Y { void x() { y; } int y; };", memberExpr()));
  477     matches("class Y { void x() { Y y; y.y; } int y; };", memberExpr()));
  478   EXPECT_TRUE(matches("template <class T>"
  481   EXPECT_TRUE(matches("template <class T> class X : T { void f() { T::v; } };",
  483   EXPECT_TRUE(matches("template <class T> void x() { T t; t.v; }",
  488   EXPECT_TRUE(matches("class Y { void x() { this->y; } static int y; };",
  499   EXPECT_TRUE(matches("void f() { f(); }", CallFunctionF));
  506     EXPECT_TRUE(matches("void f(); template <int N> void g() { f(); }",
  509       matches("void f(); template <int N> struct S { void g() { f(); } };",
  522   EXPECT_TRUE(matches("void f(...);", functionDecl(isVariadic())));
  528   EXPECT_TRUE(matches("void f(...);", functionDecl(parameterCountIs(0))));
  530   EXPECT_TRUE(matches("void f(int, ...);", functionDecl(parameterCountIs(1))));
  535     matches("template <typename T> void f(T t) {}",
  555   EXPECT_TRUE(matches("template<typename T> struct A {};"
  558   EXPECT_TRUE(matches("template<typename T> struct A {}; A<int> a;",
  565   EXPECT_TRUE(matches("int x;", declaratorDecl()));
  570   EXPECT_TRUE(matches("void f(int x);", parmVarDecl()));
  578     matches("class X { public: X(); }; void x() { X x; }", Constructor));
  580     matches("class X { public: X(); }; void x() { X x = X(); }",
  583     matches("class X { public: X(int); }; void x() { X x = 0; }",
  585   EXPECT_TRUE(matches("class X {}; void x(int) { X x; }", Constructor));
  589   EXPECT_TRUE(matches("class C { int i; public: C(int ii) : i(ii) {} };",
  595     matches("struct X { int a; int f () { return a; } };", cxxThisExpr()));
  606     matches(ClassString +
  636     matches(ClassString +
  654     matches(ClassString +
  669   EXPECT_TRUE(matches("class X { public: X(); }; void x() { new X; }", New));
  671     matches("class X { public: X(); }; void x() { new X(); }", New));
  673     matches("class X { public: X(int); }; void x() { new X(0); }", New));
  674   EXPECT_TRUE(matches("class X {}; void x(int) { new X; }", New));
  678   EXPECT_TRUE(matches("struct A {}; void f(A* a) { delete a; }",
  685   EXPECT_TRUE(matches("void x(int, int = 0) { int y; x(y); }", Arg));
  687     matches("class X { void x(int, int = 0) { int y; x(y); } };", Arg));
  693   EXPECT_TRUE(matches("const char *s = \"string\";", Literal));
  695   EXPECT_TRUE(matches("const wchar_t *s = L\"string\";", Literal));
  697   EXPECT_TRUE(matches("const char *s = \"\x05five\";", Literal));
  704   EXPECT_TRUE(matches("const char c = 'c';", CharLiteral));
  706   EXPECT_TRUE(matches("const char c = L'c';", CharLiteral));
  714   EXPECT_TRUE(matches("int i = 10;", HasIntLiteral));
  715   EXPECT_TRUE(matches("int i = 0x1AB;", HasIntLiteral));
  716   EXPECT_TRUE(matches("int i = 10L;", HasIntLiteral));
  717   EXPECT_TRUE(matches("int i = 10U;", HasIntLiteral));
  729       matches("int i = -10;",
  736   EXPECT_TRUE(matches("float i = 10.0;", HasFloatLiteral));
  737   EXPECT_TRUE(matches("float i = 10.0f;", HasFloatLiteral));
  738   EXPECT_TRUE(matches("double i = 10.0;", HasFloatLiteral));
  739   EXPECT_TRUE(matches("double i = 10.0L;", HasFloatLiteral));
  740   EXPECT_TRUE(matches("double i = 1e10;", HasFloatLiteral));
  741   EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0))));
  742   EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0f))));
  744     matches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(5.0)))));
  754   EXPECT_TRUE(matches("int* i = nullptr;", cxxNullPtrLiteralExpr()));
  763   EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
  767   EXPECT_TRUE(matches("void foo() { int *ptr; __atomic_load_n(ptr, 1); }",
  824     matches("template<typename T> class foo { void bar() { foo X(*this); } };"
  830   EXPECT_TRUE(matches("void declToImport() { int C = ({int X=4; X;}); }",
  836   EXPECT_TRUE(matches("void foo() { __func__; }",
  843   EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt()));
  850   EXPECT_TRUE(matches("void x() { if (true) {} }", Condition));
  862   EXPECT_TRUE(matches("void x() { true ? false : true; }", Conditional));
  869   EXPECT_TRUE(matches("void x() { true ? true : false; }", ConditionalFalse));
  873   EXPECT_TRUE(matches("void x() { true ? true : false; }", ConditionalFalse));
  886   EXPECT_TRUE(matches("void x() { 1 ?: 0; }", AlwaysOne));
  893   EXPECT_TRUE(matches("void x() { 4 ?: 5; }", FourNotFive));
  897   EXPECT_TRUE(matches("int i[2]; void f() { i[1] = 1; }",
  904   EXPECT_TRUE(matches("void f() { for(;;); }", forStmt()));
  905   EXPECT_TRUE(matches("void f() { if(true) for(;;); }", forStmt()));
  918   EXPECT_TRUE(matches("void f() {}", compoundStmt()));
  919   EXPECT_TRUE(matches("void f() {{}}", compoundStmt()));
  927   EXPECT_TRUE(matches("namespace n { struct S { void f() {{}} }; }",
  932   EXPECT_TRUE(matches("char *p = reinterpret_cast<char *>(&p);",castExpr()));
  933   EXPECT_TRUE(matches("void *p = (void *)(&p);", castExpr()));
  934   EXPECT_TRUE(matches("char q, *p = const_cast<char *>(&q);", castExpr()));
  935   EXPECT_TRUE(matches("char c = char(0);", castExpr()));
  939   EXPECT_TRUE(matches("char c = 0;", castExpr()));
  941   EXPECT_TRUE(matches("char c = 0, d = c;", castExpr()));
  952   EXPECT_TRUE(matches("char* p = reinterpret_cast<char*>(&p);",
  970   EXPECT_TRUE(matches(foo_class + "void r() { Foo f = Foo(\"hello world\"); }",
  985   EXPECT_TRUE(matches("struct B { virtual ~B() {} }; struct D : B {};"
  992   EXPECT_TRUE(matches("void* p(static_cast<void*>(&p));",
 1009   EXPECT_TRUE(matches("int i = (int) 2.2f;", cStyleCastExpr()));
 1024   EXPECT_TRUE(matches("int x = 0; const int y = x;",
 1027   EXPECT_TRUE(matches("char c = 0;",
 1030   EXPECT_TRUE(matches("int arr[6]; int *p = arr;",
 1058   EXPECT_TRUE(matches("void x() {}", stmt()));
 1066   EXPECT_TRUE(matches("void x() { int a; }", declStmt()));
 1070   EXPECT_TRUE(matches("struct Foo { ~Foo(); };"
 1073   EXPECT_FALSE(matches("struct Foo { }; Foo a;"
 1079   EXPECT_TRUE(matches("int a[] = { 1, 2 };",
 1081   EXPECT_TRUE(matches("struct B { int x, y; }; B b = { 5, 6 };",
 1083   EXPECT_TRUE(matches("struct S { S(void (*a)()); };"
 1088     matches("int i[1] = {42, [0] = 43};", integerLiteral(equals(42))));
 1100   EXPECT_TRUE(matches(code + "A a{0};",
 1104   EXPECT_TRUE(matches(code + "A a = {0};",
 1115   EXPECT_TRUE(matches("namespace X { int x; } using X::x;",
 1120   EXPECT_TRUE(matches("namespace f { int a; } using f::a;",
 1125   EXPECT_TRUE(matches("namespace X { int x; } using namespace X;",
 1128     matches("namespace X { int x; } using X::x;", usingDirectiveDecl()));
 1134   EXPECT_TRUE(matches("void x() { while(true); }", whileStmt()));
 1139   EXPECT_TRUE(matches("void x() { do {} while(true); }", doStmt()));
 1140   EXPECT_TRUE(matches("void x() { do ; while(false); }", doStmt()));
 1148   EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchCase()));
 1149   EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchCase()));
 1150   EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchCase()));
 1155   EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchStmt()));
 1156   EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchStmt()));
 1157   EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchStmt()));
 1162   EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxCatchStmt()));
 1163   EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxTryStmt()));
 1166   EXPECT_TRUE(matches("void foo() try { throw; } catch(int X) { }",
 1168   EXPECT_TRUE(matches("void foo() try { throw 5;} catch(int X) { }",
 1170   EXPECT_TRUE(matches("void foo() try { throw; } catch(...) { }",
 1174   EXPECT_TRUE(matches("void foo() try {} catch(int X) { }",
 1181   EXPECT_TRUE(matches("int i = (3);", parenExpr()));
 1182   EXPECT_TRUE(matches("int i = (3 + 7);", parenExpr()));
 1189   EXPECT_FALSE(matches("const char* str = (\"my-string\");",
 1191   EXPECT_TRUE(matches(
 1197   EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
 1201   EXPECT_TRUE(matches("int a[2];", constantArrayType()));
 1206   EXPECT_TRUE(matches("int a[42];", constantArrayType(hasSize(42))));
 1207   EXPECT_TRUE(matches("int b[2*21];", constantArrayType(hasSize(42))));
 1212   EXPECT_TRUE(matches(
 1221   EXPECT_TRUE(matches("int a[] = { 2, 3 };", incompleteArrayType()));
 1222   EXPECT_TRUE(matches("void f(int a[]) {}", incompleteArrayType()));
 1229   EXPECT_TRUE(matches("void f(int b) { int a[b]; }", variableArrayType()));
 1232   EXPECT_TRUE(matches(
 1243     EXPECT_TRUE(matches("_Atomic(int) i;", atomicType()));
 1245     EXPECT_TRUE(matches("_Atomic(int) i;",
 1253   EXPECT_TRUE(matches("auto i = 2;", autoType()));
 1254   EXPECT_TRUE(matches("int v[] = { 2, 3 }; void f() { for (int i : v) {} }",
 1257   EXPECT_TRUE(matches("auto i = 2;", varDecl(hasType(isInteger()))));
 1258   EXPECT_TRUE(matches("struct X{}; auto x = X{};",
 1270   EXPECT_TRUE(matches("decltype(1 + 1) sum = 1 + 1;", decltypeType()));
 1271   EXPECT_TRUE(matches("decltype(1 + 1) sum = 1 + 1;",
 1276   EXPECT_TRUE(matches("int (*f)(int);", functionType()));
 1277   EXPECT_TRUE(matches("void f(int i) {}", functionType()));
 1283   EXPECT_TRUE(matches("void (*fp)(void);",
 1288   EXPECT_TRUE(matches("int (*f)(int);", functionProtoType()));
 1289   EXPECT_TRUE(matches("void f(int i);", functionProtoType()));
 1290   EXPECT_TRUE(matches("void f();", functionProtoType(parameterCountIs(0))));
 1298     matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType())))));
 1301   EXPECT_TRUE(matches(
 1321   EXPECT_TRUE(matches(
 1324   EXPECT_TRUE(matches(
 1327   EXPECT_TRUE(matches(
 1334   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
 1350   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
 1362   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1364   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1376   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1380   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1394   EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
 1396   EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
 1400   EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
 1402   EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
 1406   EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
 1410   EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
 1415   EXPECT_TRUE(matches("enum Color { Green }; Color color;",
 1417   EXPECT_TRUE(matches("enum class Color { Green }; Color color;",
 1422   EXPECT_TRUE(matches("int b; int * const a = &b;",
 1424   EXPECT_TRUE(matches("int b; int * const a = &b;",
 1426   EXPECT_TRUE(matches(
 1429   EXPECT_TRUE(matches(
 1435   EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
 1440   EXPECT_TRUE(matches("template <typename T> class A{}; A<int> a;",
 1445   EXPECT_TRUE(matches("class C{}; C c;", recordType()));
 1446   EXPECT_TRUE(matches("struct S{}; S s;",
 1453   EXPECT_TRUE(matches(
 1460   EXPECT_TRUE(matches("class C {} c;", elaboratedType()));
 1470   EXPECT_FALSE(matches(code, binaryOperator(hasLHS(
 1472   EXPECT_TRUE(matches(code, binaryOperator(hasRHS(
 1477   EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;",
 1479   EXPECT_TRUE(matches("template <typename T> class A { typename T::B b; };",
 1481   EXPECT_TRUE(matches("struct A { void f(); }; void A::f() {}",
 1483   EXPECT_TRUE(matches("namespace a { namespace b {} } namespace ab = a::b;",
 1486   EXPECT_TRUE(matches(
 1495   EXPECT_TRUE(matches("void f() {int i;;}", nullStmt()));
 1500   EXPECT_TRUE(matches("namespace test {} namespace alias = ::test;",
 1507   EXPECT_TRUE(matches("struct A { struct B {}; }; A::B b;", Matcher));
 1508   EXPECT_TRUE(matches("struct A { struct B { struct C {}; }; }; A::B::C c;",
 1516   EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;", Matcher));
 1522   EXPECT_TRUE(matches(
 1525   EXPECT_TRUE(matches(
 1529   EXPECT_TRUE(matches(
 1590   EXPECT_TRUE(matches("typedef int typedefDeclTest;",
 1597   EXPECT_TRUE(matches("using typeAliasTest2 = int;",
 1604   EXPECT_TRUE(matches("typedef int typedefNameDeclTest1;",
 1606   EXPECT_TRUE(matches("using typedefNameDeclTest2 = int;",
 1621       matches(Code, typeAliasTemplateDecl(hasName("typeAliasTemplateDecl"))));
tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
   22   EXPECT_TRUE(matches("class A { void func(); };",
   29   EXPECT_TRUE(matches(
   39   EXPECT_TRUE(matches(
   54   EXPECT_TRUE(matches("namespace {"
   62   EXPECT_TRUE(matches("class D{};", decl(hasDeclContext(decl()))));
   66   EXPECT_TRUE(matches("void f() { int i = 3; }",
   68   EXPECT_TRUE(matches("void f() { int i = 3; }",
   71   EXPECT_TRUE(matches("void f() { int i = 3; }",
   73   EXPECT_TRUE(matches("void f() { int i = 3; }",
   87   EXPECT_TRUE(matches("void f() { int*** i; }",
   89   EXPECT_TRUE(matches("void f() { int*** i; }",
   92   EXPECT_TRUE(matches("void f() { int*** i; }",
  103   EXPECT_TRUE(matches("int i;",
  114   EXPECT_TRUE(matches(
  127   EXPECT_TRUE(matches(
  138   EXPECT_TRUE(matches(
  149   EXPECT_TRUE(matches("class A { public: A *a; };", TypeA));
  155   EXPECT_TRUE(matches("class A {}; class B : public A { public: B *b; };",
  163     matches("class A { public: A *a; class B {}; };", TypeAHasClassB));
  171   EXPECT_TRUE(matches("typedef int I; void f(I i);",
  181   EXPECT_TRUE(matches("template <typename T> void f(T t);",
  184   EXPECT_TRUE(matches("template <typename T> void f(T t);",
  187   EXPECT_TRUE(matches("template <typename T> struct S {"
  196   EXPECT_TRUE(matches("template <typename T> struct S {"
  212   EXPECT_TRUE(matches(Using, unresolvedUsingTypenameDecl(hasName("Foo"))));
  214   EXPECT_TRUE(matches(Using, parmVarDecl(hasType(namedDecl(hasName("Foo"))))));
  218   EXPECT_TRUE(matches("enum X {}; void y(X *x) { x; }",
  233   EXPECT_TRUE(matches(
  237   EXPECT_TRUE(matches(
  244   EXPECT_TRUE(matches("typedef int X; X a;",
  252   EXPECT_TRUE(matches("template <typename T> class A {}; A<int> a;",
  255   EXPECT_TRUE(matches("template <typename T> class A {};"
  259   EXPECT_TRUE(matches("template <typename T> class A {}; A<int> a;",
  266       matches("int *A = new int();",
  271   EXPECT_TRUE(matches("template <typename T> using C = T; C<int> c;",
  278       matches("struct A {}; using B = A; B b;",
  281       matches("struct A {}; using B = A; using C = B; C b;",
  286   EXPECT_TRUE(matches("namespace N { template <class T> void f(T t); }"
  290   EXPECT_TRUE(matches(
  303     matches("class X {}; void y(X &x) { x; }", expr(hasType(ClassX))));
  308     matches("class X {}; void y(X *x) { x; }",
  315     matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
  319     matches("class X {}; void y() { X *x; }",
  326     matches("class X {}; void y(X &x) { x; }", expr(hasType(ClassX))));
  335     matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
  341   EXPECT_TRUE(matches("typedef int X;", typedefDecl(hasType(asString("int")))));
  342   EXPECT_TRUE(matches("typedef const int T;",
  346   EXPECT_TRUE(matches("typedef int foo; typedef foo bar;",
  351   EXPECT_TRUE(matches("using X = int;", typedefNameDecl(hasType(asString("int")))));
  352   EXPECT_TRUE(matches("using T = const int;",
  356   EXPECT_TRUE(matches("using foo = int; using bar = foo;",
  361   EXPECT_TRUE(matches("int x;",
  373   EXPECT_TRUE(matches("class Y { void x() { x(); } };", CallMethodX));
  378     matches("struct Y { operator int() const; }; int i = Y();", CallMethodX));
  384   EXPECT_TRUE(matches("class Y { void x() { this->x(); } };",
  394   EXPECT_TRUE(matches("void x(int) { int y; x(y); }", CallArgumentY));
  396     matches("class X { void x(int) { int y; x(y); } };", CallArgumentY));
  412   EXPECT_TRUE(matches("void x(int, int) { int y; x(1, y); }", CallArgumentY));
  413   EXPECT_TRUE(matches("void x(int, int) { int y; x(y, 42); }", CallArgumentY));
  414   EXPECT_TRUE(matches("struct Y { Y(int, int); };"
  417   EXPECT_TRUE(matches("struct Y { Y(int, int); };"
  420   EXPECT_TRUE(matches("template <class Y> void x() { int y; (void)Y(1, y); }",
  422   EXPECT_TRUE(matches("template <class Y> void x() { int y; (void)Y(y, 42); }",
  440   EXPECT_TRUE(matches("void x(long) { int y; x(y); }", ImplicitCastedArgument));
  541   EXPECT_TRUE(matches(Snippet1, MatchesY));
  545   EXPECT_TRUE(matches(Snippet2, MatchesX));
  556   EXPECT_TRUE(matches(Snippet3, MatchesCall));
  575   EXPECT_TRUE(matches(Snippet1, MatchesY));
  576   EXPECT_TRUE(matches(Snippet2, MatchesY));
  609   EXPECT_TRUE(matches(Snippet1, MatchesX));
  615   EXPECT_TRUE(matches(Snippet2, MatchesXPointer));
  724     matches("typedef int &int_ref;"
  731   EXPECT_TRUE(matches("class X { void x(int) {} };",
  747   EXPECT_TRUE(matches(
  753   EXPECT_TRUE(matches("class X { void x(const X *x) {} };",
  756   EXPECT_TRUE(matches("class X { void x(const X &x) {} };",
  762   EXPECT_TRUE(matches(
  765   EXPECT_TRUE(matches(
  775   EXPECT_TRUE(matches("class Y { int f() { return 1; } };",
  779   EXPECT_TRUE(matches("class Y { Y getMe() { return *this; } };",
  797   EXPECT_TRUE(matches("class Y {}; class X { void x(int x) {} };",
  804   EXPECT_TRUE(matches(
  812   EXPECT_TRUE(matches("template<template <typename> class S> class X {};"
  820   EXPECT_TRUE(matches(
  833   EXPECT_TRUE(matches(
  849   EXPECT_TRUE(matches(
  860   EXPECT_TRUE(matches(
  871   EXPECT_TRUE(matches(
  881   EXPECT_TRUE(matches("template<typename T> struct C {}; C<int> c;",
  884   EXPECT_TRUE(matches(
  888   EXPECT_TRUE(matches(
  902   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  903   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  914   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  915   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  927   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  928   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T2"))));
  929   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  930   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U2"))));
  942   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  943   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T2"))));
  944   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  945   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U2"))));
  959   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  960   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  973   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  974   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  978   EXPECT_TRUE(matches("template<int T> struct C {}; C<42> c;",
  988   EXPECT_TRUE(matches("class Foo { Foo(int i); };",
  995   EXPECT_TRUE(matches("class Foo { virtual ~Foo(); };",
 1009     matches("class Foo {"
 1026   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1028   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1030   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1042   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1056   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1060   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1074   EXPECT_TRUE(matches(Code, cxxConstructorDecl(allOf(
 1080   EXPECT_TRUE(matches(Code, cxxConstructorDecl(allOf(
 1089   EXPECT_TRUE(matches("void f() { if (false) true; else false; }",
 1093   EXPECT_TRUE(matches("void f() { if (false) false; else true; }",
 1102   EXPECT_TRUE(matches("void x() { true || false; }", OperatorOr));
 1111   EXPECT_TRUE(matches("void x() { true || false; }", OperatorTrueFalse));
 1112   EXPECT_TRUE(matches("void x() { true && false; }", OperatorTrueFalse));
 1117   EXPECT_TRUE(matches("void x() { 1[\"abc\"]; }", OperatorIntPointer));
 1125   EXPECT_TRUE(matches("void x() { true || false; }", HasOperand));
 1126   EXPECT_TRUE(matches("void x() { false && true; }", HasOperand));
 1135     matches("void x() { 3, 4; }", binaryOperator(hasOperatorName(","))));
 1137     matches("bool b; bool c = (b = true);",
 1140     matches("bool b = 1 != 2;", binaryOperator(hasOperatorName("!="))));
 1142     matches("bool b = 1 == 2;", binaryOperator(hasOperatorName("=="))));
 1143   EXPECT_TRUE(matches("bool b = 1 < 2;", binaryOperator(hasOperatorName("<"))));
 1145     matches("bool b = 1 <= 2;", binaryOperator(hasOperatorName("<="))));
 1147     matches("int i = 1 << 2;", binaryOperator(hasOperatorName("<<"))));
 1149     matches("int i = 1; int j = (i <<= 2);",
 1151   EXPECT_TRUE(matches("bool b = 1 > 2;", binaryOperator(hasOperatorName(">"))));
 1153     matches("bool b = 1 >= 2;", binaryOperator(hasOperatorName(">="))));
 1155     matches("int i = 1 >> 2;", binaryOperator(hasOperatorName(">>"))));
 1157     matches("int i = 1; int j = (i >>= 2);",
 1160     matches("int i = 42 ^ 23;", binaryOperator(hasOperatorName("^"))));
 1162     matches("int i = 42; int j = (i ^= 42);",
 1165     matches("int i = 42 % 23;", binaryOperator(hasOperatorName("%"))));
 1167     matches("int i = 42; int j = (i %= 42);",
 1170     matches("bool b = 42  &23;", binaryOperator(hasOperatorName("&"))));
 1172     matches("bool b = true && false;",
 1175     matches("bool b = true; bool c = (b &= false);",
 1178     matches("bool b = 42 | 23;", binaryOperator(hasOperatorName("|"))));
 1180     matches("bool b = true || false;",
 1183     matches("bool b = true; bool c = (b |= false);",
 1186     matches("int i = 42  *23;", binaryOperator(hasOperatorName("*"))));
 1188     matches("int i = 42; int j = (i *= 23);",
 1191     matches("int i = 42 / 23;", binaryOperator(hasOperatorName("/"))));
 1193     matches("int i = 42; int j = (i /= 23);",
 1196     matches("int i = 42 + 23;", binaryOperator(hasOperatorName("+"))));
 1198     matches("int i = 42; int j = (i += 23);",
 1201     matches("int i = 42 - 23;", binaryOperator(hasOperatorName("-"))));
 1203     matches("int i = 42; int j = (i -= 23);",
 1206     matches("struct A { void x() { void (A::*a)(); (this->*a)(); } };",
 1209     matches("struct A { void x() { void (A::*a)(); ((*this).*a)(); } };",
 1234   EXPECT_TRUE(matches("void x() { !true; } ", OperatorNot));
 1242   EXPECT_TRUE(matches("void x() { !false; }", OperatorOnFalse));
 1249   EXPECT_TRUE(matches("bool b = !true;", unaryOperator(hasOperatorName("!"))));
 1251     matches("bool b; bool *p = &b;", unaryOperator(hasOperatorName("&"))));
 1252   EXPECT_TRUE(matches("int i = ~ 1;", unaryOperator(hasOperatorName("~"))));
 1254     matches("bool *p; bool b = *p;", unaryOperator(hasOperatorName("*"))));
 1256     matches("int i; int j = +i;", unaryOperator(hasOperatorName("+"))));
 1258     matches("int i; int j = -i;", unaryOperator(hasOperatorName("-"))));
 1260     matches("int i; int j = ++i;", unaryOperator(hasOperatorName("++"))));
 1262     matches("int i; int j = i++;", unaryOperator(hasOperatorName("++"))));
 1264     matches("int i; int j = --i;", unaryOperator(hasOperatorName("--"))));
 1266     matches("int i; int j = i--;", unaryOperator(hasOperatorName("--"))));
 1282   EXPECT_TRUE(matches(
 1285   EXPECT_TRUE(matches(
 1294   EXPECT_TRUE(matches(
 1305     matches("class X { public: X(); }; void x(int) { X x; }", Constructor));
 1307     matches("class X { public: X(); }; void x(int) { X x = X(); }",
 1315   EXPECT_TRUE(matches(
 1321   EXPECT_TRUE(matches(
 1337   EXPECT_TRUE(matches("void x() { if (true) {} }", IfStmt));
 1342   EXPECT_TRUE(matches("void x() { for (;true;) {} }", ForStmt));
 1347   EXPECT_TRUE(matches("void x() { while (true) {} }", WhileStmt));
 1352   EXPECT_TRUE(matches("void x() { switch (42) {case 42:;} }", SwitchStmt));
 1357   EXPECT_TRUE(matches("void f(){ int i; for (; i < 3 ; ); }",
 1359   EXPECT_TRUE(matches("void f() { for (int i = 0; ;); }",
 1364   EXPECT_TRUE(matches("void f(){ int a[] {1, 2}; for (int i : a); }",
 1366   EXPECT_TRUE(matches(
 1379   EXPECT_TRUE(matches("void f() { for(;;) {} }",
 1383   EXPECT_TRUE(matches("void f() { while(true) {} }",
 1385   EXPECT_TRUE(matches("void f() { do {} while(true); }",
 1387   EXPECT_TRUE(matches("void f() { int p[2]; for (auto x : p) {} }",
 1389   EXPECT_TRUE(matches("void f() {}", functionDecl(hasBody(compoundStmt()))));
 1391   EXPECT_TRUE(matches("void f(); void f() {}",
 1399   EXPECT_TRUE(matches("void f() { for (;;); }",
 1410   EXPECT_TRUE(matches("void f() { if (true) { for (;;); } }",
 1415   EXPECT_TRUE(matches("void f() { 1; 2; 3; for (;;); 4; 5; 6; }",
 1426   EXPECT_TRUE(matches("class X { void operator delete(void*); };",
 1437   EXPECT_TRUE(matches("char* p = static_cast<char*>(0);",
 1444   EXPECT_TRUE(matches("int x; const int i = x;",
 1448   EXPECT_TRUE(matches("int arr[3]; int *p = arr;",
 1466       matches("struct H {};"
 1477       matches("struct H {};"
 1487   EXPECT_TRUE(matches(
 1501   EXPECT_TRUE(matches("struct H {};"
 1515   EXPECT_TRUE(matches("struct H {};"
 1525   EXPECT_TRUE(matches("void f() {"
 1535   EXPECT_TRUE(matches("struct H {};"
 1541   EXPECT_TRUE(matches("struct H {};"
 1550   EXPECT_TRUE(matches("class C {}; C a = C();",
 1582   EXPECT_TRUE(matches(Code, varDecl(
 1602   EXPECT_TRUE(matches("int x = 0; const int y = x;",
 1606   EXPECT_TRUE(matches("char x = 0;",
 1641   EXPECT_TRUE(matches("int x = 0; int &y = x;",
 1649   EXPECT_TRUE(matches("int x = (0);",
 1652   EXPECT_TRUE(matches("int x = (((((0)))));",
 1658   EXPECT_TRUE(matches("char x = (0);",
 1662   EXPECT_TRUE(matches("char x = (char)0;",
 1665   EXPECT_TRUE(matches("char* p = static_cast<char*>(0);",
 1672   EXPECT_TRUE(matches("int x = 0;",
 1700   EXPECT_TRUE(matches("int x = 0; const int y = x;",
 1704   EXPECT_TRUE(matches("const char x = (0);",
 1712   EXPECT_TRUE(matches("int x = 0; int &y = x;",
 1715   EXPECT_TRUE(matches("int x = 0;",
 1741   EXPECT_TRUE(matches("class string {}; class URL { public: URL(string s); };"
 1748   EXPECT_TRUE(matches("float x = static_cast<float>(42);",
 1755   EXPECT_TRUE(matches("namespace f { int a; void b(); } using f::b;",
 1764   EXPECT_TRUE(matches(
 1775   EXPECT_TRUE(matches("void f() {int a = 4;}", SingleDeclStmt));
 1784   EXPECT_TRUE(matches("void f() {int a = 4;}",
 1786   EXPECT_TRUE(matches("void f() {int a = 4, b = 3;}",
 1798   EXPECT_TRUE(matches("void x() { switch(42) case 42:; }",
 1800   EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }",
 1805   EXPECT_TRUE(matches("void x() { switch(42) { case 1+1: case 4:; } }",
 1874   EXPECT_TRUE(matches(
 1889   EXPECT_TRUE(matches(
 2106   EXPECT_TRUE(matches(
 2118   EXPECT_TRUE(matches(
 2125   EXPECT_TRUE(matches(
 2131   EXPECT_TRUE(matches(
 2170   EXPECT_TRUE(matches(
 2178   EXPECT_TRUE(matches(
 2186   EXPECT_TRUE(matches(
 2198   EXPECT_TRUE(matches(
 2209   EXPECT_TRUE(matches("struct MyClass {\n"
 2217   EXPECT_TRUE(matches("int F() {\n"
 2222   EXPECT_TRUE(matches("void f() {\n"
 2229   EXPECT_TRUE(matches("void f() {\n"
 2238   EXPECT_TRUE(matches("struct PartitionAllocator {\n"
 2249   EXPECT_TRUE(matches("template <class T> void f();\n"
 2256   EXPECT_TRUE(matches(
 2264     matches("template <typename T> struct C { static void f() { 42; } };"
 2270   EXPECT_TRUE(matches(
 2307   EXPECT_TRUE(matches("int b; int &a = b;",
 2309   EXPECT_TRUE(matches("int *a;", pointerType(pointee(builtinType()))));
 2311   EXPECT_TRUE(matches("int *a;",
 2314   EXPECT_TRUE(matches(
 2323   EXPECT_TRUE(matches(
 2344   EXPECT_TRUE(matches(
 2380   EXPECT_TRUE(matches(
 2390   EXPECT_TRUE(matches(
 2409   EXPECT_TRUE(matches(
 2425   EXPECT_TRUE(matches(
 2435   EXPECT_TRUE(matches(
 2452   EXPECT_TRUE(matches(
 2520   EXPECT_TRUE(matches("int F() { int a, b; return a + b; }", RetVal));
 2521   EXPECT_FALSE(matches("int F() { int a; return a; }", RetVal));
 2522   EXPECT_FALSE(matches("void F() { return; }", RetVal));
 2542     matches(
 2552     matches(
 2556   EXPECT_TRUE(matches(CppString2, returnStmt(forFunction(hasName("F2")))));
 2611       matches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2614       matches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2628   EXPECT_TRUE(matches(Fragment, substTemplateTypeParmType(hasReplacementType(
 2643       matches("template<typename T> class A {}; typedef A<int> B;", Matcher));
tools/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
  216   EXPECT_TRUE(matches("int x = 1 + false;", M));
  217   EXPECT_FALSE(matches("int x = true + 1;", M));
  218   EXPECT_FALSE(matches("int x = 1 - false;", M));
  219   EXPECT_FALSE(matches("int x = true - 1;", M));
  226   EXPECT_TRUE(matches("void f(int a, int x);", M));
  227   EXPECT_FALSE(matches("void f(int x, int a);", M));
  238   EXPECT_TRUE(matches("void f(int a, int x);", M));
  239   EXPECT_FALSE(matches("void f(int x, int a);", M));
tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
  138   EXPECT_TRUE(matches(ClassSnippet, IsArrowValue));
  139   EXPECT_TRUE(matches(BoolSnippet, BoolValue));
  140   EXPECT_FALSE(matches(ClassSnippet, BoolValue));
  141   EXPECT_FALSE(matches(BoolSnippet, IsArrowValue));
  148   EXPECT_TRUE(matches("class X {};", Value));
  149   EXPECT_FALSE(matches("int x;", Value));
  153   EXPECT_TRUE(matches("void foo(int,int);", Value));
  154   EXPECT_FALSE(matches("void foo(int);", Value));
  167   EXPECT_FALSE(matches(code, HasInitializerSimple));
  168   EXPECT_FALSE(matches(code, HasInitializerComplex));
  171   EXPECT_TRUE(matches(code, HasInitializerSimple));
  172   EXPECT_FALSE(matches(code, HasInitializerComplex));
  175   EXPECT_TRUE(matches(code, HasInitializerSimple));
  176   EXPECT_TRUE(matches(code, HasInitializerComplex));
  182   EXPECT_TRUE(matches("void f(int a, int x);", HasParameter));
  183   EXPECT_FALSE(matches("void f(int x, int a);", HasParameter));
  202   EXPECT_FALSE(matches(Code, CallExpr0));
  203   EXPECT_TRUE(matches(Code, CallExpr1));
  206   EXPECT_TRUE(matches(Code, CallExpr0));
  207   EXPECT_FALSE(matches(Code, CallExpr1));
  221   EXPECT_TRUE(matches(Code, DeclDecl));
  222   EXPECT_FALSE(matches(Code, NNSL));
  225   EXPECT_FALSE(matches(Code, DeclDecl));
  226   EXPECT_TRUE(matches(Code, NNSL));
  237   EXPECT_TRUE(matches("int a;", Var));
  238   EXPECT_FALSE(matches("extern int a;", Var));
  239   EXPECT_TRUE(matches("class A {};", Class));
  240   EXPECT_FALSE(matches("class A;", Class));
  241   EXPECT_TRUE(matches("void f(){};", Func));
  242   EXPECT_FALSE(matches("void f();", Func));
  249   EXPECT_TRUE(matches("int Foo;", Anything));
  250   EXPECT_TRUE(matches("class Foo {};", Anything));
  251   EXPECT_TRUE(matches("void Foo(){};", Anything));
  252   EXPECT_FALSE(matches("int Foo;", RecordDecl));
  253   EXPECT_TRUE(matches("class Foo {};", RecordDecl));
  254   EXPECT_FALSE(matches("void Foo(){};", RecordDecl));
  265   EXPECT_FALSE(matches("class Foo { public: Foo(); };", ConstructExpr));
  267       matches("class Foo { public: Foo(); }; Foo foo = Foo();", ConstructExpr));
  278   EXPECT_TRUE(matches("template<typename T> class A {}; A<int> a;",
  280   EXPECT_FALSE(matches("template<typename T> class A {}; A<char> a;",
  289   EXPECT_FALSE(matches("int *a;", M));
  290   EXPECT_TRUE(matches("int const *b;", M));
  296   EXPECT_FALSE(matches("struct A{}; A a[7];;", M));
  297   EXPECT_TRUE(matches("int b[7];", M));
  308   EXPECT_TRUE(matches("struct Foo { Foo() : foo(1) {} int foo; };", CtorDecl));
  309   EXPECT_FALSE(matches("struct Foo { Foo() {} int foo; };", CtorDecl));
  310   EXPECT_FALSE(matches("struct Foo { Foo() : bar(1) {} int bar; };", CtorDecl));
  321   EXPECT_TRUE(matches("class X {};", D));
  322   EXPECT_TRUE(matches("class Y { class X {}; };", D));
  323   EXPECT_FALSE(matches("class Y { class Z {}; };", D));
  332   EXPECT_TRUE(matches("void foo() { for(int X;;); }", S));
  333   EXPECT_TRUE(matches("void foo() { for(;;) { int X; } }", S));
  334   EXPECT_FALSE(matches("void foo() { for(;;); }", S));
  335   EXPECT_FALSE(matches("void foo() { if (int X = 0){} }", S));
  340   EXPECT_TRUE(matches("void foo() { if (true) { int x = 42; } }", S));
  341   EXPECT_FALSE(matches("void foo() { if (true) return; }", S));
  353   EXPECT_TRUE(matches("void foo(){}", D));
  354   EXPECT_TRUE(matches("struct Foo{};", D));
  355   EXPECT_FALSE(matches("int i = 0;", D));
  366   EXPECT_FALSE(matches("void foo(){}", D));
  367   EXPECT_TRUE(matches("struct Foo{};", D));
  368   EXPECT_FALSE(matches("int i = 0;", D));
  369   EXPECT_TRUE(matches("class Bar{};", D));
  370   EXPECT_FALSE(matches("class OtherBar{};", D));
  380   EXPECT_FALSE(matches("class Bar{ int Foo; };", D));
  381   EXPECT_TRUE(matches("class OtherBar{ int Foo; };", D));
  387   EXPECT_TRUE(matches("void Foo(){}", D));
  504   EXPECT_TRUE(matches("struct __attribute__((warn_unused)) X {};", Value));
  505   EXPECT_FALSE(matches("struct X {};", Value));
  510   EXPECT_TRUE(matches("int i = (1);", Value));
  511   EXPECT_FALSE(matches("int i = 1;", Value));
  518   EXPECT_TRUE(matches("bool x = true;", BooleanStmt));
  519   EXPECT_FALSE(matches("bool x = false;", BooleanStmt));
  520   EXPECT_FALSE(matches("bool x = 0;", BooleanStmt));
  525   EXPECT_TRUE(matches("bool x = false;", BooleanStmt));
  526   EXPECT_FALSE(matches("bool x = true;", BooleanStmt));
  527   EXPECT_FALSE(matches("bool x = 0;", BooleanStmt));
  532   EXPECT_TRUE(matches("double x = 1.2;", DoubleStmt));
  538   EXPECT_TRUE(matches("double x = 12e-1;", DoubleStmt));
  539   EXPECT_FALSE(matches("double x = 1.23;", DoubleStmt));
  544   EXPECT_TRUE(matches("int x = 42;", IntegerStmt));
  545   EXPECT_FALSE(matches("int x = 1;", IntegerStmt));
  550   EXPECT_TRUE(matches("int x = 'x';", CharStmt));
  551   EXPECT_TRUE(matches("int x = L'x';", CharStmt));
  552   EXPECT_TRUE(matches("int x = u'x';", CharStmt));
  553   EXPECT_TRUE(matches("int x = U'x';", CharStmt));
  554   EXPECT_FALSE(matches("int x = 120;", CharStmt));
tools/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
  149   EXPECT_TRUE(matches("class X {};", VariantValue(VariantMatcher::SingleMatcher(
  154       matches("int x;", VariantValue(VariantMatcher::SingleMatcher(varDecl()))
  158       matches("int foo() { return 1 + 1; }",
  176   EXPECT_FALSE(matches(
  181       matches("int foo() { return 1 + 1; }",
tools/clang/unittests/Sema/GslOwnerPointerInference.cpp
   17   EXPECT_TRUE(matches("template<class T>"
   29   EXPECT_TRUE(matches("template<class T>"
   41   EXPECT_TRUE(matches("template<class T>"