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
- protected BlockDecl(clang::DeclContext * DC, clang::SourceLocation CaretLoc)
- public static clang::BlockDecl * Create(clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation L)
- public static clang::BlockDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID)
- public bool blockMissingReturnType() const
- public bool canAvoidCopyToHeap() const
- public clang::BlockDecl::capture_const_iterator capture_begin() const
- public clang::BlockDecl::capture_const_iterator capture_end() const
- public ArrayRef<clang::BlockDecl::Capture> captures() const
- public bool capturesCXXThis() const
- public bool capturesVariable(const clang::VarDecl * var) const
- public static clang::BlockDecl * castFromDeclContext(const clang::DeclContext * DC)
- public static clang::DeclContext * castToDeclContext(const clang::BlockDecl * D)
- public static bool classof(const clang::Decl * D)
- public static bool classofKind(clang::Decl::Kind K)
- public bool doesNotEscape() const
- public clang::Decl * getBlockManglingContextDecl() const
- public unsigned int getBlockManglingNumber() const
- public clang::Stmt * getBody() const
- public clang::SourceLocation getCaretLocation() const
- public clang::CompoundStmt * getCompoundBody() const
- public unsigned int getNumCaptures() const
- public unsigned int getNumParams() const
- public const clang::ParmVarDecl * getParamDecl(unsigned int i) const
- public clang::ParmVarDecl * getParamDecl(unsigned int i)
- public clang::TypeSourceInfo * getSignatureAsWritten() const
- public clang::SourceRange getSourceRange() const
- public bool hasCaptures() const
- public bool isConversionFromLambda() const
- public bool isVariadic() const
- public clang::BlockDecl::param_const_iterator param_begin() const
- public clang::BlockDecl::param_iterator param_begin()
- public bool param_empty() const
- public clang::BlockDecl::param_const_iterator param_end() const
- public clang::BlockDecl::param_iterator param_end()
- public size_t param_size() const
- public MutableArrayRef<clang::ParmVarDecl *> parameters()
- public ArrayRef<clang::ParmVarDecl *> parameters() const
- public void setBlockMangling(unsigned int Number, clang::Decl * Ctx)
- public void setBlockMissingReturnType(bool val = true)
- public void setBody(clang::CompoundStmt * B)
- public void setCanAvoidCopyToHeap(bool B = true)
- public void setCaptures(clang::ASTContext & Context, ArrayRef<clang::BlockDecl::Capture> Captures, bool CapturesCXXThis)
- public void setCapturesCXXThis(bool B = true)
- public void setDoesNotEscape(bool B = true)
- public void setIsConversionFromLambda(bool val = true)
- public void setIsVariadic(bool value)
- public void setParams(ArrayRef<clang::ParmVarDecl *> NewParamInfo)
- public void setSignatureAsWritten(clang::TypeSourceInfo * Sig)
Inherited from DeclContext:
- protected BuildDeclChain
- public Encloses
- public Equals
- public InEnclosingNamespaceSetOf
- public addDecl
- public addDeclInternal
- public addHiddenDecl
- public buildLookup
- public classof
- public classof
- public collectAllContexts
- public containsDecl
- public containsDeclAndLoad
- public ddiags
- public decls
- public decls_begin
- public decls_empty
- public decls_end
- public dumpDeclContext
- public dumpLookups
- public dumpLookups
- public getDeclKind
- public getDeclKindName
- public getEnclosingNamespaceContext
- public getEnclosingNamespaceContext
- public getExternCContext
- public getInnermostBlockDecl
- public getLexicalParent
- public getLexicalParent
- public getLookupParent
- public getLookupParent
- public getLookupPtr
- public getNonClosureAncestor
- public getNonClosureAncestor
- public getNonTransparentContext
- public getNonTransparentContext
- public getOuterLexicalRecordContext
- public getOuterLexicalRecordContext
- public getParent
- public getParent
- public getParentASTContext
- public getPrimaryContext
- public getPrimaryContext
- public getRedeclContext
- public getRedeclContext
- public hasExternalLexicalStorage
- public hasExternalVisibleStorage
- public isClosure
- public isDeclInLexicalTraversal
- public isDependentContext
- public isExternCContext
- public isExternCXXContext
- public isFileContext
- public isFunctionOrMethod
- public isInlineNamespace
- public isLookupContext
- public isNamespace
- public isObjCContainer
- public isRecord
- public isStdNamespace
- public isTranslationUnit
- public isTransparentContext
- public localUncachedLookup
- public lookup
- public lookups
- public lookups_begin
- public lookups_end
- public makeDeclVisibleInContext
- public noload_decls
- public noload_decls_begin
- public noload_decls_end
- public noload_lookup
- public noload_lookups
- public noload_lookups_begin
- public noload_lookups_end
- public removeDecl
- public setHasExternalLexicalStorage
- public setHasExternalVisibleStorage
- public setMustBuildLookupTable
- public setUseQualifiedLookup
- public shouldUseQualifiedLookup
- public using_directives
Inherited from Decl:
- public EnableStatistics
- public PrintStats
- public add
- public addAttr
- public attr_begin
- public attr_end
- public attrs
- public canBeWeakImported
- public castFromDeclContext
- public castToDeclContext
- public classofKind
- public dropAttr
- public dropAttrs
- public dump
- public dump
- public dumpColor
- public getASTContext
- protected getASTMutationListener
- public getAccess
- public getAccessUnsafe
- public getAsFunction
- public getAsFunction
- public getAttr
- public getAttrs
- public getAttrs
- public getAvailability
- public getBeginLoc
- public getBody
- public getBodyRBrace
- protected getCachedLinkage
- public getCanonicalDecl
- public getCanonicalDecl
- public getDeclContext
- public getDeclContext
- public getDeclKindName
- public getDefiningAttr
- public getDescribedTemplate
- public getDescribedTemplateParams
- public getEndLoc
- public getExternalSourceSymbolAttr
- public getFriendObjectKind
- public getFunctionType
- public getGlobalID
- public getID
- public getIdentifierNamespace
- public getIdentifierNamespaceForKind
- public getImportedOwningModule
- public getKind
- public getLangOpts
- public getLexicalDeclContext
- public getLexicalDeclContext
- public getLocalOwningModule
- public getLocation
- public getMaxAlignment
- public getModuleOwnershipKind
- public getMostRecentDecl
- public getMostRecentDecl
- protected getMostRecentDeclImpl
- public getNextDeclInContext
- public getNextDeclInContext
- protected getNextRedeclarationImpl
- public getNonClosureContext
- public getNonClosureContext
- public getOwningModule
- public getOwningModuleForLinkage
- public getOwningModuleID
- public getParentFunctionOrMethod
- public getParentFunctionOrMethod
- public getPreviousDecl
- public getPreviousDecl
- protected getPreviousDeclImpl
- public getSourceRange
- public getTemplateDepth
- public getTranslationUnitDecl
- public getTranslationUnitDecl
- public getVersionIntroduced
- public hasAttr
- public hasAttrs
- public hasBody
- protected hasCachedLinkage
- public hasDefiningAttr
- protected hasLocalOwningModuleStorage
- public hasOwningModule
- public hasTagIdentifierNamespace
- public isCanonicalDecl
- public isDefinedOutsideFunctionOrMethod
- public isDeprecated
- public isDiscardedInGlobalModuleFragment
- public isFirstDecl
- public isFromASTFile
- public isFunctionOrFunctionTemplate
- public isImplicit
- public isInAnonymousNamespace
- public isInExportDeclContext
- public isInIdentifierNamespace
- public isInLocalScopeForInstantiation
- public isInStdNamespace
- public isInvalidDecl
- public isInvisibleOutsideTheOwningModule
- public isLocalExternDecl
- public isModulePrivate
- public isOutOfLine
- public isParameterPack
- public isReachable
- public isReferenced
- public isTagIdentifierNamespace
- public isTemplateDecl
- public isTemplateParameter
- public isTemplateParameterPack
- public isTemplated
- public isThisDeclarationReferenced
- public isTopLevelDeclInObjCContainer
- public isUnavailable
- public isUnconditionallyVisible
- public isUsed
- public isWeakImported
- public markUsed
- public print
- public print
- public printGroup
- public redecls
- public redecls_begin
- public redecls_end
- public setAccess
- public setAttrs
- protected setCachedLinkage
- public setDeclContext
- public setFromASTFile
- public setImplicit
- public setInvalidDecl
- public setIsUsed
- public setLexicalDeclContext
- public setLocalExternDecl
- public setLocalOwningModule
- public setLocation
- public setModuleOwnershipKind
- protected setModulePrivate
- public setNonMemberOperator
- public setObjectOfFriendDecl
- public setOwningModuleID
- public setReferenced
- public setTopLevelDeclInObjCContainer
- public setVisibleDespiteOwningModule
- public specific_attr_begin
- public specific_attr_end
- public specific_attrs
- protected updateOutOfDate
Methods
¶BlockDecl(clang::DeclContext* DC,
clang::SourceLocation CaretLoc)
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)
static clang::BlockDecl* Create(
clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation L)
Declared at: clang/include/clang/AST/Decl.h:4289
Parameters
¶static clang::BlockDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
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
bool blockMissingReturnType() const
Declared at: clang/include/clang/AST/Decl.h:4354
¶bool canAvoidCopyToHeap() const
bool canAvoidCopyToHeap() const
Declared at: clang/include/clang/AST/Decl.h:4373
¶clang::BlockDecl::capture_const_iterator
capture_begin() const
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
clang::BlockDecl::capture_const_iterator
capture_end() const
Declared at: clang/include/clang/AST/Decl.h:4349
¶ArrayRef<clang::BlockDecl::Capture> captures()
const
ArrayRef<clang::BlockDecl::Capture> captures()
const
Declared at: clang/include/clang/AST/Decl.h:4346
¶bool capturesCXXThis() const
bool capturesCXXThis() const
Declared at: clang/include/clang/AST/Decl.h:4351
¶bool capturesVariable(
const clang::VarDecl* var) const
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)
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)
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)
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)
static bool classofKind(clang::Decl::Kind K)
Declared at: clang/include/clang/AST/Decl.h:4398
Parameters
- clang::Decl::Kind K
¶bool doesNotEscape() const
bool doesNotEscape() const
Declared at: clang/include/clang/AST/Decl.h:4370
¶clang::Decl* getBlockManglingContextDecl() const
clang::Decl* getBlockManglingContextDecl() const
Declared at: clang/include/clang/AST/Decl.h:4387
¶unsigned int getBlockManglingNumber() const
unsigned int getBlockManglingNumber() const
Declared at: clang/include/clang/AST/Decl.h:4385
¶clang::Stmt* getBody() const
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
clang::SourceLocation getCaretLocation() const
Declared at: clang/include/clang/AST/Decl.h:4292
¶clang::CompoundStmt* getCompoundBody() const
clang::CompoundStmt* getCompoundBody() const
Declared at: clang/include/clang/AST/Decl.h:4297
¶unsigned int getNumCaptures() const
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
unsigned int getNumParams() const
Declared at: clang/include/clang/AST/Decl.h:4323
¶const clang::ParmVarDecl* getParamDecl(
unsigned int i) const
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)
clang::ParmVarDecl* getParamDecl(unsigned int i)
Declared at: clang/include/clang/AST/Decl.h:4329
Parameters
- unsigned int i
¶clang::TypeSourceInfo* getSignatureAsWritten()
const
clang::TypeSourceInfo* getSignatureAsWritten()
const
Declared at: clang/include/clang/AST/Decl.h:4302
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Description
Source range that this declaration covers.
Declared at: clang/include/clang/AST/Decl.h:4394
¶bool hasCaptures() const
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
bool isConversionFromLambda() const
Declared at: clang/include/clang/AST/Decl.h:4362
¶bool isVariadic() const
bool isVariadic() const
Declared at: clang/include/clang/AST/Decl.h:4294
¶clang::BlockDecl::param_const_iterator
param_begin() const
clang::BlockDecl::param_const_iterator
param_begin() const
Declared at: clang/include/clang/AST/Decl.h:4319
¶clang::BlockDecl::param_iterator param_begin()
clang::BlockDecl::param_iterator param_begin()
Declared at: clang/include/clang/AST/Decl.h:4317
¶bool param_empty() const
bool param_empty() const
Declared at: clang/include/clang/AST/Decl.h:4316
¶clang::BlockDecl::param_const_iterator param_end()
const
clang::BlockDecl::param_const_iterator param_end()
const
Declared at: clang/include/clang/AST/Decl.h:4320
¶clang::BlockDecl::param_iterator param_end()
clang::BlockDecl::param_iterator param_end()
Declared at: clang/include/clang/AST/Decl.h:4318
¶size_t param_size() const
size_t param_size() const
Declared at: clang/include/clang/AST/Decl.h:4321
¶MutableArrayRef<clang::ParmVarDecl*> parameters()
MutableArrayRef<clang::ParmVarDecl*> parameters()
Declared at: clang/include/clang/AST/Decl.h:4308
¶ArrayRef<clang::ParmVarDecl*> parameters() const
ArrayRef<clang::ParmVarDecl*> parameters() const
Declared at: clang/include/clang/AST/Decl.h:4305
¶void setBlockMangling(unsigned int Number,
clang::Decl* Ctx)
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)
void setBlockMissingReturnType(bool val = true)
Declared at: clang/include/clang/AST/Decl.h:4358
Parameters
- bool val = true
¶void setBody(clang::CompoundStmt* B)
void setBody(clang::CompoundStmt* B)
Declared at: clang/include/clang/AST/Decl.h:4299
Parameters
¶void setCanAvoidCopyToHeap(bool B = true)
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)
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)
void setCapturesCXXThis(bool B = true)
Declared at: clang/include/clang/AST/Decl.h:4352
Parameters
- bool B = true
¶void setDoesNotEscape(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)
void setIsConversionFromLambda(bool val = true)
Declared at: clang/include/clang/AST/Decl.h:4366
Parameters
- bool val = true
¶void setIsVariadic(bool value)
void setIsVariadic(bool value)
Declared at: clang/include/clang/AST/Decl.h:4295
Parameters
- bool value
¶void setParams(
ArrayRef<clang::ParmVarDecl*> NewParamInfo)
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)
void setSignatureAsWritten(
clang::TypeSourceInfo* Sig)
Declared at: clang/include/clang/AST/Decl.h:4301