1 //===--- Lambda.h - Types for C++ Lambdas -----------------------*- C++ -*-===// 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 /// 9 /// \file 10 /// Defines several types used to describe C++ lambda expressions 11 /// that are shared between the parser and AST. 12 /// 13 //===----------------------------------------------------------------------===// 14 15 16 #ifndef LLVM_CLANG_BASIC_LAMBDA_H 17 #define LLVM_CLANG_BASIC_LAMBDA_H 18 19 namespace clang { 20 21 /// The default, if any, capture method for a lambda expression. 22 enum LambdaCaptureDefault { 23 LCD_None, 24 LCD_ByCopy, 25 LCD_ByRef 26 }; 27 28 /// The different capture forms in a lambda introducer 29 /// 30 /// C++11 allows capture of \c this, or of local variables by copy or 31 /// by reference. C++1y also allows "init-capture", where the initializer 32 /// is an expression. 33 enum LambdaCaptureKind { 34 LCK_This, ///< Capturing the \c *this object by reference 35 LCK_StarThis, ///< Capturing the \c *this object by copy 36 LCK_ByCopy, ///< Capturing by copy (a.k.a., by value) 37 LCK_ByRef, ///< Capturing by reference 38 LCK_VLAType ///< Capturing variable-length array type 39 }; 40 41 } // end namespace clang 42 43 #endif // LLVM_CLANG_BASIC_LAMBDA_H 44