1 //===- unittest/Tooling/RecursiveASTVisitorTests/ParenExpr.cpp ------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "TestVisitor.h" 11 12 using namespace clang; 13 14 namespace { 15 16 class ParenExprVisitor : public ExpectedLocationVisitor<ParenExprVisitor> { 17 public: 18 bool VisitParenExpr(ParenExpr *Parens) { 19 Match("", Parens->getExprLoc()); 20 return true; 21 } 22 }; 23 24 TEST(RecursiveASTVisitor, VisitsParensDuringDataRecursion) { 25 ParenExprVisitor Visitor; 26 Visitor.ExpectMatch("", 1, 9); 27 EXPECT_TRUE(Visitor.runOver("int k = (4) + 9;\n")); 28 } 29 30 } // end anonymous namespace 31