1 //===- unittest/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.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"
12 using namespace clang
;
16 // Check to ensure that bitfield initializers are visited.
17 class BitfieldInitializerVisitor
18 : public ExpectedLocationVisitor
<BitfieldInitializerVisitor
> {
20 bool VisitIntegerLiteral(IntegerLiteral
*IL
) {
21 Match(std::to_string(IL
->getValue().getSExtValue()), IL
->getLocation());
26 TEST(RecursiveASTVisitor
, BitfieldInitializerIsVisited
) {
27 BitfieldInitializerVisitor Visitor
;
28 Visitor
.ExpectMatch("123", 2, 15);
29 EXPECT_TRUE(Visitor
.runOver("struct S {\n"
34 } // end anonymous namespace