1 //===- unittest/Tooling/RecursiveASTVisitorTests/CXXBoolLiteralExpr.cpp ---===//
3 // 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
7 //===----------------------------------------------------------------------===//
9 #include "TestVisitor.h"
11 using namespace clang
;
15 class CXXBoolLiteralExprVisitor
: public ExpectedLocationVisitor
{
17 bool VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr
*BE
) override
{
19 Match("true", BE
->getLocation());
21 Match("false", BE
->getLocation());
26 TEST(RecursiveASTVisitor
, VisitsClassTemplateNonTypeParmDefaultArgument
) {
27 CXXBoolLiteralExprVisitor Visitor
;
28 Visitor
.ExpectMatch("true", 2, 19);
29 EXPECT_TRUE(Visitor
.runOver(
30 "template<bool B> class X;\n"
31 "template<bool B = true> class Y;\n"
32 "template<bool B> class Y {};\n"));
35 } // end anonymous namespace