diff options
author | Samuel Benzaquen <sbenza@google.com> | 2016-06-28 14:08:56 +0000 |
---|---|---|
committer | Samuel Benzaquen <sbenza@google.com> | 2016-06-28 14:08:56 +0000 |
commit | 49385c78bcdd5c0238cdea38bf9d63a0480754b5 (patch) | |
tree | e2e2525c87c2225fc5b2d07409bf74f506893c9c /clang/unittests | |
parent | f7b9075e52ddaf1e8ec86883e877b76ef8a07cdf (diff) | |
download | bcm5719-llvm-49385c78bcdd5c0238cdea38bf9d63a0480754b5.tar.gz bcm5719-llvm-49385c78bcdd5c0238cdea38bf9d63a0480754b5.zip |
[ASTMatchers] Add isLambda() matcher.
llvm-svn: 274015
Diffstat (limited to 'clang/unittests')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp index e304d0629cb..7deed85440d 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ b/clang/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")); |