summaryrefslogtreecommitdiffstats
path: root/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
diff options
context:
space:
mode:
authorSamuel Benzaquen <sbenza@google.com>2016-06-28 14:08:56 +0000
committerSamuel Benzaquen <sbenza@google.com>2016-06-28 14:08:56 +0000
commitcada05da005b642724c9ccecf725ae26c7c8f30c (patch)
tree87b2517acc81b704eac13f1c78b67206408cf02a /unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
parent09e469bb95e43671457af4f55d39e2b409a9c650 (diff)
[ASTMatchers] Add isLambda() matcher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp')
-rw-r--r--unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index e304d0629c..7deed85440 100644
--- a/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -537,6 +537,12 @@ TEST(DeclarationMatcher, ClassIsDerived) {
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"));