2018-04-20 02:19:02 +08:00
|
|
|
//===- unittest/Tooling/RecursiveASTVisitorTests/ParenExpr.cpp ------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-04-20 02:19:02 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "TestVisitor.h"
|
|
|
|
|
|
|
|
using namespace clang;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class ParenExprVisitor : public ExpectedLocationVisitor<ParenExprVisitor> {
|
|
|
|
public:
|
|
|
|
bool VisitParenExpr(ParenExpr *Parens) {
|
|
|
|
Match("", Parens->getExprLoc());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST(RecursiveASTVisitor, VisitsParensDuringDataRecursion) {
|
|
|
|
ParenExprVisitor Visitor;
|
|
|
|
Visitor.ExpectMatch("", 1, 9);
|
|
|
|
EXPECT_TRUE(Visitor.runOver("int k = (4) + 9;\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end anonymous namespace
|