1 //===- CXXOperatorCallExprTraverser.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"
11 using namespace clang
;
15 class CXXOperatorCallExprTraverser
: public ExpectedLocationVisitor
{
17 // Use Traverse, not Visit, to check that data recursion optimization isn't
18 // bypassing the call of this function.
19 bool TraverseCXXOperatorCallExpr(CXXOperatorCallExpr
*CE
) override
{
20 Match(getOperatorSpelling(CE
->getOperator()), CE
->getExprLoc());
21 return ExpectedLocationVisitor::TraverseCXXOperatorCallExpr(CE
);
25 TEST(RecursiveASTVisitor
, TraversesOverloadedOperator
) {
26 CXXOperatorCallExprTraverser Visitor
;
27 Visitor
.ExpectMatch("()", 4, 9);
28 EXPECT_TRUE(Visitor
.runOver(
30 " int operator()();\n"
35 } // end anonymous namespace