15 #ifndef LLVM_CLANG_AST_LAMBDACAPTURE_H
16 #define LLVM_CLANG_AST_LAMBDACAPTURE_H
20 #include "llvm/ADT/PointerIntPair.h"
30 Capture_Implicit = 0x01,
36 Capture_ByCopy = 0x02,
50 llvm::PointerIntPair<Decl*, 3> DeclAndBits;
84 return DeclAndBits.getPointer() ==
nullptr &&
85 (DeclAndBits.getInt() & Capture_This);
90 return dyn_cast_or_null<VarDecl>(DeclAndBits.getPointer());
96 return DeclAndBits.getPointer() ==
nullptr &&
97 !(DeclAndBits.getInt() & Capture_This);
107 return static_cast<VarDecl *
>(DeclAndBits.getPointer());
113 return DeclAndBits.getInt() & Capture_Implicit;
135 assert(
isPackExpansion() &&
"No ellipsis location for a non-expansion");
142 #endif // LLVM_CLANG_AST_LAMBDACAPTURE_H
LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind, VarDecl *Var=nullptr, SourceLocation EllipsisLoc=SourceLocation())
Create a new capture of a variable or of this.
Describes the capture of a variable or of this, or of a C++1y init-capture.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
LambdaCaptureKind
The different capture forms in a lambda introducer.
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
bool capturesVLAType() const
Determine whether this captures a variable length array bound expression.
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
SourceLocation getLocation() const
Retrieve the source location of the capture.
bool isExplicit() const
Determine whether this was an explicit capture (written between the square brackets introducing the l...
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
bool capturesThis() const
Determine whether this capture handles the C++ this pointer.
bool capturesVariable() const
Determine whether this capture handles a variable.