Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / unittests / Tooling / RecursiveASTVisitorTests / CXXBoolLiteralExpr.cpp
blob1fb192dcda0863071212ddba3d7c40fae2e65255
1 //===- unittest/Tooling/RecursiveASTVisitorTests/CXXBoolLiteralExpr.cpp ---===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "TestVisitor.h"
11 using namespace clang;
13 namespace {
15 class CXXBoolLiteralExprVisitor
16 : public ExpectedLocationVisitor<CXXBoolLiteralExprVisitor> {
17 public:
18 bool VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *BE) {
19 if (BE->getValue())
20 Match("true", BE->getLocation());
21 else
22 Match("false", BE->getLocation());
23 return true;
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