class MaterializeTemporaryExpr
Declaration
class MaterializeTemporaryExpr : public Expr { /* full declaration omitted */ };
Description
Represents a prvalue temporary that is written into memory so that a reference can bind to it. Prvalue expressions are materialized when they need to have an address in memory for a reference to bind to. This happens when binding a reference to the result of a conversion, e.g., Here, 1.0 is implicitly converted to an \c int. That resulting \c int is then materialized via a \c MaterializeTemporaryExpr, and the reference binds to the temporary. \c MaterializeTemporaryExprs are always glvalues (either an lvalue or an xvalue, depending on the kind of reference binding to it), maintaining the invariant that references always bind to glvalues. Reference binding and copy-elision can both extend the lifetime of a temporary. When either happens, the expression will also track the declaration which is responsible for the lifetime extension.
Declared at: clang/include/clang/AST/ExprCXX.h:4479
Inherits from: Expr
Member Variables
- private llvm::PointerUnion<Stmt*, LifetimeExtendedTemporaryDecl*> State
Inherited from Stmt:
Method Overview
- public MaterializeTemporaryExpr(clang::Stmt::EmptyShell Empty)
- public MaterializeTemporaryExpr(clang::QualType T, clang::Expr * Temporary, bool BoundToLvalueReference, clang::LifetimeExtendedTemporaryDecl * MTD = nullptr)
- public clang::Stmt::const_child_range children() const
- public clang::Stmt::child_range children()
- public static bool classof(const clang::Stmt * T)
- public clang::SourceLocation getBeginLoc() const
- public clang::SourceLocation getEndLoc() const
- public clang::ValueDecl * getExtendingDecl()
- public const clang::ValueDecl * getExtendingDecl() const
- public clang::LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
- public const clang::LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl() const
- public unsigned int getManglingNumber() const
- public clang::APValue * getOrCreateValue(bool MayCreate) const
- public clang::StorageDuration getStorageDuration() const
- public clang::Expr * getSubExpr() const
- public bool isBoundToLvalueReference() const
- public bool isUsableInConstantExpressions(const clang::ASTContext & Context) const
- public void setExtendingDecl(clang::ValueDecl * ExtendedBy, unsigned int ManglingNumber)
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
¶MaterializeTemporaryExpr(
clang::Stmt::EmptyShell Empty)
MaterializeTemporaryExpr(
clang::Stmt::EmptyShell Empty)
Declared at: clang/include/clang/AST/ExprCXX.h:4491
Parameters
- clang::Stmt::EmptyShell Empty
¶MaterializeTemporaryExpr(
clang::QualType T,
clang::Expr* Temporary,
bool BoundToLvalueReference,
clang::LifetimeExtendedTemporaryDecl* MTD =
nullptr)
MaterializeTemporaryExpr(
clang::QualType T,
clang::Expr* Temporary,
bool BoundToLvalueReference,
clang::LifetimeExtendedTemporaryDecl* MTD =
nullptr)
Declared at: clang/include/clang/AST/ExprCXX.h:4487
Parameters
- clang::QualType T
- clang::Expr* Temporary
- bool BoundToLvalueReference
- clang::LifetimeExtendedTemporaryDecl* MTD = nullptr
¶clang::Stmt::const_child_range children() const
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/ExprCXX.h:4573
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/ExprCXX.h:4567
¶static bool classof(const clang::Stmt* T)
static bool classof(const clang::Stmt* T)
Declared at: clang/include/clang/AST/ExprCXX.h:4562
Parameters
- const clang::Stmt* T
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/ExprCXX.h:4554
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/ExprCXX.h:4558
¶clang::ValueDecl* getExtendingDecl()
clang::ValueDecl* getExtendingDecl()
Description
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Declared at: clang/include/clang/AST/ExprCXX.h:4529
¶const clang::ValueDecl* getExtendingDecl() const
const clang::ValueDecl* getExtendingDecl() const
Declared at: clang/include/clang/AST/ExprCXX.h:4534
¶clang::LifetimeExtendedTemporaryDecl*
getLifetimeExtendedTemporaryDecl()
clang::LifetimeExtendedTemporaryDecl*
getLifetimeExtendedTemporaryDecl()
Declared at: clang/include/clang/AST/ExprCXX.h:4519
¶const clang::LifetimeExtendedTemporaryDecl*
getLifetimeExtendedTemporaryDecl() const
const clang::LifetimeExtendedTemporaryDecl*
getLifetimeExtendedTemporaryDecl() const
Declared at: clang/include/clang/AST/ExprCXX.h:4523
¶unsigned int getManglingNumber() const
unsigned int getManglingNumber() const
Declared at: clang/include/clang/AST/ExprCXX.h:4540
¶clang::APValue* getOrCreateValue(
bool MayCreate) const
clang::APValue* getOrCreateValue(
bool MayCreate) const
Description
Get the storage for the constant value of a materialized temporary of static storage duration.
Declared at: clang/include/clang/AST/ExprCXX.h:4512
Parameters
- bool MayCreate
¶clang::StorageDuration getStorageDuration() const
clang::StorageDuration getStorageDuration() const
Description
Retrieve the storage duration for the materialized temporary.
Declared at: clang/include/clang/AST/ExprCXX.h:4504
¶clang::Expr* getSubExpr() const
clang::Expr* getSubExpr() const
Description
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
Declared at: clang/include/clang/AST/ExprCXX.h:4496
¶bool isBoundToLvalueReference() const
bool isBoundToLvalueReference() const
Description
Determine whether this materialized temporary is bound to an lvalue reference; otherwise, it's bound to an rvalue reference.
Declared at: clang/include/clang/AST/ExprCXX.h:4548
¶bool isUsableInConstantExpressions(
const clang::ASTContext& Context) const
bool isUsableInConstantExpressions(
const clang::ASTContext& Context) const
Description
Determine whether this temporary object is usable in constant expressions, as specified in C++20 [expr.const]p4.
Declared at: clang/include/clang/AST/ExprCXX.h:4552
Parameters
- const clang::ASTContext& Context
¶void setExtendingDecl(
clang::ValueDecl* ExtendedBy,
unsigned int ManglingNumber)
void setExtendingDecl(
clang::ValueDecl* ExtendedBy,
unsigned int ManglingNumber)
Declared at: clang/include/clang/AST/ExprCXX.h:4538
Parameters
- clang::ValueDecl* ExtendedBy
- unsigned int ManglingNumber