class GenericSelectionExpr
Declaration
class GenericSelectionExpr : public Expr, private TrailingObjects { /* full declaration omitted */ };
Description
Represents a C11 generic selection. A generic selection (C11 6.5.1.1) contains an unevaluated controlling expression, followed by one or more generic associations. Each generic association specifies a type name and an expression, or "default" and an expression (in which case it is known as a default generic association). The type and value of the generic selection are identical to those of its result expression, which is defined as the expression in the generic association with a type name that is compatible with the type of the controlling expression, or the expression in the default generic association if no types are compatible. For example: The above expression evaluates to 1 if 1.0 is substituted for X, 2 if 1.0f or 3 if "hello". As an extension, generic selections are allowed in C++, where the following additional semantics apply: Any generic selection whose controlling expression is type-dependent or which names a dependent type in its association list is result-dependent, which means that the choice of result expression is dependent. Result-dependent generic associations are both type- and value-dependent.
Declared at: clang/include/clang/AST/Expr.h:5628
Inherits from: Expr, TrailingObjects
Member Variables
- private unsigned int NumAssocs
- The number of association expressions and the index of the result expression in the case where the generic selection expression is not result-dependent. The result index is equal to ResultDependentIndex if and only if the generic selection expression is result-dependent.
- private unsigned int ResultIndex
- The number of association expressions and the index of the result expression in the case where the generic selection expression is not result-dependent. The result index is equal to ResultDependentIndex if and only if the generic selection expression is result-dependent.
- private clang::SourceLocation DefaultLoc
- The location of the "default" and of the right parenthesis.
- private clang::SourceLocation RParenLoc
- The location of the "default" and of the right parenthesis.
Inherited from Stmt:
Method Overview
- public static clang::GenericSelectionExpr * Create(const clang::ASTContext & Context, clang::SourceLocation GenericLoc, clang::Expr * ControllingExpr, ArrayRef<clang::TypeSourceInfo *> AssocTypes, ArrayRef<clang::Expr *> AssocExprs, clang::SourceLocation DefaultLoc, clang::SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned int ResultIndex)
- public static clang::GenericSelectionExpr * Create(const clang::ASTContext & Context, clang::SourceLocation GenericLoc, clang::Expr * ControllingExpr, ArrayRef<clang::TypeSourceInfo *> AssocTypes, ArrayRef<clang::Expr *> AssocExprs, clang::SourceLocation DefaultLoc, clang::SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack)
- public static clang::GenericSelectionExpr * CreateEmpty(const clang::ASTContext & Context, unsigned int NumAssocs)
- private GenericSelectionExpr(const clang::ASTContext & Context, clang::SourceLocation GenericLoc, clang::Expr * ControllingExpr, ArrayRef<clang::TypeSourceInfo *> AssocTypes, ArrayRef<clang::Expr *> AssocExprs, clang::SourceLocation DefaultLoc, clang::SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned int ResultIndex)
- private GenericSelectionExpr(const clang::ASTContext & Context, clang::SourceLocation GenericLoc, clang::Expr * ControllingExpr, ArrayRef<clang::TypeSourceInfo *> AssocTypes, ArrayRef<clang::Expr *> AssocExprs, clang::SourceLocation DefaultLoc, clang::SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack)
- private GenericSelectionExpr(clang::Stmt::EmptyShell Empty, unsigned int NumAssocs)
- public clang::GenericSelectionExpr::association_range associations()
- public clang::GenericSelectionExpr::const_association_range associations() const
- public clang::Stmt::const_child_range children() const
- public clang::Stmt::child_range children()
- public static bool classof(const clang::Stmt * T)
- public ArrayRef<clang::Expr *> getAssocExprs() const
- public ArrayRef<clang::TypeSourceInfo *> getAssocTypeSourceInfos() const
- public clang::GenericSelectionExpr::ConstAssociation getAssociation(unsigned int I) const
- public clang::GenericSelectionExpr::Association getAssociation(unsigned int I)
- public clang::SourceLocation getBeginLoc() const
- public const clang::Expr * getControllingExpr() const
- public clang::Expr * getControllingExpr()
- public clang::SourceLocation getDefaultLoc() const
- public clang::SourceLocation getEndLoc() const
- public clang::SourceLocation getGenericLoc() const
- public unsigned int getNumAssocs() const
- public clang::SourceLocation getRParenLoc() const
- public const clang::Expr * getResultExpr() const
- public clang::Expr * getResultExpr()
- public unsigned int getResultIndex() const
- public bool isResultDependent() const
- private unsigned int numTrailingObjects(OverloadToken<clang::Stmt *>) const
- private unsigned int numTrailingObjects(OverloadToken<clang::TypeSourceInfo *>) const
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
¶static clang::GenericSelectionExpr* Create(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack,
unsigned int ResultIndex)
static clang::GenericSelectionExpr* Create(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack,
unsigned int ResultIndex)
Description
Create a non-result-dependent generic selection expression.
Declared at: clang/include/clang/AST/Expr.h:5768
Parameters
- const clang::ASTContext& Context
- clang::SourceLocation GenericLoc
- clang::Expr* ControllingExpr
- ArrayRef<clang::TypeSourceInfo*> AssocTypes
- ArrayRef<clang::Expr*> AssocExprs
- clang::SourceLocation DefaultLoc
- clang::SourceLocation RParenLoc
- bool ContainsUnexpandedParameterPack
- unsigned int ResultIndex
¶static clang::GenericSelectionExpr* Create(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack)
static clang::GenericSelectionExpr* Create(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack)
Description
Create a result-dependent generic selection expression.
Declared at: clang/include/clang/AST/Expr.h:5776
Parameters
- const clang::ASTContext& Context
- clang::SourceLocation GenericLoc
- clang::Expr* ControllingExpr
- ArrayRef<clang::TypeSourceInfo*> AssocTypes
- ArrayRef<clang::Expr*> AssocExprs
- clang::SourceLocation DefaultLoc
- clang::SourceLocation RParenLoc
- bool ContainsUnexpandedParameterPack
¶static clang::GenericSelectionExpr* CreateEmpty(
const clang::ASTContext& Context,
unsigned int NumAssocs)
static clang::GenericSelectionExpr* CreateEmpty(
const clang::ASTContext& Context,
unsigned int NumAssocs)
Description
Create an empty generic selection expression for deserialization.
Declared at: clang/include/clang/AST/Expr.h:5782
Parameters
- const clang::ASTContext& Context
- unsigned int NumAssocs
¶GenericSelectionExpr(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack,
unsigned int ResultIndex)
GenericSelectionExpr(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack,
unsigned int ResultIndex)
Description
Build a non-result-dependent generic selection expression.
Declared at: clang/include/clang/AST/Expr.h:5746
Parameters
- const clang::ASTContext& Context
- clang::SourceLocation GenericLoc
- clang::Expr* ControllingExpr
- ArrayRef<clang::TypeSourceInfo*> AssocTypes
- ArrayRef<clang::Expr*> AssocExprs
- clang::SourceLocation DefaultLoc
- clang::SourceLocation RParenLoc
- bool ContainsUnexpandedParameterPack
- unsigned int ResultIndex
¶GenericSelectionExpr(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack)
GenericSelectionExpr(
const clang::ASTContext& Context,
clang::SourceLocation GenericLoc,
clang::Expr* ControllingExpr,
ArrayRef<clang::TypeSourceInfo*> AssocTypes,
ArrayRef<clang::Expr*> AssocExprs,
clang::SourceLocation DefaultLoc,
clang::SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack)
Description
Build a result-dependent generic selection expression.
Declared at: clang/include/clang/AST/Expr.h:5755
Parameters
- const clang::ASTContext& Context
- clang::SourceLocation GenericLoc
- clang::Expr* ControllingExpr
- ArrayRef<clang::TypeSourceInfo*> AssocTypes
- ArrayRef<clang::Expr*> AssocExprs
- clang::SourceLocation DefaultLoc
- clang::SourceLocation RParenLoc
- bool ContainsUnexpandedParameterPack
¶GenericSelectionExpr(
clang::Stmt::EmptyShell Empty,
unsigned int NumAssocs)
GenericSelectionExpr(
clang::Stmt::EmptyShell Empty,
unsigned int NumAssocs)
Description
Build an empty generic selection expression for deserialization.
Declared at: clang/include/clang/AST/Expr.h:5763
Parameters
- clang::Stmt::EmptyShell Empty
- unsigned int NumAssocs
¶clang::GenericSelectionExpr::association_range
associations()
clang::GenericSelectionExpr::association_range
associations()
Declared at: clang/include/clang/AST/Expr.h:5855
¶clang::GenericSelectionExpr::
const_association_range
associations() const
clang::GenericSelectionExpr::
const_association_range
associations() const
Declared at: clang/include/clang/AST/Expr.h:5865
¶clang::Stmt::const_child_range children() const
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/Expr.h:5892
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/Expr.h:5887
¶static bool classof(const clang::Stmt* T)
static bool classof(const clang::Stmt* T)
Declared at: clang/include/clang/AST/Expr.h:5883
Parameters
- const clang::Stmt* T
¶ArrayRef<clang::Expr*> getAssocExprs() const
ArrayRef<clang::Expr*> getAssocExprs() const
Declared at: clang/include/clang/AST/Expr.h:5827
¶ArrayRef<clang::TypeSourceInfo*>
getAssocTypeSourceInfos() const
ArrayRef<clang::TypeSourceInfo*>
getAssocTypeSourceInfos() const
Declared at: clang/include/clang/AST/Expr.h:5832
¶clang::GenericSelectionExpr::ConstAssociation
getAssociation(unsigned int I) const
clang::GenericSelectionExpr::ConstAssociation
getAssociation(unsigned int I) const
Declared at: clang/include/clang/AST/Expr.h:5846
Parameters
- unsigned int I
¶clang::GenericSelectionExpr::Association
getAssociation(unsigned int I)
clang::GenericSelectionExpr::Association
getAssociation(unsigned int I)
Description
Return the Ith association expression with its TypeSourceInfo, bundled together in GenericSelectionExpr::(Const)Association.
Declared at: clang/include/clang/AST/Expr.h:5838
Parameters
- unsigned int I
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/Expr.h:5880
¶const clang::Expr* getControllingExpr() const
const clang::Expr* getControllingExpr() const
Declared at: clang/include/clang/AST/Expr.h:5812
¶clang::Expr* getControllingExpr()
clang::Expr* getControllingExpr()
Description
Return the controlling expression of this generic selection expression.
Declared at: clang/include/clang/AST/Expr.h:5809
¶clang::SourceLocation getDefaultLoc() const
clang::SourceLocation getDefaultLoc() const
Declared at: clang/include/clang/AST/Expr.h:5878
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/Expr.h:5881
¶clang::SourceLocation getGenericLoc() const
clang::SourceLocation getGenericLoc() const
Declared at: clang/include/clang/AST/Expr.h:5875
¶unsigned int getNumAssocs() const
unsigned int getNumAssocs() const
Description
The number of association expressions.
Declared at: clang/include/clang/AST/Expr.h:5794
¶clang::SourceLocation getRParenLoc() const
clang::SourceLocation getRParenLoc() const
Declared at: clang/include/clang/AST/Expr.h:5879
¶const clang::Expr* getResultExpr() const
const clang::Expr* getResultExpr() const
Declared at: clang/include/clang/AST/Expr.h:5822
¶clang::Expr* getResultExpr()
clang::Expr* getResultExpr()
Description
Return the result expression of this controlling expression. Defined if and only if the generic selection expression is not result-dependent.
Declared at: clang/include/clang/AST/Expr.h:5818
¶unsigned int getResultIndex() const
unsigned int getResultIndex() const
Description
The zero-based index of the result expression's generic association in the generic selection's association list. Defined only if the generic selection is not result-dependent.
Declared at: clang/include/clang/AST/Expr.h:5799
¶bool isResultDependent() const
bool isResultDependent() const
Description
Whether this generic selection is result-dependent.
Declared at: clang/include/clang/AST/Expr.h:5806
¶unsigned int numTrailingObjects(
OverloadToken<clang::Stmt*>) const
unsigned int numTrailingObjects(
OverloadToken<clang::Stmt*>) const
Declared at: clang/include/clang/AST/Expr.h:5657
Parameters
- OverloadToken<clang::Stmt*>
¶unsigned int numTrailingObjects(
OverloadToken<clang::TypeSourceInfo*>) const
unsigned int numTrailingObjects(
OverloadToken<clang::TypeSourceInfo*>) const
Declared at: clang/include/clang/AST/Expr.h:5663
Parameters
- OverloadToken<clang::TypeSourceInfo*>