summaryrefslogtreecommitdiffstats
path: root/include/clang/Sema/ScopeInfo.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-14 19:27:52 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-14 19:27:52 +0000
commita73652465bcc4c0f6cb7d933ad84e002b527a643 (patch)
tree04ea4a96da25afda7a6dc6353d0ad0bbee083894 /include/clang/Sema/ScopeInfo.h
parent63aae82bb12bbbe9028e597fb77e40fa8d348c12 (diff)
Implement support for lambda capture pack expansions, e.g.,
[&values...] { print(values...); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/ScopeInfo.h')
-rw-r--r--include/clang/Sema/ScopeInfo.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index 57a49e6114..46b97e7113 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -151,16 +151,19 @@ public:
/// \brief The source location at which the first capture occurred..
SourceLocation Loc;
+ /// \brief The location of the ellipsis that expands a parameter pack.
+ SourceLocation EllipsisLoc;
+
public:
Capture(VarDecl *Var, bool block, bool byRef, bool isNested,
- SourceLocation Loc, Expr *Cpy)
+ SourceLocation Loc, SourceLocation EllipsisLoc, Expr *Cpy)
: VarAndKind(Var, block ? Cap_Block : byRef ? Cap_ByRef : Cap_ByCopy),
- CopyExprAndNested(Cpy, isNested) {}
+ CopyExprAndNested(Cpy, isNested), Loc(Loc), EllipsisLoc(EllipsisLoc) {}
enum IsThisCapture { ThisCapture };
Capture(IsThisCapture, bool isNested, SourceLocation Loc, Expr *Cpy)
- : VarAndKind(0, Cap_This), CopyExprAndNested(Cpy, isNested), Loc(Loc) {
- }
+ : VarAndKind(0, Cap_This), CopyExprAndNested(Cpy, isNested), Loc(Loc),
+ EllipsisLoc() { }
bool isThisCapture() const { return VarAndKind.getInt() == Cap_This; }
bool isVariableCapture() const { return !isThisCapture(); }
@@ -176,6 +179,10 @@ public:
/// \brief Retrieve the location at which this variable was captured.
SourceLocation getLocation() const { return Loc; }
+ /// \brief Retrieve the source location of the ellipsis, whose presence
+ /// indicates that the capture is a pack expansion.
+ SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
+
Expr *getCopyExpr() const {
return CopyExprAndNested.getPointer();
}
@@ -205,8 +212,9 @@ public:
QualType ReturnType;
void AddCapture(VarDecl *Var, bool isBlock, bool isByref, bool isNested,
- SourceLocation Loc, Expr *Cpy) {
- Captures.push_back(Capture(Var, isBlock, isByref, isNested, Loc, Cpy));
+ SourceLocation Loc, SourceLocation EllipsisLoc, Expr *Cpy) {
+ Captures.push_back(Capture(Var, isBlock, isByref, isNested, Loc,
+ EllipsisLoc, Cpy));
CaptureMap[Var] = Captures.size();
}