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
16 : public ExpectedLocationVisitor
<CXXBoolLiteralExprVisitor
> {
18 bool VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr
*BE
) {
20 Match("true", BE
->getLocation());
22 Match("false", BE
->getLocation());
27 TEST(RecursiveASTVisitor
, VisitsClassTemplateNonTypeParmDefaultArgument
) {
28 CXXBoolLiteralExprVisitor Visitor
;
29 Visitor
.ExpectMatch("true", 2, 19);
30 EXPECT_TRUE(Visitor
.runOver(
31 "template<bool B> class X;\n"
32 "template<bool B = true> class Y;\n"
33 "template<bool B> class Y {};\n"));
36 } // end anonymous namespace