blob: 218f7e0c2df6a0d5d2723497a67148210e60ca62 [file] [log] [blame]
David Zarzyckid488daa2018-04-19 18:19:02 +00001//===- 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
12using namespace clang;
13
14namespace {
15
16// Check to ensure that implicit default argument expressions are visited.
17class IntegerLiteralVisitor
18 : public ExpectedLocationVisitor<IntegerLiteralVisitor> {
19public:
20 bool VisitIntegerLiteral(const IntegerLiteral *IL) {
21 Match("literal", IL->getLocation());
22 return true;
23 }
24};
25
26TEST(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