brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 4b0c4c3 Raw
36 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "TestVisitor.h"10 11using namespace clang;12 13namespace {14 15class CXXBoolLiteralExprVisitor : public ExpectedLocationVisitor {16public:17  bool VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *BE) override {18    if (BE->getValue())19      Match("true", BE->getLocation());20    else21      Match("false", BE->getLocation());22    return true;23  }24};25 26TEST(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"));33}34 35} // end anonymous namespace36