[SCFToGPU] Convert scf.parallel+scf.reduce to gpu.all_reduce (#122782)
[llvm-project.git] / clang / unittests / Tooling / RecursiveASTVisitorTests / Class.cpp
blob79dc84b2fdb7b9be5fe12f4889cf97b3322843e3
1 //===- unittest/Tooling/RecursiveASTVisitorTests/Class.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 // Checks for lambda classes that are not marked as implicitly-generated.
16 // (There should be none.)
17 class ClassVisitor : public ExpectedLocationVisitor {
18 public:
19 ClassVisitor() : SawNonImplicitLambdaClass(false) {}
21 bool VisitCXXRecordDecl(CXXRecordDecl *record) override {
22 if (record->isLambda() && !record->isImplicit())
23 SawNonImplicitLambdaClass = true;
24 return true;
27 bool sawOnlyImplicitLambdaClasses() const {
28 return !SawNonImplicitLambdaClass;
31 private:
32 bool SawNonImplicitLambdaClass;
35 TEST(RecursiveASTVisitor, LambdaClosureTypesAreImplicit) {
36 ClassVisitor Visitor;
37 EXPECT_TRUE(Visitor.runOver("auto lambda = []{};", ClassVisitor::Lang_CXX11));
38 EXPECT_TRUE(Visitor.sawOnlyImplicitLambdaClasses());
41 } // end anonymous namespace