1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | #include "TestVisitor.h" |
10 | |
11 | using namespace clang; |
12 | |
13 | namespace { |
14 | |
15 | |
16 | class IntegerLiteralVisitor |
17 | : public ExpectedLocationVisitor<IntegerLiteralVisitor> { |
18 | public: |
19 | bool VisitIntegerLiteral(const IntegerLiteral *IL) { |
20 | Match("literal", IL->getLocation()); |
21 | return true; |
22 | } |
23 | }; |
24 | |
25 | TEST(RecursiveASTVisitor, DefaultArgumentsAreVisited) { |
26 | IntegerLiteralVisitor Visitor; |
27 | Visitor.ExpectMatch("literal", 1, 15, 2); |
28 | EXPECT_TRUE(Visitor.runOver("int f(int i = 1);\n" |
29 | "static int k = f();\n")); |
30 | } |
31 | |
32 | } |
33 | |