[SCFToGPU] Convert scf.parallel+scf.reduce to gpu.all_reduce (#122782)
[llvm-project.git] / clang / unittests / Tooling / RecursiveASTVisitorTests / CXXOperatorCallExprTraverser.cpp
blob46686199c05d4ecfa1ac77781e072022f4c13b79
1 //===- CXXOperatorCallExprTraverser.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 //===----------------------------------------------------------------------===//
9 #include "TestVisitor.h"
11 using namespace clang;
13 namespace {
15 class CXXOperatorCallExprTraverser : public ExpectedLocationVisitor {
16 public:
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(
29 "struct A {\n"
30 " int operator()();\n"
31 "} a;\n"
32 "int k = a();\n"));
35 } // end anonymous namespace