class BlockDecl

Declaration

class BlockDecl : public Decl, public DeclContext { /* full declaration omitted */ };

Description

Represents a block literal declaration, which is like an unnamed FunctionDecl. For example: ^{ statement-body } or ^(int arg1, float arg2){ statement-body }

Declared at: clang/include/clang/AST/Decl.h:4219

Inherits from: Decl, DeclContext

Member Variables

private clang::ParmVarDecl** ParamInfo = nullptr
A new[]'d array of pointers to ParmVarDecls for the formal parameters of this function. This is null if a prototype or if there are no formals.
private unsigned int NumParams = 0
private clang::Stmt* Body = nullptr
private clang::TypeSourceInfo* SignatureAsWritten = nullptr
private const clang::BlockDecl::Capture* Captures = nullptr
private unsigned int NumCaptures = 0
private unsigned int ManglingNumber = 0
private clang::Decl* ManglingContextDecl = nullptr

Inherited from DeclContext:

protected
protected FirstDecl = nullptr
protected LastDecl = nullptr

Inherited from Decl:

protected NextInContextAndBits
protected Access
protected FromASTFile
protected IdentifierNamespace
protected CacheValidAndLinkage

Method Overview

Inherited from DeclContext:

Inherited from Decl:

Methods

BlockDecl(clang::DeclContext* DC,
          clang::SourceLocation CaretLoc)

Declared at: clang/include/clang/AST/Decl.h:4286

Parameters

clang::DeclContext* DC
clang::SourceLocation CaretLoc

static clang::BlockDecl* Create(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation L)

Declared at: clang/include/clang/AST/Decl.h:4289

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation L

static clang::BlockDecl* CreateDeserialized(
    clang::ASTContext& C,
    unsigned int ID)

Declared at: clang/include/clang/AST/Decl.h:4290

Parameters

clang::ASTContext& C
unsigned int ID

bool blockMissingReturnType() const

Declared at: clang/include/clang/AST/Decl.h:4354

bool canAvoidCopyToHeap() const

Declared at: clang/include/clang/AST/Decl.h:4373

clang::BlockDecl::capture_const_iterator
capture_begin() const

Declared at: clang/include/clang/AST/Decl.h:4348

clang::BlockDecl::capture_const_iterator
capture_end() const

Declared at: clang/include/clang/AST/Decl.h:4349

ArrayRef<clang::BlockDecl::Capture> captures()
    const

Declared at: clang/include/clang/AST/Decl.h:4346

bool capturesCXXThis() const

Declared at: clang/include/clang/AST/Decl.h:4351

bool capturesVariable(
    const clang::VarDecl* var) const

Declared at: clang/include/clang/AST/Decl.h:4380

Parameters

const clang::VarDecl* var

static clang::BlockDecl* castFromDeclContext(
    const clang::DeclContext* DC)

Declared at: clang/include/clang/AST/Decl.h:4402

Parameters

const clang::DeclContext* DC

static clang::DeclContext* castToDeclContext(
    const clang::BlockDecl* D)

Declared at: clang/include/clang/AST/Decl.h:4399

Parameters

const clang::BlockDecl* D

static bool classof(const clang::Decl* D)

Declared at: clang/include/clang/AST/Decl.h:4397

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/Decl.h:4398

Parameters

clang::Decl::Kind K

bool doesNotEscape() const

Declared at: clang/include/clang/AST/Decl.h:4370

clang::Decl* getBlockManglingContextDecl() const

Declared at: clang/include/clang/AST/Decl.h:4387

unsigned int getBlockManglingNumber() const

Declared at: clang/include/clang/AST/Decl.h:4385

clang::Stmt* getBody() const

Description

getBody - If this Decl represents a declaration for a body of code, such as a function or method definition, this method returns the top-level Stmt* of that body. Otherwise this method returns null.

Declared at: clang/include/clang/AST/Decl.h:4298

clang::SourceLocation getCaretLocation() const

Declared at: clang/include/clang/AST/Decl.h:4292

clang::CompoundStmt* getCompoundBody() const

Declared at: clang/include/clang/AST/Decl.h:4297

unsigned int getNumCaptures() const

Description

Returns the number of captured variables. Does not include an entry for 'this'.

Declared at: clang/include/clang/AST/Decl.h:4342

unsigned int getNumParams() const

Declared at: clang/include/clang/AST/Decl.h:4323

const clang::ParmVarDecl* getParamDecl(
    unsigned int i) const

Declared at: clang/include/clang/AST/Decl.h:4325

Parameters

unsigned int i

clang::ParmVarDecl* getParamDecl(unsigned int i)

Declared at: clang/include/clang/AST/Decl.h:4329

Parameters

unsigned int i

clang::TypeSourceInfo* getSignatureAsWritten()
    const

Declared at: clang/include/clang/AST/Decl.h:4302

clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/Decl.h:4394

bool hasCaptures() const

Description

True if this block (or its nested blocks) captures anything of local storage from its enclosing scopes.

Declared at: clang/include/clang/AST/Decl.h:4338

bool isConversionFromLambda() const

Declared at: clang/include/clang/AST/Decl.h:4362

bool isVariadic() const

Declared at: clang/include/clang/AST/Decl.h:4294

clang::BlockDecl::param_const_iterator
param_begin() const

Declared at: clang/include/clang/AST/Decl.h:4319

clang::BlockDecl::param_iterator param_begin()

Declared at: clang/include/clang/AST/Decl.h:4317

bool param_empty() const

Declared at: clang/include/clang/AST/Decl.h:4316

clang::BlockDecl::param_const_iterator param_end()
    const

Declared at: clang/include/clang/AST/Decl.h:4320

clang::BlockDecl::param_iterator param_end()

Declared at: clang/include/clang/AST/Decl.h:4318

size_t param_size() const

Declared at: clang/include/clang/AST/Decl.h:4321

MutableArrayRef<clang::ParmVarDecl*> parameters()

Declared at: clang/include/clang/AST/Decl.h:4308

ArrayRef<clang::ParmVarDecl*> parameters() const

Declared at: clang/include/clang/AST/Decl.h:4305

void setBlockMangling(unsigned int Number,
                      clang::Decl* Ctx)

Declared at: clang/include/clang/AST/Decl.h:4389

Parameters

unsigned int Number
clang::Decl* Ctx

void setBlockMissingReturnType(bool val = true)

Declared at: clang/include/clang/AST/Decl.h:4358

Parameters

bool val = true

void setBody(clang::CompoundStmt* B)

Declared at: clang/include/clang/AST/Decl.h:4299

Parameters

clang::CompoundStmt* B

void setCanAvoidCopyToHeap(bool B = true)

Declared at: clang/include/clang/AST/Decl.h:4376

Parameters

bool B = true

void setCaptures(
    clang::ASTContext& Context,
    ArrayRef<clang::BlockDecl::Capture> Captures,
    bool CapturesCXXThis)

Declared at: clang/include/clang/AST/Decl.h:4382

Parameters

clang::ASTContext& Context
ArrayRef<clang::BlockDecl::Capture> Captures
bool CapturesCXXThis

void setCapturesCXXThis(bool B = true)

Declared at: clang/include/clang/AST/Decl.h:4352

Parameters

bool B = true

void setDoesNotEscape(bool B = true)

Declared at: clang/include/clang/AST/Decl.h:4371

Parameters

bool B = true

void setIsConversionFromLambda(bool val = true)

Declared at: clang/include/clang/AST/Decl.h:4366

Parameters

bool val = true

void setIsVariadic(bool value)

Declared at: clang/include/clang/AST/Decl.h:4295

Parameters

bool value

void setParams(
    ArrayRef<clang::ParmVarDecl*> NewParamInfo)

Declared at: clang/include/clang/AST/Decl.h:4334

Parameters

ArrayRef<clang::ParmVarDecl*> NewParamInfo

void setSignatureAsWritten(
    clang::TypeSourceInfo* Sig)

Declared at: clang/include/clang/AST/Decl.h:4301

Parameters

clang::TypeSourceInfo* Sig