Match code following lambdas when ignoring invisible nodes

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71976
This commit is contained in:
Stephen Kelly 2019-12-29 19:19:35 +00:00
parent df3b56c905
commit d89c4cb938
2 changed files with 7 additions and 1 deletions

View File

@ -248,7 +248,7 @@ public:
if (!match(*Node->getBody()))
return false;
return false;
return true;
}
bool shouldVisitTemplateInstantiations() const { return true; }

View File

@ -1760,6 +1760,7 @@ void func13() {
void func14() {
[] <typename TemplateType> (TemplateType t, TemplateType u) { int e = t + u; };
float i = 42.0;
}
)cpp";
@ -1849,6 +1850,11 @@ void func14() {
lambdaExpr(
forFunction(functionDecl(hasName("func14"))),
has(templateTypeParmDecl(hasName("TemplateType")))))));
EXPECT_TRUE(
matches(Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource,
functionDecl(hasName("func14"),
hasDescendant(floatLiteral())))));
}
TEST(IgnoringImpCasts, MatchesImpCasts) {