ParenExpr.cpp 830 B

1234567891011121314151617181920212223242526272829
  1. //===- unittest/Tooling/RecursiveASTVisitorTests/ParenExpr.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. //===----------------------------------------------------------------------===//
  8. #include "TestVisitor.h"
  9. using namespace clang;
  10. namespace {
  11. class ParenExprVisitor : public ExpectedLocationVisitor<ParenExprVisitor> {
  12. public:
  13. bool VisitParenExpr(ParenExpr *Parens) {
  14. Match("", Parens->getExprLoc());
  15. return true;
  16. }
  17. };
  18. TEST(RecursiveASTVisitor, VisitsParensDuringDataRecursion) {
  19. ParenExprVisitor Visitor;
  20. Visitor.ExpectMatch("", 1, 9);
  21. EXPECT_TRUE(Visitor.runOver("int k = (4) + 9;\n"));
  22. }
  23. } // end anonymous namespace