1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | #include "TestVisitor.h" |
10 | |
11 | using namespace clang; |
12 | |
13 | namespace { |
14 | |
15 | |
16 | class LambdaDefaultCaptureVisitor |
17 | : public ExpectedLocationVisitor<LambdaDefaultCaptureVisitor> { |
18 | public: |
19 | bool VisitLambdaExpr(LambdaExpr *Lambda) { |
20 | if (Lambda->getCaptureDefault() != LCD_None) { |
21 | Match("", Lambda->getCaptureDefaultLoc()); |
22 | } |
23 | return true; |
24 | } |
25 | }; |
26 | |
27 | TEST(RecursiveASTVisitor, HasCaptureDefaultLoc) { |
28 | LambdaDefaultCaptureVisitor Visitor; |
29 | Visitor.ExpectMatch("", 1, 20); |
30 | EXPECT_TRUE(Visitor.runOver("void f() { int a; [=]{a;}; }", |
31 | LambdaDefaultCaptureVisitor::Lang_CXX11)); |
32 | } |
33 | |
34 | } |
35 | |