class InitListExpr
Declaration
class InitListExpr : public Expr { /* full declaration omitted */ };
Description
Describes an C or C++ initializer list. InitListExpr describes an initializer list, which can be used to initialize objects of different types, including struct/class/union types, arrays, and vectors. For example: Prior to semantic analysis, an initializer list will represent the initializer list as written by the user, but will have the placeholder type "void". This initializer list is called the syntactic form of the initializer, and may contain C99 designated initializers (represented as DesignatedInitExprs), initializations of subobject members without explicit braces, and so on. Clients interested in the original syntax of the initializer list should use the syntactic form of the initializer list. After semantic analysis, the initializer list will represent the semantic form of the initializer, where the initializations of all subobjects are made explicit with nested InitListExpr nodes and C99 designators have been eliminated by placing the designated initializations into the subobject they initialize. Additionally, any "holes" in the initialization, where no initializer has been specified for a particular subobject, will be replaced with implicitly-generated ImplicitValueInitExpr expressions that value-initialize the subobjects. Note, however, that the initializer lists may still have fewer initializers than there are elements to initialize within the object. After semantic analysis has completed, given an initializer list, method isSemanticForm() returns true if and only if this is the semantic form of the initializer list (note: the same AST node may at the same time be the syntactic form). Given the semantic form of the initializer list, one can retrieve the syntactic form of that initializer list (when different) using method getSyntacticForm(); the method returns null if applied to a initializer list which is already in syntactic form. Similarly, given the syntactic form (i.e., an initializer list such that isSemanticForm() returns false), one can retrieve the semantic form using method getSemanticForm(). Since many initializer lists have the same syntactic and semantic forms, getSyntacticForm() may return NULL, indicating that the current semantic initializer list also serves as its syntactic form.
Declared at: clang/include/clang/AST/Expr.h:4791
Inherits from: Expr
Member Variables
- private clang::InitListExpr::InitExprsTy InitExprs
- private clang::SourceLocation LBraceLoc
- private clang::SourceLocation RBraceLoc
- private llvm::PointerIntPair<InitListExpr*, 1, bool> AltForm
- The alternative form of the initializer list (if it exists). The int part of the pair stores whether this initializer list is in semantic form. If not null, the pointer points to: - the syntactic form, if this is in semantic form; - the semantic form, if this is in syntactic form.
- private llvm::PointerUnion<Expr*, FieldDecl*> ArrayFillerOrUnionFieldInit
- Either: If this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements. Or If this initializer list initializes a union, specifies which field within the union will be initialized.
Inherited from Stmt:
Method Overview
- public InitListExpr(clang::Stmt::EmptyShell Empty)
- public InitListExpr(const clang::ASTContext & C, clang::SourceLocation lbraceloc, ArrayRef<clang::Expr *> initExprs, clang::SourceLocation rbraceloc)
- public clang::InitListExpr::iterator begin()
- public clang::InitListExpr::const_iterator begin() const
- public clang::Stmt::child_range children()
- public clang::Stmt::const_child_range children() const
- public static bool classof(const clang::Stmt * T)
- public clang::InitListExpr::const_iterator end() const
- public clang::InitListExpr::iterator end()
- public const clang::Expr * getArrayFiller() const
- public clang::Expr * getArrayFiller()
- public clang::SourceLocation getBeginLoc() const
- public clang::SourceLocation getEndLoc() const
- public const clang::Expr * getInit(unsigned int Init) const
- public clang::Expr * getInit(unsigned int Init)
- public const clang::FieldDecl * getInitializedFieldInUnion() const
- public clang::FieldDecl * getInitializedFieldInUnion()
- public clang::Expr ** getInits()
- public clang::Expr *const * getInits() const
- public clang::SourceLocation getLBraceLoc() const
- public unsigned int getNumInits() const
- public clang::SourceLocation getRBraceLoc() const
- public clang::InitListExpr * getSemanticForm() const
- public clang::InitListExpr * getSyntacticForm() const
- public bool hadArrayRangeDesignator() const
- public bool hasArrayFiller() const
- public ArrayRef<clang::Expr *> inits()
- public ArrayRef<clang::Expr *> inits() const
- public bool isExplicit() const
- public bool isIdiomaticZeroInitializer(const clang::LangOptions & LangOpts) const
- public bool isSemanticForm() const
- public bool isStringLiteralInit() const
- public bool isSyntacticForm() const
- public bool isTransparent() const
- public void markError()
- public clang::InitListExpr::const_reverse_iterator rbegin() const
- public clang::InitListExpr::reverse_iterator rbegin()
- public clang::InitListExpr::const_reverse_iterator rend() const
- public clang::InitListExpr::reverse_iterator rend()
- public void reserveInits(const clang::ASTContext & C, unsigned int NumInits)
- public void resizeInits(const clang::ASTContext & Context, unsigned int NumInits)
- public void sawArrayRangeDesignator(bool ARD = true)
- public void setArrayFiller(clang::Expr * filler)
- public void setInit(unsigned int Init, clang::Expr * expr)
- public void setInitializedFieldInUnion(clang::FieldDecl * FD)
- public void setLBraceLoc(clang::SourceLocation Loc)
- public void setRBraceLoc(clang::SourceLocation Loc)
- public void setSyntacticForm(clang::InitListExpr * Init)
- public clang::Expr * updateInit(const clang::ASTContext & C, unsigned int Init, clang::Expr * expr)
Inherited from Expr:
- public Classify
- public ClassifyLValue
- public ClassifyModifiable
- public EvaluateAsBooleanCondition
- public EvaluateAsConstantExpr
- public EvaluateAsFixedPoint
- public EvaluateAsFloat
- public EvaluateAsInitializer
- public EvaluateAsInt
- public EvaluateAsLValue
- public EvaluateAsRValue
- public EvaluateForOverflow
- public EvaluateKnownConstInt
- public EvaluateKnownConstIntCheckOverflow
- public EvaluateWithSubstitution
- public HasSideEffects
- public IgnoreCasts
- public IgnoreCasts
- public IgnoreConversionOperatorSingleStep
- public IgnoreConversionOperatorSingleStep
- public IgnoreImpCasts
- public IgnoreImpCasts
- public IgnoreImplicit
- public IgnoreImplicit
- public IgnoreImplicitAsWritten
- public IgnoreImplicitAsWritten
- public IgnoreParenBaseCasts
- public IgnoreParenBaseCasts
- public IgnoreParenCasts
- public IgnoreParenCasts
- public IgnoreParenImpCasts
- public IgnoreParenImpCasts
- public IgnoreParenLValueCasts
- public IgnoreParenLValueCasts
- public IgnoreParenNoopCasts
- public IgnoreParenNoopCasts
- public IgnoreParens
- public IgnoreParens
- public IgnoreUnlessSpelledInSource
- public IgnoreUnlessSpelledInSource
- public classof
- public containsErrors
- public containsUnexpandedParameterPack
- public findBoundMemberType
- public getAsBuiltinConstantDeclRef
- public getBestDynamicClassType
- public getBestDynamicClassTypeExpr
- public getDependence
- public getExprLoc
- public getFPFeaturesInEffect
- public getIntegerConstantExpr
- public getObjCProperty
- public getObjectKind
- public getReferencedDeclOfCallee
- public getReferencedDeclOfCallee
- public getSourceBitField
- public getSourceBitField
- public getType
- public getValueKind
- public getValueKindForType
- public hasAnyTypeDependentArguments
- public hasNonTrivialCall
- public hasPlaceholderType
- public hasPlaceholderType
- public isBoundMemberFunction
- public isCXX11ConstantExpr
- public isCXX98IntegralConstantExpr
- public isConstantInitializer
- public isDefaultArgument
- public isEvaluatable
- public isGLValue
- public isImplicitCXXThis
- public isInstantiationDependent
- public isIntegerConstantExpr
- public isKnownToHaveBooleanValue
- public isLValue
- public isModifiableLvalue
- public isNullPointerConstant
- public isOBJCGCCandidate
- public isObjCSelfExpr
- public isOrdinaryOrBitFieldObject
- public isPRValue
- public isPotentialConstantExpr
- public isPotentialConstantExprUnevaluated
- public isReadIfDiscardedInCPlusPlus11
- public isSameComparisonOperand
- public isTemporaryObject
- public isTypeDependent
- public isUnusedResultAWarning
- public isValueDependent
- public isXValue
- public refersToBitField
- public refersToGlobalRegisterVar
- public refersToMatrixElement
- public refersToVectorElement
- protected setDependence
- public setObjectKind
- public setType
- public setValueKind
- public skipRValueSubobjectAdjustments
- public skipRValueSubobjectAdjustments
- public tryEvaluateObjectSize
- public tryEvaluateStrLen
Inherited from ValueStmt:
Inherited from Stmt:
- public EnableStatistics
- public IgnoreContainers
- public IgnoreContainers
- public PrintStats
- public ProcessODRHash
- public Profile
- public addStmtClass
- public child_begin
- public child_begin
- public child_end
- public child_end
- public children
- public children
- public determineLikelihoodConflict
- public dump
- public dump
- public dumpColor
- public dumpPretty
- public getBeginLoc
- public getEndLoc
- public getID
- public getLikelihood
- public getLikelihood
- public getLikelihood
- public getLikelihoodAttr
- public getSourceRange
- public getStmtClass
- public getStmtClassName
- public printJson
- public printPretty
- public printPrettyControlled
- public stripLabelLikeStatements
- public stripLabelLikeStatements
- public viewAST
Methods
¶InitListExpr(clang::Stmt::EmptyShell Empty)
InitListExpr(clang::Stmt::EmptyShell Empty)
Description
Build an empty initializer list.
Declared at: clang/include/clang/AST/Expr.h:4818
Parameters
- clang::Stmt::EmptyShell Empty
¶InitListExpr(const clang::ASTContext& C,
clang::SourceLocation lbraceloc,
ArrayRef<clang::Expr*> initExprs,
clang::SourceLocation rbraceloc)
InitListExpr(const clang::ASTContext& C,
clang::SourceLocation lbraceloc,
ArrayRef<clang::Expr*> initExprs,
clang::SourceLocation rbraceloc)
Declared at: clang/include/clang/AST/Expr.h:4814
Parameters
- const clang::ASTContext& C
- clang::SourceLocation lbraceloc
- ArrayRef<clang::Expr*> initExprs
- clang::SourceLocation rbraceloc
¶clang::InitListExpr::iterator begin()
clang::InitListExpr::iterator begin()
Declared at: clang/include/clang/AST/Expr.h:4996
¶clang::InitListExpr::const_iterator begin() const
clang::InitListExpr::const_iterator begin() const
Declared at: clang/include/clang/AST/Expr.h:4997
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/Expr.h:4978
¶clang::Stmt::const_child_range children() const
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/Expr.h:4984
¶static bool classof(const clang::Stmt* T)
static bool classof(const clang::Stmt* T)
Declared at: clang/include/clang/AST/Expr.h:4973
Parameters
- const clang::Stmt* T
¶clang::InitListExpr::const_iterator end() const
clang::InitListExpr::const_iterator end() const
Declared at: clang/include/clang/AST/Expr.h:4999
¶clang::InitListExpr::iterator end()
clang::InitListExpr::iterator end()
Declared at: clang/include/clang/AST/Expr.h:4998
¶const clang::Expr* getArrayFiller() const
const clang::Expr* getArrayFiller() const
Declared at: clang/include/clang/AST/Expr.h:4890
¶clang::Expr* getArrayFiller()
clang::Expr* getArrayFiller()
Description
If this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements.
Declared at: clang/include/clang/AST/Expr.h:4887
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/Expr.h:4970
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/Expr.h:4971
¶const clang::Expr* getInit(
unsigned int Init) const
const clang::Expr* getInit(
unsigned int Init) const
Declared at: clang/include/clang/AST/Expr.h:4839
Parameters
- unsigned int Init
¶clang::Expr* getInit(unsigned int Init)
clang::Expr* getInit(unsigned int Init)
Declared at: clang/include/clang/AST/Expr.h:4844
Parameters
- unsigned int Init
¶const clang::FieldDecl*
getInitializedFieldInUnion() const
const clang::FieldDecl*
getInitializedFieldInUnion() const
Declared at: clang/include/clang/AST/Expr.h:4908
¶clang::FieldDecl* getInitializedFieldInUnion()
clang::FieldDecl* getInitializedFieldInUnion()
Description
If this initializes a union, specifies which field in the union to initialize. Typically, this field is the first named field within the union. However, a designated initializer can specify the initialization of a different field within the union.
Declared at: clang/include/clang/AST/Expr.h:4905
¶clang::Expr** getInits()
clang::Expr** getInits()
Description
Retrieve the set of initializers.
Declared at: clang/include/clang/AST/Expr.h:4824
¶clang::Expr* const* getInits() const
clang::Expr* const* getInits() const
Description
Retrieve the set of initializers.
Declared at: clang/include/clang/AST/Expr.h:4827
¶clang::SourceLocation getLBraceLoc() const
clang::SourceLocation getLBraceLoc() const
Declared at: clang/include/clang/AST/Expr.h:4940
¶unsigned int getNumInits() const
unsigned int getNumInits() const
Declared at: clang/include/clang/AST/Expr.h:4821
¶clang::SourceLocation getRBraceLoc() const
clang::SourceLocation getRBraceLoc() const
Declared at: clang/include/clang/AST/Expr.h:4942
¶clang::InitListExpr* getSemanticForm() const
clang::InitListExpr* getSemanticForm() const
Declared at: clang/include/clang/AST/Expr.h:4946
¶clang::InitListExpr* getSyntacticForm() const
clang::InitListExpr* getSyntacticForm() const
Declared at: clang/include/clang/AST/Expr.h:4952
¶bool hadArrayRangeDesignator() const
bool hadArrayRangeDesignator() const
Declared at: clang/include/clang/AST/Expr.h:4963
¶bool hasArrayFiller() const
bool hasArrayFiller() const
Description
Return true if this is an array initializer and its array "filler" has been set.
Declared at: clang/include/clang/AST/Expr.h:4897
¶ArrayRef<clang::Expr*> inits()
ArrayRef<clang::Expr*> inits()
Declared at: clang/include/clang/AST/Expr.h:4831
¶ArrayRef<clang::Expr*> inits() const
ArrayRef<clang::Expr*> inits() const
Declared at: clang/include/clang/AST/Expr.h:4835
¶bool isExplicit() const
bool isExplicit() const
Declared at: clang/include/clang/AST/Expr.h:4923
¶bool isIdiomaticZeroInitializer(
const clang::LangOptions& LangOpts) const
bool isIdiomaticZeroInitializer(
const clang::LangOptions& LangOpts) const
Description
Is this the zero initializer {0} in a language which considers it idiomatic?
Declared at: clang/include/clang/AST/Expr.h:4938
Parameters
- const clang::LangOptions& LangOpts
¶bool isSemanticForm() const
bool isSemanticForm() const
Declared at: clang/include/clang/AST/Expr.h:4945
¶bool isStringLiteralInit() const
bool isStringLiteralInit() const
Declared at: clang/include/clang/AST/Expr.h:4929
¶bool isSyntacticForm() const
bool isSyntacticForm() const
Declared at: clang/include/clang/AST/Expr.h:4949
¶bool isTransparent() const
bool isTransparent() const
Description
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic, and whose semantics are that of the sole contained initializer)?
Declared at: clang/include/clang/AST/Expr.h:4934
¶void markError()
void markError()
Description
Mark the semantic form of the InitListExpr as error when the semantic analysis fails.
Declared at: clang/include/clang/AST/Expr.h:4859
¶clang::InitListExpr::const_reverse_iterator
rbegin() const
clang::InitListExpr::const_reverse_iterator
rbegin() const
Declared at: clang/include/clang/AST/Expr.h:5001
¶clang::InitListExpr::reverse_iterator rbegin()
clang::InitListExpr::reverse_iterator rbegin()
Declared at: clang/include/clang/AST/Expr.h:5000
¶clang::InitListExpr::const_reverse_iterator rend()
const
clang::InitListExpr::const_reverse_iterator rend()
const
Declared at: clang/include/clang/AST/Expr.h:5003
¶clang::InitListExpr::reverse_iterator rend()
clang::InitListExpr::reverse_iterator rend()
Declared at: clang/include/clang/AST/Expr.h:5002
¶void reserveInits(const clang::ASTContext& C,
unsigned int NumInits)
void reserveInits(const clang::ASTContext& C,
unsigned int NumInits)
Description
Reserve space for some number of initializers.
Declared at: clang/include/clang/AST/Expr.h:4865
Parameters
- const clang::ASTContext& C
- unsigned int NumInits
¶void resizeInits(const clang::ASTContext& Context,
unsigned int NumInits)
void resizeInits(const clang::ASTContext& Context,
unsigned int NumInits)
Description
Specify the number of initializers If there are more than @p NumInits initializers, the remaining initializers will be destroyed. If there are fewer than @p NumInits initializers, NULL expressions will be added for the unknown initializers.
Declared at: clang/include/clang/AST/Expr.h:4873
Parameters
- const clang::ASTContext& Context
- unsigned int NumInits
¶void sawArrayRangeDesignator(bool ARD = true)
void sawArrayRangeDesignator(bool ARD = true)
Declared at: clang/include/clang/AST/Expr.h:4966
Parameters
- bool ARD = true
¶void setArrayFiller(clang::Expr* filler)
void setArrayFiller(clang::Expr* filler)
Declared at: clang/include/clang/AST/Expr.h:4893
Parameters
- clang::Expr* filler
¶void setInit(unsigned int Init, clang::Expr* expr)
void setInit(unsigned int Init, clang::Expr* expr)
Declared at: clang/include/clang/AST/Expr.h:4849
Parameters
- unsigned int Init
- clang::Expr* expr
¶void setInitializedFieldInUnion(
clang::FieldDecl* FD)
void setInitializedFieldInUnion(
clang::FieldDecl* FD)
Declared at: clang/include/clang/AST/Expr.h:4911
Parameters
- clang::FieldDecl* FD
¶void setLBraceLoc(clang::SourceLocation Loc)
void setLBraceLoc(clang::SourceLocation Loc)
Declared at: clang/include/clang/AST/Expr.h:4941
Parameters
¶void setRBraceLoc(clang::SourceLocation Loc)
void setRBraceLoc(clang::SourceLocation Loc)
Declared at: clang/include/clang/AST/Expr.h:4943
Parameters
¶void setSyntacticForm(clang::InitListExpr* Init)
void setSyntacticForm(clang::InitListExpr* Init)
Declared at: clang/include/clang/AST/Expr.h:4956
Parameters
- clang::InitListExpr* Init
¶clang::Expr* updateInit(
const clang::ASTContext& C,
unsigned int Init,
clang::Expr* expr)
clang::Expr* updateInit(
const clang::ASTContext& C,
unsigned int Init,
clang::Expr* expr)
Description
Updates the initializer at index @p Init with the new expression @p expr, and returns the old expression at that location. When @p Init is out of range for this initializer list, the initializer list will be extended with NULL expressions to accommodate the new entry.
Declared at: clang/include/clang/AST/Expr.h:4882
Parameters
- const clang::ASTContext& C
- unsigned int Init
- clang::Expr* expr