Lines Matching defs:matcher

1 //== unittests/ASTMatchers/ASTMatchersNodeTest.cpp - AST matcher unit tests ==//
2227 auto matcher = varDecl(hasName("x"), hasTypeLoc(pointerTypeLoc()));
2228 EXPECT_TRUE(matches("int* x;", matcher));
2229 EXPECT_TRUE(matches("float* x;", matcher));
2230 EXPECT_TRUE(matches("char* x;", matcher));
2231 EXPECT_TRUE(matches("void* x;", matcher));
2235 auto matcher = varDecl(hasName("x"), hasTypeLoc(pointerTypeLoc()));
2236 EXPECT_TRUE(notMatches("int x;", matcher));
2237 EXPECT_TRUE(notMatches("float x;", matcher));
2238 EXPECT_TRUE(notMatches("char x;", matcher));
2245 auto matcher = varDecl(hasName("r"), hasTypeLoc(referenceTypeLoc()));
2246 EXPECT_TRUE(matches("int rr = 3; int& r = rr;", matcher));
2247 EXPECT_TRUE(matches("int rr = 3; auto& r = rr;", matcher));
2248 EXPECT_TRUE(matches("int rr = 3; const int& r = rr;", matcher));
2249 EXPECT_TRUE(matches("float rr = 3.0; float& r = rr;", matcher));
2250 EXPECT_TRUE(matches("char rr = 'a'; char& r = rr;", matcher));
2254 auto matcher = varDecl(hasName("r"), hasTypeLoc(referenceTypeLoc()));
2255 EXPECT_TRUE(notMatches("int r;", matcher));
2256 EXPECT_TRUE(notMatches("int r = 3;", matcher));
2257 EXPECT_TRUE(notMatches("const int r = 3;", matcher));
2258 EXPECT_TRUE(notMatches("int* r;", matcher));
2259 EXPECT_TRUE(notMatches("float r;", matcher));
2260 EXPECT_TRUE(notMatches("char r;", matcher));
2267 auto matcher = varDecl(hasName("r"), hasTypeLoc(referenceTypeLoc()));
2268 EXPECT_TRUE(matches("int&& r = 3;", matcher));
2269 EXPECT_TRUE(matches("auto&& r = 3;", matcher));
2270 EXPECT_TRUE(matches("float&& r = 3.0;", matcher));
2359 auto matcher = lambdaExpr(
2362 matcher));
2364 matcher));
2366 matches("int main() { int cc; auto f = [=](){ return cc; }; }", matcher));
2368 matches("int main() { int cc; auto f = [&](){ return cc; }; }", matcher));
2370 "void f(int a) { int cc[a]; auto f = [&](){ return cc;}; }", matcher));
2377 auto matcher = lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(
2380 matches("int main() { auto lambda = [cc = 1] {return cc;}; }", matcher));
2383 matcher));
2390 auto matcher = lambdaExpr(
2392 EXPECT_FALSE(matches("int main() { auto f = [](){ return 5; }; }", matcher));
2394 matcher));
2412 auto matcher = lambdaExpr(hasAnyCapture(
2421 "}", matcher));
2429 "}", matcher));
2440 DeclarationMatcher matcher = cxxRecordDecl(isDerivedFrom("X"));
2454 matcher));
2503 matcher));