class CXXNewExpr
Declaration
class CXXNewExpr : public Expr, private TrailingObjects { /* full declaration omitted */ };
Description
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Declared at: clang/include/clang/AST/ExprCXX.h:2139
Inherits from: Expr, TrailingObjects
Member Variables
- private clang::FunctionDecl* OperatorNew
- Points to the allocation function used.
- private clang::FunctionDecl* OperatorDelete
- Points to the deallocation function used in case of error. May be null.
- private clang::TypeSourceInfo* AllocatedTypeInfo
- The allocated type-source information, as written in the source.
- private clang::SourceRange Range
- Range of the entire new expression.
- private clang::SourceRange DirectInitRange
- Source-range of a paren-delimited initializer.
Inherited from Stmt:
Method Overview
- private CXXNewExpr(clang::Stmt::EmptyShell Empty, bool IsArray, unsigned int NumPlacementArgs, bool IsParenTypeId)
- private CXXNewExpr(bool IsGlobalNew, clang::FunctionDecl * OperatorNew, clang::FunctionDecl * OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef<clang::Expr *> PlacementArgs, clang::SourceRange TypeIdParens, Optional<clang::Expr *> ArraySize, clang::CXXNewExpr::InitializationStyle InitializationStyle, clang::Expr * Initializer, clang::QualType Ty, clang::TypeSourceInfo * AllocatedTypeInfo, clang::SourceRange Range, clang::SourceRange DirectInitRange)
- public static clang::CXXNewExpr * Create(const clang::ASTContext & Ctx, bool IsGlobalNew, clang::FunctionDecl * OperatorNew, clang::FunctionDecl * OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef<clang::Expr *> PlacementArgs, clang::SourceRange TypeIdParens, Optional<clang::Expr *> ArraySize, clang::CXXNewExpr::InitializationStyle InitializationStyle, clang::Expr * Initializer, clang::QualType Ty, clang::TypeSourceInfo * AllocatedTypeInfo, clang::SourceRange Range, clang::SourceRange DirectInitRange)
- public static clang::CXXNewExpr * CreateEmpty(const clang::ASTContext & Ctx, bool IsArray, bool HasInit, unsigned int NumPlacementArgs, bool IsParenTypeId)
- private unsigned int arraySizeOffset() const
- public clang::Stmt::child_range children()
- public clang::Stmt::const_child_range children() const
- public static bool classof(const clang::Stmt * T)
- public bool doesUsualArrayDeleteWantSize() const
- public clang::QualType getAllocatedType() const
- public clang::TypeSourceInfo * getAllocatedTypeSourceInfo() const
- public Optional<const clang::Expr *> getArraySize() const
- public Optional<clang::Expr *> getArraySize()
- public clang::SourceLocation getBeginLoc() const
- public const clang::CXXConstructExpr * getConstructExpr() const
- public clang::SourceRange getDirectInitRange() const
- public clang::SourceLocation getEndLoc() const
- public clang::CXXNewExpr::InitializationStyle getInitializationStyle() const
- public clang::Expr * getInitializer()
- public const clang::Expr * getInitializer() const
- public unsigned int getNumPlacementArgs() const
- public clang::FunctionDecl * getOperatorDelete() const
- public clang::FunctionDecl * getOperatorNew() const
- public clang::Expr * getPlacementArg(unsigned int I)
- public const clang::Expr * getPlacementArg(unsigned int I) const
- public clang::Expr ** getPlacementArgs()
- public clang::SourceRange getSourceRange() const
- public clang::SourceRange getTypeIdParens() const
- public bool hasInitializer() const
- private unsigned int initExprOffset() const
- public bool isArray() const
- public bool isGlobalNew() const
- public bool isParenTypeId() const
- private unsigned int numTrailingObjects(OverloadToken<clang::Stmt *>) const
- private unsigned int numTrailingObjects(OverloadToken<clang::SourceRange>) const
- public bool passAlignment() const
- private unsigned int placementNewArgsOffset() const
- public clang::CXXNewExpr::const_arg_iterator placement_arg_begin() const
- public clang::CXXNewExpr::arg_iterator placement_arg_begin()
- public clang::CXXNewExpr::const_arg_iterator placement_arg_end() const
- public clang::CXXNewExpr::arg_iterator placement_arg_end()
- public llvm::iterator_range<const_arg_iterator> placement_arguments() const
- public llvm::iterator_range<arg_iterator> placement_arguments()
- public clang::CXXNewExpr::raw_arg_iterator raw_arg_begin()
- public clang::CXXNewExpr::const_arg_iterator raw_arg_begin() const
- public clang::CXXNewExpr::raw_arg_iterator raw_arg_end()
- public clang::CXXNewExpr::const_arg_iterator raw_arg_end() const
- public void setOperatorDelete(clang::FunctionDecl * D)
- public void setOperatorNew(clang::FunctionDecl * D)
- public bool shouldNullCheckAllocation() 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
¶CXXNewExpr(clang::Stmt::EmptyShell Empty,
bool IsArray,
unsigned int NumPlacementArgs,
bool IsParenTypeId)
CXXNewExpr(clang::Stmt::EmptyShell Empty,
bool IsArray,
unsigned int NumPlacementArgs,
bool IsParenTypeId)
Description
Build an empty c++ new expression.
Declared at: clang/include/clang/AST/ExprCXX.h:2213
Parameters
- clang::Stmt::EmptyShell Empty
- bool IsArray
- unsigned int NumPlacementArgs
- bool IsParenTypeId
¶CXXNewExpr(
bool IsGlobalNew,
clang::FunctionDecl* OperatorNew,
clang::FunctionDecl* OperatorDelete,
bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
ArrayRef<clang::Expr*> PlacementArgs,
clang::SourceRange TypeIdParens,
Optional<clang::Expr*> ArraySize,
clang::CXXNewExpr::InitializationStyle
InitializationStyle,
clang::Expr* Initializer,
clang::QualType Ty,
clang::TypeSourceInfo* AllocatedTypeInfo,
clang::SourceRange Range,
clang::SourceRange DirectInitRange)
CXXNewExpr(
bool IsGlobalNew,
clang::FunctionDecl* OperatorNew,
clang::FunctionDecl* OperatorDelete,
bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
ArrayRef<clang::Expr*> PlacementArgs,
clang::SourceRange TypeIdParens,
Optional<clang::Expr*> ArraySize,
clang::CXXNewExpr::InitializationStyle
InitializationStyle,
clang::Expr* Initializer,
clang::QualType Ty,
clang::TypeSourceInfo* AllocatedTypeInfo,
clang::SourceRange Range,
clang::SourceRange DirectInitRange)
Description
Build a c++ new expression.
Declared at: clang/include/clang/AST/ExprCXX.h:2204
Parameters
- bool IsGlobalNew
- clang::FunctionDecl* OperatorNew
- clang::FunctionDecl* OperatorDelete
- bool ShouldPassAlignment
- bool UsualArrayDeleteWantsSize
- ArrayRef<clang::Expr*> PlacementArgs
- clang::SourceRange TypeIdParens
- Optional<clang::Expr*> ArraySize
- clang::CXXNewExpr::InitializationStyle InitializationStyle
- clang::Expr* Initializer
- clang::QualType Ty
- clang::TypeSourceInfo* AllocatedTypeInfo
- clang::SourceRange Range
- clang::SourceRange DirectInitRange
¶static clang::CXXNewExpr* Create(
const clang::ASTContext& Ctx,
bool IsGlobalNew,
clang::FunctionDecl* OperatorNew,
clang::FunctionDecl* OperatorDelete,
bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
ArrayRef<clang::Expr*> PlacementArgs,
clang::SourceRange TypeIdParens,
Optional<clang::Expr*> ArraySize,
clang::CXXNewExpr::InitializationStyle
InitializationStyle,
clang::Expr* Initializer,
clang::QualType Ty,
clang::TypeSourceInfo* AllocatedTypeInfo,
clang::SourceRange Range,
clang::SourceRange DirectInitRange)
static clang::CXXNewExpr* Create(
const clang::ASTContext& Ctx,
bool IsGlobalNew,
clang::FunctionDecl* OperatorNew,
clang::FunctionDecl* OperatorDelete,
bool ShouldPassAlignment,
bool UsualArrayDeleteWantsSize,
ArrayRef<clang::Expr*> PlacementArgs,
clang::SourceRange TypeIdParens,
Optional<clang::Expr*> ArraySize,
clang::CXXNewExpr::InitializationStyle
InitializationStyle,
clang::Expr* Initializer,
clang::QualType Ty,
clang::TypeSourceInfo* AllocatedTypeInfo,
clang::SourceRange Range,
clang::SourceRange DirectInitRange)
Description
Create a c++ new expression.
Declared at: clang/include/clang/AST/ExprCXX.h:2219
Parameters
- const clang::ASTContext& Ctx
- bool IsGlobalNew
- clang::FunctionDecl* OperatorNew
- clang::FunctionDecl* OperatorDelete
- bool ShouldPassAlignment
- bool UsualArrayDeleteWantsSize
- ArrayRef<clang::Expr*> PlacementArgs
- clang::SourceRange TypeIdParens
- Optional<clang::Expr*> ArraySize
- clang::CXXNewExpr::InitializationStyle InitializationStyle
- clang::Expr* Initializer
- clang::QualType Ty
- clang::TypeSourceInfo* AllocatedTypeInfo
- clang::SourceRange Range
- clang::SourceRange DirectInitRange
¶static clang::CXXNewExpr* CreateEmpty(
const clang::ASTContext& Ctx,
bool IsArray,
bool HasInit,
unsigned int NumPlacementArgs,
bool IsParenTypeId)
static clang::CXXNewExpr* CreateEmpty(
const clang::ASTContext& Ctx,
bool IsArray,
bool HasInit,
unsigned int NumPlacementArgs,
bool IsParenTypeId)
Description
Create an empty c++ new expression.
Declared at: clang/include/clang/AST/ExprCXX.h:2228
Parameters
- const clang::ASTContext& Ctx
- bool IsArray
- bool HasInit
- unsigned int NumPlacementArgs
- bool IsParenTypeId
¶unsigned int arraySizeOffset() const
unsigned int arraySizeOffset() const
Declared at: clang/include/clang/AST/ExprCXX.h:2176
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/ExprCXX.h:2406
¶clang::Stmt::const_child_range children() const
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/ExprCXX.h:2408
¶static bool classof(const clang::Stmt* T)
static bool classof(const clang::Stmt* T)
Declared at: clang/include/clang/AST/ExprCXX.h:2401
Parameters
- const clang::Stmt* T
¶bool doesUsualArrayDeleteWantSize() const
bool doesUsualArrayDeleteWantSize() const
Description
Answers whether the usual array deallocation function for the allocated type expects the size of the allocation as a parameter.
Declared at: clang/include/clang/AST/ExprCXX.h:2354
¶clang::QualType getAllocatedType() const
clang::QualType getAllocatedType() const
Declared at: clang/include/clang/AST/ExprCXX.h:2232
¶clang::TypeSourceInfo*
getAllocatedTypeSourceInfo() const
clang::TypeSourceInfo*
getAllocatedTypeSourceInfo() const
Declared at: clang/include/clang/AST/ExprCXX.h:2236
¶Optional<const clang::Expr*> getArraySize() const
Optional<const clang::Expr*> getArraySize() const
Description
This might return None even if isArray() returns true, since there might not be an array size expression. If the result is not-None, it will never wrap a nullptr.
Declared at: clang/include/clang/AST/ExprCXX.h:2281
¶Optional<clang::Expr*> getArraySize()
Optional<clang::Expr*> getArraySize()
Description
This might return None even if isArray() returns true, since there might not be an array size expression. If the result is not-None, it will never wrap a nullptr.
Declared at: clang/include/clang/AST/ExprCXX.h:2267
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/ExprCXX.h:2395
¶const clang::CXXConstructExpr* getConstructExpr()
const
const clang::CXXConstructExpr* getConstructExpr()
const
Description
Returns the CXXConstructExpr from this new-expression, or null.
Declared at: clang/include/clang/AST/ExprCXX.h:2343
¶clang::SourceRange getDirectInitRange() const
clang::SourceRange getDirectInitRange() const
Declared at: clang/include/clang/AST/ExprCXX.h:2398
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/ExprCXX.h:2396
¶clang::CXXNewExpr::InitializationStyle
getInitializationStyle() const
clang::CXXNewExpr::InitializationStyle
getInitializationStyle() const
Description
The kind of initializer this new-expression has.
Declared at: clang/include/clang/AST/ExprCXX.h:2323
¶clang::Expr* getInitializer()
clang::Expr* getInitializer()
Description
The initializer of this new-expression.
Declared at: clang/include/clang/AST/ExprCXX.h:2331
¶const clang::Expr* getInitializer() const
const clang::Expr* getInitializer() const
Declared at: clang/include/clang/AST/ExprCXX.h:2336
¶unsigned int getNumPlacementArgs() const
unsigned int getNumPlacementArgs() const
Declared at: clang/include/clang/AST/ExprCXX.h:2292
¶clang::FunctionDecl* getOperatorDelete() const
clang::FunctionDecl* getOperatorDelete() const
Declared at: clang/include/clang/AST/ExprCXX.h:2259
¶clang::FunctionDecl* getOperatorNew() const
clang::FunctionDecl* getOperatorNew() const
Declared at: clang/include/clang/AST/ExprCXX.h:2257
¶clang::Expr* getPlacementArg(unsigned int I)
clang::Expr* getPlacementArg(unsigned int I)
Declared at: clang/include/clang/AST/ExprCXX.h:2301
Parameters
- unsigned int I
¶const clang::Expr* getPlacementArg(
unsigned int I) const
const clang::Expr* getPlacementArg(
unsigned int I) const
Declared at: clang/include/clang/AST/ExprCXX.h:2305
Parameters
- unsigned int I
¶clang::Expr** getPlacementArgs()
clang::Expr** getPlacementArgs()
Declared at: clang/include/clang/AST/ExprCXX.h:2296
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Declared at: clang/include/clang/AST/ExprCXX.h:2399
¶clang::SourceRange getTypeIdParens() const
clang::SourceRange getTypeIdParens() const
Declared at: clang/include/clang/AST/ExprCXX.h:2310
¶bool hasInitializer() const
bool hasInitializer() const
Description
Whether this new-expression has any initializer at all.
Declared at: clang/include/clang/AST/ExprCXX.h:2318
¶unsigned int initExprOffset() const
unsigned int initExprOffset() const
Declared at: clang/include/clang/AST/ExprCXX.h:2177
¶bool isArray() const
bool isArray() const
Declared at: clang/include/clang/AST/ExprCXX.h:2262
¶bool isGlobalNew() const
bool isGlobalNew() const
Declared at: clang/include/clang/AST/ExprCXX.h:2315
¶bool isParenTypeId() const
bool isParenTypeId() const
Declared at: clang/include/clang/AST/ExprCXX.h:2309
¶unsigned int numTrailingObjects(
OverloadToken<clang::Stmt*>) const
unsigned int numTrailingObjects(
OverloadToken<clang::Stmt*>) const
Declared at: clang/include/clang/AST/ExprCXX.h:2182
Parameters
- OverloadToken<clang::Stmt*>
¶unsigned int numTrailingObjects(
OverloadToken<clang::SourceRange>) const
unsigned int numTrailingObjects(
OverloadToken<clang::SourceRange>) const
Declared at: clang/include/clang/AST/ExprCXX.h:2186
Parameters
- OverloadToken<clang::SourceRange>
¶bool passAlignment() const
bool passAlignment() const
Description
Indicates whether the required alignment should be implicitly passed to the allocation function.
Declared at: clang/include/clang/AST/ExprCXX.h:2349
¶unsigned int placementNewArgsOffset() const
unsigned int placementNewArgsOffset() const
Declared at: clang/include/clang/AST/ExprCXX.h:2178
¶clang::CXXNewExpr::const_arg_iterator
placement_arg_begin() const
clang::CXXNewExpr::const_arg_iterator
placement_arg_begin() const
Declared at: clang/include/clang/AST/ExprCXX.h:2375
¶clang::CXXNewExpr::arg_iterator
placement_arg_begin()
clang::CXXNewExpr::arg_iterator
placement_arg_begin()
Declared at: clang/include/clang/AST/ExprCXX.h:2369
¶clang::CXXNewExpr::const_arg_iterator
placement_arg_end() const
clang::CXXNewExpr::const_arg_iterator
placement_arg_end() const
Declared at: clang/include/clang/AST/ExprCXX.h:2378
¶clang::CXXNewExpr::arg_iterator
placement_arg_end()
clang::CXXNewExpr::arg_iterator
placement_arg_end()
Declared at: clang/include/clang/AST/ExprCXX.h:2372
¶llvm::iterator_range<const_arg_iterator>
placement_arguments() const
llvm::iterator_range<const_arg_iterator>
placement_arguments() const
Declared at: clang/include/clang/AST/ExprCXX.h:2365
¶llvm::iterator_range<arg_iterator>
placement_arguments()
llvm::iterator_range<arg_iterator>
placement_arguments()
Declared at: clang/include/clang/AST/ExprCXX.h:2361
¶clang::CXXNewExpr::raw_arg_iterator
raw_arg_begin()
clang::CXXNewExpr::raw_arg_iterator
raw_arg_begin()
Declared at: clang/include/clang/AST/ExprCXX.h:2384
¶clang::CXXNewExpr::const_arg_iterator
raw_arg_begin() const
clang::CXXNewExpr::const_arg_iterator
raw_arg_begin() const
Declared at: clang/include/clang/AST/ExprCXX.h:2388
¶clang::CXXNewExpr::raw_arg_iterator raw_arg_end()
clang::CXXNewExpr::raw_arg_iterator raw_arg_end()
Declared at: clang/include/clang/AST/ExprCXX.h:2385
¶clang::CXXNewExpr::const_arg_iterator
raw_arg_end() const
clang::CXXNewExpr::const_arg_iterator
raw_arg_end() const
Declared at: clang/include/clang/AST/ExprCXX.h:2391
¶void setOperatorDelete(clang::FunctionDecl* D)
void setOperatorDelete(clang::FunctionDecl* D)
Declared at: clang/include/clang/AST/ExprCXX.h:2260
Parameters
¶void setOperatorNew(clang::FunctionDecl* D)
void setOperatorNew(clang::FunctionDecl* D)
Declared at: clang/include/clang/AST/ExprCXX.h:2258
Parameters
¶bool shouldNullCheckAllocation() const
bool shouldNullCheckAllocation() const
Description
True if the allocation result needs to be null-checked. C++11 [expr.new]p13: If the allocation function returns null, initialization shall not be done, the deallocation function shall not be called, and the value of the new-expression shall be null. C++ DR1748: If the allocation function is a reserved placement allocation function that returns null, the behavior is undefined. An allocation function is not allowed to return null unless it has a non-throwing exception-specification. The '03 rule is identical except that the definition of a non-throwing exception specification is just "is it throw()?".
Declared at: clang/include/clang/AST/ExprCXX.h:2255