[ASTMatchers] Add isLambda() matcher.
llvm-svn: 274015
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index e304d06..7deed85 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -537,6 +537,12 @@
cxxRecordDecl(isDerivedFrom(namedDecl(hasName("X"))))));
}
+TEST(DeclarationMatcher, IsLambda) {
+ const auto IsLambda = cxxMethodDecl(ofClass(cxxRecordDecl(isLambda())));
+ EXPECT_TRUE(matches("auto x = []{};", IsLambda));
+ EXPECT_TRUE(notMatches("struct S { void operator()() const; };", IsLambda));
+}
+
TEST(Matcher, BindMatchedNodes) {
DeclarationMatcher ClassX = has(recordDecl(hasName("::X")).bind("x"));