clang 8.0.0

Public Member Functions | Friends | List of all members
clang::LambdaCapture Class Reference

Describes the capture of a variable or of `this`, or of a C++1y init-capture. More...

`#include "clang/AST/LambdaCapture.h"`

## Public Member Functions
| LambdaCapture (SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind, VarDecl *Var=nullptr, SourceLocation EllipsisLoc=SourceLocation())
| Create a new capture of a variable or of `this`. More...
LambdaCaptureKind | getCaptureKind () const
| Determine the kind of capture. More...
bool | capturesThis () const
| Determine whether this capture handles the C++ `this` pointer. More...
bool | capturesVariable () const
| Determine whether this capture handles a variable. More...
bool | capturesVLAType () const
| Determine whether this captures a variable length array bound expression. More...
VarDecl * | getCapturedVar () const
| Retrieve the declaration of the local variable being captured. More...
bool | isImplicit () const
| Determine whether this was an implicit capture (not written between the square brackets introducing the lambda). More...
bool | isExplicit () const
| Determine whether this was an explicit capture (written between the square brackets introducing the lambda). More...
SourceLocation | getLocation () const
| Retrieve the source location of the capture. More...
bool | isPackExpansion () const
| Determine whether this capture is a pack expansion, which captures a function parameter pack. More...
SourceLocation | getEllipsisLoc () const
| Retrieve the location of the ellipsis for a capture that is a pack expansion. More...

## Friends
class | ASTStmtReader
class | ASTStmtWriter

## Detailed Description

Describes the capture of a variable or of `this`, or of a C++1y init-capture.

Definition at line 26 of file LambdaCapture.h.

## Constructor & Destructor Documentation

## ◆ LambdaCapture()

LambdaCapture::LambdaCapture | ( | SourceLocation | Loc,
|  | bool | Implicit,
|  | LambdaCaptureKind | Kind,
|  | VarDecl * | Var = `nullptr`,
|  | SourceLocation | EllipsisLoc = `SourceLocation()`
| ) |  |

Create a new capture of a variable or of `this`.

Parameters

  Loc | The source location associated with this capture.
  Kind | The kind of capture (this, byref, bycopy), which must not be init-capture.
  Implicit | Whether the capture was implicit or explicit.
  Var | The local variable being captured, or null if capturing `this`.
  EllipsisLoc | The location of the ellipsis (...) for a capture that is a pack expansion, or an invalid source location to indicate that this is not a pack expansion.

Definition at line 1046 of file ExprCXX.cpp.

References clang::LCK_ByCopy, clang::LCK_ByRef, clang::LCK_StarThis, clang::LCK_This, and clang::LCK_VLAType.

## Member Function Documentation

## ◆ capturesThis()

bool clang::LambdaCapture::capturesThis | ( |  | ) | const
| inline

Determine whether this capture handles the C++ `this` pointer.

Definition at line 83 of file LambdaCapture.h.

Referenced by getCaptureKind().

## ◆ capturesVariable()

bool clang::LambdaCapture::capturesVariable | ( |  | ) | const
| inline

Determine whether this capture handles a variable.

Definition at line 89 of file LambdaCapture.h.

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), getCapturedVar(), clang::ASTNodeImporter::import(), and clang::LambdaExpr::isInitCapture().

## ◆ capturesVLAType()

bool clang::LambdaCapture::capturesVLAType | ( |  | ) | const
| inline

Determine whether this captures a variable length array bound expression.

Definition at line 95 of file LambdaCapture.h.

Referenced by getCaptureKind().

## ◆ getCapturedVar()

VarDecl* clang::LambdaCapture::getCapturedVar | ( |  | ) | const
| inline

Retrieve the declaration of the local variable being captured.

This operation is only valid if this capture is a variable capture (other than a capture of `this`).

Definition at line 105 of file LambdaCapture.h.

References capturesVariable().

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), clang::ASTNodeImporter::import(), clang::LambdaExpr::isInitCapture(), and clang::RecursiveASTVisitor< CallGraph >::TraverseLambdaCapture().

## ◆ getCaptureKind()

LambdaCaptureKind LambdaCapture::getCaptureKind | ( |  | ) | const

Determine the kind of capture.

Definition at line 1076 of file ExprCXX.cpp.

References clang::ASTContext::Allocate(), capturesThis(), capturesVLAType(), clang::Type::isDependentType(), isExplicit(), clang::LCK_ByCopy, clang::LCK_ByRef, clang::LCK_StarThis, clang::LCK_This, clang::LCK_VLAType, clang::OK_Ordinary, and clang::VK_RValue.

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), and clang::ASTNodeImporter::import().

## ◆ getEllipsisLoc()

SourceLocation clang::LambdaCapture::getEllipsisLoc | ( |  | ) | const
| inline

Retrieve the location of the ellipsis for a capture that is a pack expansion.

Definition at line 134 of file LambdaCapture.h.

References isPackExpansion().

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), and clang::ASTNodeImporter::import().

## ◆ getLocation()

SourceLocation clang::LambdaCapture::getLocation | ( |  | ) | const
| inline

Retrieve the source location of the capture.

For an explicit capture, this returns the location of the explicit capture in the source. For an implicit capture, this returns the location at which the variable or `this` was first used.

Definition at line 126 of file LambdaCapture.h.

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), and clang::ASTNodeImporter::import().

## ◆ isExplicit()

bool clang::LambdaCapture::isExplicit | ( |  | ) | const
| inline

Determine whether this was an explicit capture (written between the square brackets introducing the lambda).

Definition at line 118 of file LambdaCapture.h.

References isImplicit().

Referenced by getCaptureKind().

## ◆ isImplicit()

bool clang::LambdaCapture::isImplicit | ( |  | ) | const
| inline

Determine whether this was an implicit capture (not written between the square brackets introducing the lambda).

Definition at line 112 of file LambdaCapture.h.

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), clang::ASTNodeImporter::import(), and isExplicit().

## ◆ isPackExpansion()

bool clang::LambdaCapture::isPackExpansion | ( |  | ) | const
| inline

Determine whether this capture is a pack expansion, which captures a function parameter pack.

Definition at line 130 of file LambdaCapture.h.

References clang::SourceLocation::isValid().

Referenced by clang::ASTRecordWriter::AddCXXDefinitionData(), getEllipsisLoc(), and clang::ASTNodeImporter::import().

## Friends And Related Function Documentation

## ◆ ASTStmtReader

friend class ASTStmtReader
| friend

Definition at line 55 of file LambdaCapture.h.

## ◆ ASTStmtWriter

friend class ASTStmtWriter
| friend

Definition at line 56 of file LambdaCapture.h.

The documentation for this class was generated from the following files:

- include/clang/AST/LambdaCapture.h
- lib/AST/ExprCXX.cpp