]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - unittests/Tooling/RecursiveASTVisitorTests/IntegerLiteral.cpp
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / unittests / Tooling / RecursiveASTVisitorTests / IntegerLiteral.cpp
1 //===- unittest/Tooling/RecursiveASTVisitorTests/IntegerLiteral.cpp -------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "TestVisitor.h"
11
12 using namespace clang;
13
14 namespace {
15
16 // Check to ensure that implicit default argument expressions are visited.
17 class IntegerLiteralVisitor
18     : public ExpectedLocationVisitor<IntegerLiteralVisitor> {
19 public:
20   bool VisitIntegerLiteral(const IntegerLiteral *IL) {
21     Match("literal", IL->getLocation());
22     return true;
23   }
24 };
25
26 TEST(RecursiveASTVisitor, DefaultArgumentsAreVisited) {
27   IntegerLiteralVisitor Visitor;
28   Visitor.ExpectMatch("literal", 1, 15, 2);
29   EXPECT_TRUE(Visitor.runOver("int f(int i = 1);\n"
30                               "static int k = f();\n"));
31 }
32
33 } // end anonymous namespace