Lines Matching refs:matches
36 EXPECT_TRUE(matches("namespace x { class X {}; } using x::X;", in TEST()
42 EXPECT_TRUE(matches("typedef int X;", NamedX)); in TEST()
43 EXPECT_TRUE(matches("int X;", NamedX)); in TEST()
44 EXPECT_TRUE(matches("class foo { virtual void X(); };", NamedX)); in TEST()
45 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", NamedX)); in TEST()
46 EXPECT_TRUE(matches("void foo() { int X; }", NamedX)); in TEST()
47 EXPECT_TRUE(matches("namespace X { }", NamedX)); in TEST()
48 EXPECT_TRUE(matches("enum X { A, B, C };", NamedX)); in TEST()
55 EXPECT_TRUE(matches("typedef int Xa;", NamedX)); in TEST()
56 EXPECT_TRUE(matches("int Xb;", NamedX)); in TEST()
57 EXPECT_TRUE(matches("class foo { virtual void Xc(); };", NamedX)); in TEST()
58 EXPECT_TRUE(matches("void foo() try { } catch(int Xdef) { }", NamedX)); in TEST()
59 EXPECT_TRUE(matches("void foo() { int Xgh; }", NamedX)); in TEST()
60 EXPECT_TRUE(matches("namespace Xij { }", NamedX)); in TEST()
61 EXPECT_TRUE(matches("enum X { A, B, C };", NamedX)); in TEST()
66 EXPECT_TRUE(matches("int no_foo;", StartsWithNo)); in TEST()
67 EXPECT_TRUE(matches("class foo { virtual void nobody(); };", StartsWithNo)); in TEST()
70 EXPECT_TRUE(matches("int abc;", Abc)); in TEST()
71 EXPECT_TRUE(matches("int aFOObBARc;", Abc)); in TEST()
73 EXPECT_TRUE(matches("int cabc;", Abc)); in TEST()
76 EXPECT_TRUE(matches("int k;", StartsWithK)); in TEST()
77 EXPECT_TRUE(matches("int kAbc;", StartsWithK)); in TEST()
78 EXPECT_TRUE(matches("namespace x { int kTest; }", StartsWithK)); in TEST()
79 EXPECT_TRUE(matches("class C { int k; };", StartsWithK)); in TEST()
89 EXPECT_FALSE(matches("", ClassMatcher)); in TEST()
92 EXPECT_TRUE(matches("class X;", ClassX)); in TEST()
93 EXPECT_TRUE(matches("class X {};", ClassX)); in TEST()
94 EXPECT_TRUE(matches("template<class T> class X {};", ClassX)); in TEST()
103 EXPECT_TRUE(matches( in TEST()
105 EXPECT_FALSE(matches( in TEST()
107 EXPECT_TRUE(matches( in TEST()
114 EXPECT_TRUE(matches("extern \"C\" { void foo() {}; }", linkageSpecDecl())); in TEST()
126 EXPECT_TRUE(matches("template<typename T> class X {};", ClassX)); in TEST()
127 EXPECT_TRUE(matches("class Z { template<class T> class X {}; };", ClassX)); in TEST()
157 EXPECT_TRUE(matches("enum EnumType { EnumValue };", in TEST()
159 EXPECT_TRUE(matches("void FunctionDecl();", in TEST()
168 EXPECT_TRUE(matches("enum X {};", enumDecl(hasName("X")))); in TEST()
173 EXPECT_TRUE(matches("enum X{ A };", Matcher)); in TEST()
198 EXPECT_TRUE(matches("class Y { void x() { x(); } };", MethodX)); in TEST()
205 matches("class Y { public: void x(); }; void z() { Y y; y.x(); }", in TEST()
208 matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }", in TEST()
224 matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }", in TEST()
227 matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }", in TEST()
230 matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }", in TEST()
240 EXPECT_TRUE(matches("auto f = [] (int i) { return i; };", in TEST()
245 EXPECT_TRUE(matches("int as[] = { 1, 2, 3 };" in TEST()
253 EXPECT_FALSE(matches("template<int N>\n" in TEST()
257 EXPECT_TRUE(matches("template<int N>\n" in TEST()
264 EXPECT_TRUE(matches("template <int N> void f();", in TEST()
271 EXPECT_TRUE(matches("template <typename T> void f();", in TEST()
278 EXPECT_TRUE(matches("constexpr char operator \"\" _inc (const char i) {" in TEST()
286 EXPECT_TRUE(matches("void f() { while(true) { break; } }", breakStmt())); in TEST()
287 EXPECT_TRUE(matches("void f() { while(true) { continue; } }", in TEST()
289 EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", gotoStmt())); in TEST()
290 EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", in TEST()
294 EXPECT_TRUE(matches("void f() { FOO: ; void *ptr = &&FOO; goto *ptr; }", in TEST()
296 EXPECT_TRUE(matches("void f() { return; }", returnStmt())); in TEST()
302 EXPECT_TRUE(matches("class Y { }; " in TEST()
316 EXPECT_TRUE(matches("class Y { }; " in TEST()
330 matches("class Y { public: void x(); }; void z() { Y y; y.x(); }", in TEST()
333 matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }", in TEST()
336 matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }", in TEST()
339 matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }", in TEST()
342 matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }", in TEST()
345 EXPECT_TRUE(matches( in TEST()
361 EXPECT_TRUE(matches( in TEST()
385 EXPECT_TRUE(matches( in TEST()
387 EXPECT_TRUE(matches( in TEST()
389 EXPECT_TRUE(matches( in TEST()
392 EXPECT_TRUE(matches( in TEST()
402 EXPECT_TRUE(matches("void x() { int a = sizeof(a); }", in TEST()
418 EXPECT_TRUE(matches("class Y { void x() { x(); } };", memberExpr())); in TEST()
423 matches("class Y { void x() { this->y; } int y; };", memberExpr())); in TEST()
425 matches("class Y { void x() { y; } int y; };", memberExpr())); in TEST()
427 matches("class Y { void x() { Y y; y.y; } int y; };", memberExpr())); in TEST()
431 EXPECT_TRUE(matches("class Y { void x() { this->y; } static int y; };", in TEST()
442 EXPECT_TRUE(matches("void f() { f(); }", CallFunctionF)); in TEST()
449 EXPECT_TRUE(matches("void f(); template <int N> void g() { f(); }", in TEST()
452 matches("void f(); template <int N> struct S { void g() { f(); } };", in TEST()
465 EXPECT_TRUE(matches("void f(...);", functionDecl(isVariadic()))); in TEST()
471 EXPECT_TRUE(matches("void f(...);", functionDecl(parameterCountIs(0)))); in TEST()
473 EXPECT_TRUE(matches("void f(int, ...);", functionDecl(parameterCountIs(1)))); in TEST()
478 matches("template <typename T> void f(T t) {}", in TEST()
498 EXPECT_TRUE(matches("template<typename T> struct A {};" in TEST()
501 EXPECT_TRUE(matches("template<typename T> struct A {}; A<int> a;", in TEST()
508 EXPECT_TRUE(matches("int x;", declaratorDecl())); in TEST()
513 EXPECT_TRUE(matches("void f(int x);", parmVarDecl())); in TEST()
521 matches("class X { public: X(); }; void x() { X x; }", Constructor)); in TEST()
523 matches("class X { public: X(); }; void x() { X x = X(); }", in TEST()
526 matches("class X { public: X(int); }; void x() { X x = 0; }", in TEST()
528 EXPECT_TRUE(matches("class X {}; void x(int) { X x; }", Constructor)); in TEST()
533 matches("struct X { int a; int f () { return a; } };", cxxThisExpr())); in TEST()
544 matches(ClassString + in TEST()
574 matches(ClassString + in TEST()
607 EXPECT_TRUE(matches("class X { public: X(); }; void x() { new X; }", New)); in TEST()
609 matches("class X { public: X(); }; void x() { new X(); }", New)); in TEST()
611 matches("class X { public: X(int); }; void x() { new X(0); }", New)); in TEST()
612 EXPECT_TRUE(matches("class X {}; void x(int) { new X; }", New)); in TEST()
616 EXPECT_TRUE(matches("struct A {}; void f(A* a) { delete a; }", in TEST()
623 EXPECT_TRUE(matches("void x(int, int = 0) { int y; x(y); }", Arg)); in TEST()
625 matches("class X { void x(int, int = 0) { int y; x(y); } };", Arg)); in TEST()
631 EXPECT_TRUE(matches("const char *s = \"string\";", Literal)); in TEST()
633 EXPECT_TRUE(matches("const wchar_t *s = L\"string\";", Literal)); in TEST()
635 EXPECT_TRUE(matches("const char *s = \"\x05five\";", Literal)); in TEST()
642 EXPECT_TRUE(matches("const char c = 'c';", CharLiteral)); in TEST()
644 EXPECT_TRUE(matches("const char c = L'c';", CharLiteral)); in TEST()
652 EXPECT_TRUE(matches("int i = 10;", HasIntLiteral)); in TEST()
653 EXPECT_TRUE(matches("int i = 0x1AB;", HasIntLiteral)); in TEST()
654 EXPECT_TRUE(matches("int i = 10L;", HasIntLiteral)); in TEST()
655 EXPECT_TRUE(matches("int i = 10U;", HasIntLiteral)); in TEST()
668 EXPECT_TRUE(matches("float i = 10.0;", HasFloatLiteral)); in TEST()
669 EXPECT_TRUE(matches("float i = 10.0f;", HasFloatLiteral)); in TEST()
670 EXPECT_TRUE(matches("double i = 10.0;", HasFloatLiteral)); in TEST()
671 EXPECT_TRUE(matches("double i = 10.0L;", HasFloatLiteral)); in TEST()
672 EXPECT_TRUE(matches("double i = 1e10;", HasFloatLiteral)); in TEST()
673 EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0)))); in TEST()
674 EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0f)))); in TEST()
676 matches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(5.0))))); in TEST()
686 EXPECT_TRUE(matches("int* i = nullptr;", cxxNullPtrLiteralExpr())); in TEST()
690 EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr())); in TEST()
694 EXPECT_TRUE(matches("void foo() { int *ptr; __atomic_load_n(ptr, 1); }", in TEST()
751 matches("template<typename T> class foo { void bar() { foo X(*this); } };" in TEST()
757 EXPECT_TRUE(matches("void declToImport() { int C = ({int X=4; X;}); }", in TEST()
763 EXPECT_TRUE(matches("void foo() { __func__; }", in TEST()
770 EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt())); in TEST()
777 EXPECT_TRUE(matches("void x() { if (true) {} }", Condition)); in TEST()
789 EXPECT_TRUE(matches("void x() { true ? false : true; }", Conditional)); in TEST()
796 EXPECT_TRUE(matches("void x() { true ? true : false; }", ConditionalFalse)); in TEST()
800 EXPECT_TRUE(matches("void x() { true ? true : false; }", ConditionalFalse)); in TEST()
813 EXPECT_TRUE(matches("void x() { 1 ?: 0; }", AlwaysOne)); in TEST()
820 EXPECT_TRUE(matches("void x() { 4 ?: 5; }", FourNotFive)); in TEST()
824 EXPECT_TRUE(matches("int i[2]; void f() { i[1] = 1; }", in TEST()
831 EXPECT_TRUE(matches("void f() { for(;;); }", forStmt())); in TEST()
832 EXPECT_TRUE(matches("void f() { if(true) for(;;); }", forStmt())); in TEST()
845 EXPECT_TRUE(matches("void f() {}", compoundStmt())); in TEST()
846 EXPECT_TRUE(matches("void f() {{}}", compoundStmt())); in TEST()
854 EXPECT_TRUE(matches("namespace n { struct S { void f() {{}} }; }", in TEST()
859 EXPECT_TRUE(matches("char *p = reinterpret_cast<char *>(&p);",castExpr())); in TEST()
860 EXPECT_TRUE(matches("void *p = (void *)(&p);", castExpr())); in TEST()
861 EXPECT_TRUE(matches("char q, *p = const_cast<char *>(&q);", castExpr())); in TEST()
862 EXPECT_TRUE(matches("char c = char(0);", castExpr())); in TEST()
866 EXPECT_TRUE(matches("char c = 0;", castExpr())); in TEST()
868 EXPECT_TRUE(matches("char c = 0, d = c;", castExpr())); in TEST()
879 EXPECT_TRUE(matches("char* p = reinterpret_cast<char*>(&p);", in TEST()
897 EXPECT_TRUE(matches(foo_class + "void r() { Foo f = Foo(\"hello world\"); }", in TEST()
912 EXPECT_TRUE(matches("struct B { virtual ~B() {} }; struct D : B {};" in TEST()
919 EXPECT_TRUE(matches("void* p(static_cast<void*>(&p));", in TEST()
936 EXPECT_TRUE(matches("int i = (int) 2.2f;", cStyleCastExpr())); in TEST()
951 EXPECT_TRUE(matches("int x = 0; const int y = x;", in TEST()
954 EXPECT_TRUE(matches("char c = 0;", in TEST()
957 EXPECT_TRUE(matches("int arr[6]; int *p = arr;", in TEST()
985 EXPECT_TRUE(matches("void x() {}", stmt())); in TEST()
993 EXPECT_TRUE(matches("void x() { int a; }", declStmt())); in TEST()
997 EXPECT_TRUE(matches("struct Foo { ~Foo(); };" in TEST()
1000 EXPECT_FALSE(matches("struct Foo { }; Foo a;" in TEST()
1006 EXPECT_TRUE(matches("int a[] = { 1, 2 };", in TEST()
1008 EXPECT_TRUE(matches("struct B { int x, y; }; B b = { 5, 6 };", in TEST()
1010 EXPECT_TRUE(matches("struct S { S(void (*a)()); };" in TEST()
1015 matches("int i[1] = {42, [0] = 43};", integerLiteral(equals(42)))); in TEST()
1019 EXPECT_TRUE(matches("namespace X { int x; } using X::x;", in TEST()
1024 EXPECT_TRUE(matches("namespace f { int a; } using f::a;", in TEST()
1029 EXPECT_TRUE(matches("namespace X { int x; } using namespace X;", in TEST()
1032 matches("namespace X { int x; } using X::x;", usingDirectiveDecl())); in TEST()
1038 EXPECT_TRUE(matches("void x() { while(true); }", whileStmt())); in TEST()
1043 EXPECT_TRUE(matches("void x() { do {} while(true); }", doStmt())); in TEST()
1044 EXPECT_TRUE(matches("void x() { do ; while(false); }", doStmt())); in TEST()
1052 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchCase())); in TEST()
1053 EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchCase())); in TEST()
1054 EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchCase())); in TEST()
1059 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchStmt())); in TEST()
1060 EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchStmt())); in TEST()
1061 EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchStmt())); in TEST()
1066 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxCatchStmt())); in TEST()
1067 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxTryStmt())); in TEST()
1070 EXPECT_TRUE(matches("void foo() try { throw; } catch(int X) { }", in TEST()
1072 EXPECT_TRUE(matches("void foo() try { throw 5;} catch(int X) { }", in TEST()
1074 EXPECT_TRUE(matches("void foo() try { throw; } catch(...) { }", in TEST()
1078 EXPECT_TRUE(matches("void foo() try {} catch(int X) { }", in TEST()
1085 EXPECT_TRUE(matches("int i = (3);", parenExpr())); in TEST()
1086 EXPECT_TRUE(matches("int i = (3 + 7);", parenExpr())); in TEST()
1093 EXPECT_TRUE(matches("struct S {};", qualType().bind("loc"))); in TEST()
1097 EXPECT_TRUE(matches("int a[2];", constantArrayType())); in TEST()
1102 EXPECT_TRUE(matches("int a[42];", constantArrayType(hasSize(42)))); in TEST()
1103 EXPECT_TRUE(matches("int b[2*21];", constantArrayType(hasSize(42)))); in TEST()
1108 EXPECT_TRUE(matches( in TEST()
1117 EXPECT_TRUE(matches("int a[] = { 2, 3 };", incompleteArrayType())); in TEST()
1118 EXPECT_TRUE(matches("void f(int a[]) {}", incompleteArrayType())); in TEST()
1125 EXPECT_TRUE(matches("void f(int b) { int a[b]; }", variableArrayType())); in TEST()
1128 EXPECT_TRUE(matches( in TEST()
1139 EXPECT_TRUE(matches("_Atomic(int) i;", atomicType())); in TEST()
1141 EXPECT_TRUE(matches("_Atomic(int) i;", in TEST()
1149 EXPECT_TRUE(matches("auto i = 2;", autoType())); in TEST()
1150 EXPECT_TRUE(matches("int v[] = { 2, 3 }; void f() { for (int i : v) {} }", in TEST()
1162 EXPECT_TRUE(matches("int (*f)(int);", functionType())); in TEST()
1163 EXPECT_TRUE(matches("void f(int i) {}", functionType())); in TEST()
1169 EXPECT_TRUE(matches("void (*fp)(void);", in TEST()
1174 EXPECT_TRUE(matches("int (*f)(int);", functionProtoType())); in TEST()
1175 EXPECT_TRUE(matches("void f(int i);", functionProtoType())); in TEST()
1176 EXPECT_TRUE(matches("void f();", functionProtoType(parameterCountIs(0)))); in TEST()
1184 matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType()))))); in TEST()
1187 EXPECT_TRUE(matches( in TEST()
1207 EXPECT_TRUE(matches( in TEST()
1210 EXPECT_TRUE(matches( in TEST()
1213 EXPECT_TRUE(matches( in TEST()
1220 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"), in TEST()
1236 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"), in TEST()
1248 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"), in TEST()
1250 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"), in TEST()
1262 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"), in TEST()
1266 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"), in TEST()
1280 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"), in TEST()
1282 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"), in TEST()
1286 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"), in TEST()
1288 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"), in TEST()
1292 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"), in TEST()
1296 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"), in TEST()
1301 EXPECT_TRUE(matches("enum Color { Green }; Color color;", in TEST()
1303 EXPECT_TRUE(matches("enum class Color { Green }; Color color;", in TEST()
1308 EXPECT_TRUE(matches("int b; int * const a = &b;", in TEST()
1310 EXPECT_TRUE(matches("int b; int * const a = &b;", in TEST()
1312 EXPECT_TRUE(matches( in TEST()
1315 EXPECT_TRUE(matches( in TEST()
1321 EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"), in TEST()
1326 EXPECT_TRUE(matches("template <typename T> class A{}; A<int> a;", in TEST()
1331 EXPECT_TRUE(matches("class C{}; C c;", recordType())); in TEST()
1332 EXPECT_TRUE(matches("struct S{}; S s;", in TEST()
1339 EXPECT_TRUE(matches( in TEST()
1346 EXPECT_TRUE(matches("class C {} c;", elaboratedType())); in TEST()
1356 EXPECT_FALSE(matches(code, binaryOperator(hasLHS( in TEST()
1358 EXPECT_TRUE(matches(code, binaryOperator(hasRHS( in TEST()
1363 EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;", in TEST()
1365 EXPECT_TRUE(matches("template <typename T> class A { typename T::B b; };", in TEST()
1367 EXPECT_TRUE(matches("struct A { void f(); }; void A::f() {}", in TEST()
1369 EXPECT_TRUE(matches("namespace a { namespace b {} } namespace ab = a::b;", in TEST()
1372 EXPECT_TRUE(matches( in TEST()
1381 EXPECT_TRUE(matches("void f() {int i;;}", nullStmt())); in TEST()
1386 EXPECT_TRUE(matches("namespace test {} namespace alias = ::test;", in TEST()
1393 EXPECT_TRUE(matches("struct A { struct B {}; }; A::B b;", Matcher)); in TEST()
1394 EXPECT_TRUE(matches("struct A { struct B { struct C {}; }; }; A::B::C c;", in TEST()
1402 EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;", Matcher)); in TEST()
1408 EXPECT_TRUE(matches( in TEST()
1411 EXPECT_TRUE(matches( in TEST()
1472 EXPECT_TRUE(matches("typedef int typedefDeclTest;", in TEST()
1479 EXPECT_TRUE(matches("using typeAliasTest2 = int;", in TEST()
1486 EXPECT_TRUE(matches("typedef int typedefNameDeclTest1;", in TEST()
1488 EXPECT_TRUE(matches("using typedefNameDeclTest2 = int;", in TEST()