diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-07 10:09:13 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-07 10:09:13 +0000 |
commit | 01d08018b7cf5ce1601707cfd7a84d22015fc04e (patch) | |
tree | 26fbc3189050b39b3027ced93cc16a038386732f /include/clang/Basic/Lambda.h | |
parent | 1e01ac4e4b8981942514ca8e1916bccef99a7ae2 (diff) | |
download | clang-01d08018b7cf5ce1601707cfd7a84d22015fc04e.tar.gz |
Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
- The representation of lambda captures
- The creation of the non-static data members in the lambda class
that store the captured variables
- The initialization of the non-static data members from the
captured variables
- Pretty-printing lambda expressions
There are a number of FIXMEs, both explicit and implied, including:
- Creating a field for a capture of 'this'
- Improved diagnostics for initialization failures when capturing
variables by copy
- Dealing with temporaries created during said initialization
- Template instantiation
- AST (de-)serialization
- Binding and returning the lambda expression; turning it into a
proper temporary
- Lots and lots of semantic constraints
- Parameter pack captures
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Lambda.h')
-rw-r--r-- | include/clang/Basic/Lambda.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/clang/Basic/Lambda.h b/include/clang/Basic/Lambda.h new file mode 100644 index 0000000000..df50d94894 --- /dev/null +++ b/include/clang/Basic/Lambda.h @@ -0,0 +1,38 @@ +//===--- Lambda.h - Types for C++ Lambdas -----------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines several types used to describe C++ lambda +// expressions that are shared between the parser and AST. +//===----------------------------------------------------------------------===// + + +#ifndef LLVM_CLANG_BASIC_LAMBDA_H +#define LLVM_CLANG_BASIC_LAMBDA_H + +namespace clang { + +/// LambdaCaptureDefault - The default, if any, capture method for a +/// lambda expression. +enum LambdaCaptureDefault { + LCD_None, + LCD_ByCopy, + LCD_ByRef +}; + +/// LambdaCaptureKind - The different capture forms in a lambda +/// introducer: 'this' or a copied or referenced variable. +enum LambdaCaptureKind { + LCK_This, + LCK_ByCopy, + LCK_ByRef +}; + +} // end namespace clang + +#endif // LLVM_CLANG_BASIC_LAMBDA_H |