blob: 3fc3cb1a99a744c004a92ac9b4c5cdb137f36147 [file] [log] [blame]
David Zarzyckid488daa2018-04-19 18:19:02 +00001//===- unittest/Tooling/RecursiveASTVisitorTests/IntegerLiteral.cpp -------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
David Zarzyckid488daa2018-04-19 18:19:02 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "TestVisitor.h"
10
11using namespace clang;
12
13namespace {
14
15// Check to ensure that implicit default argument expressions are visited.
16class IntegerLiteralVisitor
17 : public ExpectedLocationVisitor<IntegerLiteralVisitor> {
18public:
19 bool VisitIntegerLiteral(const IntegerLiteral *IL) {
20 Match("literal", IL->getLocation());
21 return true;
22 }
23};
24
25TEST(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} // end anonymous namespace