clang API Documentation
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)". More...
#include <ExprCXX.h>
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
typedef Stmt** clang::CXXNewExpr::raw_arg_iterator |
CXXNewExpr::CXXNewExpr | ( | const ASTContext & | C, |
bool | globalNew, | ||
FunctionDecl * | operatorNew, | ||
FunctionDecl * | operatorDelete, | ||
bool | usualArrayDeleteWantsSize, | ||
ArrayRef< Expr * > | placementArgs, | ||
SourceRange | typeIdParens, | ||
Expr * | arraySize, | ||
InitializationStyle | initializationStyle, | ||
Expr * | initializer, | ||
QualType | ty, | ||
TypeSourceInfo * | AllocatedTypeInfo, | ||
SourceRange | Range, | ||
SourceRange | directInitRange | ||
) |
Definition at line 136 of file ExprCXX.cpp.
References AllocateArgsArray(), CallInit, clang::Expr::containsUnexpandedParameterPack(), clang::Stmt::ExprBits, clang::SourceRange::getEnd(), getInitializationStyle(), getInitializer(), getSourceRange(), clang::Expr::isInstantiationDependent(), clang::SourceRange::isValid(), ListInit, NoInit, and clang::SourceRange::setEnd().
clang::CXXNewExpr::CXXNewExpr | ( | EmptyShell | Shell | ) | [inline, explicit] |
void CXXNewExpr::AllocateArgsArray | ( | const ASTContext & | C, |
bool | isArray, | ||
unsigned | numPlaceArgs, | ||
bool | hasInitializer | ||
) |
Definition at line 200 of file ExprCXX.cpp.
References AttributeLangSupport::C, and isArray().
Referenced by CXXNewExpr().
child_range clang::CXXNewExpr::children | ( | ) | [inline] |
Reimplemented from clang::Stmt.
Definition at line 1799 of file ExprCXX.h.
References raw_arg_begin(), and raw_arg_end().
static bool clang::CXXNewExpr::classof | ( | const Stmt * | T | ) | [inline, static] |
Reimplemented from clang::Expr.
Definition at line 1794 of file ExprCXX.h.
References clang::Stmt::getStmtClass().
bool clang::CXXNewExpr::doesUsualArrayDeleteWantSize | ( | ) | const [inline] |
Answers whether the usual array deallocation function for the allocated type expects the size of the allocation as a parameter.
Definition at line 1753 of file ExprCXX.h.
Referenced by clang::CodeGen::CGCXXABI::requiresArrayCookie().
QualType clang::CXXNewExpr::getAllocatedType | ( | ) | const [inline] |
Definition at line 1673 of file ExprCXX.h.
References clang::Type::getAs(), and clang::Expr::getType().
Referenced by EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), EmitNewInitializer(), clang::CodeGen::CGCXXABI::GetArrayCookieSize(), clang::CodeGen::CGCXXABI::requiresArrayCookie(), and treatUnusedNewEscaped().
TypeSourceInfo* clang::CXXNewExpr::getAllocatedTypeSourceInfo | ( | ) | const [inline] |
Expr* clang::CXXNewExpr::getArraySize | ( | ) | [inline] |
Definition at line 1701 of file ExprCXX.h.
Referenced by EmitCXXNewAllocSize().
const Expr* clang::CXXNewExpr::getArraySize | ( | ) | const [inline] |
const CXXConstructExpr* clang::CXXNewExpr::getConstructExpr | ( | ) | const [inline] |
Returns the CXXConstructExpr from this new-expression, or null.
Definition at line 1746 of file ExprCXX.h.
References getInitializer().
Referenced by treatUnusedNewEscaped().
SourceRange clang::CXXNewExpr::getDirectInitRange | ( | ) | const [inline] |
SourceLocation clang::CXXNewExpr::getEndLoc | ( | ) | const [inline] |
Definition at line 1784 of file ExprCXX.h.
References clang::SourceRange::getEnd().
Referenced by getLocEnd().
InitializationStyle clang::CXXNewExpr::getInitializationStyle | ( | ) | const [inline] |
The kind of initializer this new-expression has.
Definition at line 1731 of file ExprCXX.h.
References NoInit.
Referenced by CXXNewExpr().
Expr* clang::CXXNewExpr::getInitializer | ( | ) | [inline] |
The initializer of this new-expression.
Definition at line 1738 of file ExprCXX.h.
References hasInitializer().
Referenced by CXXNewExpr(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), EmitNewInitializer(), getConstructExpr(), and clang::ento::ExprEngine::VisitCXXNewExpr().
const Expr* clang::CXXNewExpr::getInitializer | ( | ) | const [inline] |
Definition at line 1741 of file ExprCXX.h.
References hasInitializer().
SourceLocation clang::CXXNewExpr::getLocEnd | ( | ) | const [inline] |
SourceLocation clang::CXXNewExpr::getLocStart | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
Definition at line 1791 of file ExprCXX.h.
References getStartLoc().
Referenced by clang::ento::ExprEngine::ProcessNewAllocator().
unsigned clang::CXXNewExpr::getNumPlacementArgs | ( | ) | const [inline] |
Definition at line 1708 of file ExprCXX.h.
Referenced by EnterNewDeleteCleanup(), placement_arg_end(), and raw_arg_end().
FunctionDecl* clang::CXXNewExpr::getOperatorDelete | ( | ) | const [inline] |
Definition at line 1697 of file ExprCXX.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), and EnterNewDeleteCleanup().
FunctionDecl* clang::CXXNewExpr::getOperatorNew | ( | ) | const [inline] |
Definition at line 1695 of file ExprCXX.h.
Referenced by CalculateCookiePadding(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::ento::ExprEngine::ProcessNewAllocator(), shouldNullCheckAllocation(), and clang::ento::ExprEngine::VisitCXXNewExpr().
Expr* clang::CXXNewExpr::getPlacementArg | ( | unsigned | i | ) | [inline] |
Definition at line 1713 of file ExprCXX.h.
References getPlacementArgs().
Referenced by getPlacementArg(), and clang::ento::ExprEngine::VisitCXXNewExpr().
const Expr* clang::CXXNewExpr::getPlacementArg | ( | unsigned | i | ) | const [inline] |
Definition at line 1717 of file ExprCXX.h.
References getPlacementArg().
Expr** clang::CXXNewExpr::getPlacementArgs | ( | ) | [inline] |
Definition at line 1709 of file ExprCXX.h.
References hasInitializer().
Referenced by getPlacementArg().
SourceRange clang::CXXNewExpr::getSourceRange | ( | ) | const [inline] |
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpreted by SourceManager. We assume AST clients will have a pointer to the respective SourceManager.
Reimplemented from clang::Stmt.
Definition at line 1788 of file ExprCXX.h.
Referenced by CXXNewExpr().
SourceLocation clang::CXXNewExpr::getStartLoc | ( | ) | const [inline] |
Definition at line 1783 of file ExprCXX.h.
References clang::SourceRange::getBegin().
Referenced by getLocStart(), and clang::ento::ExprEngine::VisitCXXNewAllocatorCall().
SourceRange clang::CXXNewExpr::getTypeIdParens | ( | ) | const [inline] |
bool clang::CXXNewExpr::hasInitializer | ( | ) | const [inline] |
Whether this new-expression has any initializer at all.
Definition at line 1728 of file ExprCXX.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), getInitializer(), getPlacementArgs(), placement_arg_begin(), placement_arg_end(), and raw_arg_end().
bool clang::CXXNewExpr::isArray | ( | ) | const [inline] |
Definition at line 1700 of file ExprCXX.h.
Referenced by AllocateArgsArray(), CalculateCookiePadding(), EmitCXXNewAllocSize(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), EmitNewInitializer(), and clang::ento::ExprEngine::VisitCXXNewExpr().
bool clang::CXXNewExpr::isGlobalNew | ( | ) | const [inline] |
bool clang::CXXNewExpr::isParenTypeId | ( | ) | const [inline] |
Definition at line 1722 of file ExprCXX.h.
References clang::SourceRange::isValid().
arg_iterator clang::CXXNewExpr::placement_arg_begin | ( | ) | [inline] |
Definition at line 1760 of file ExprCXX.h.
References hasInitializer().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
const_arg_iterator clang::CXXNewExpr::placement_arg_begin | ( | ) | const [inline] |
Definition at line 1766 of file ExprCXX.h.
References hasInitializer().
arg_iterator clang::CXXNewExpr::placement_arg_end | ( | ) | [inline] |
Definition at line 1763 of file ExprCXX.h.
References getNumPlacementArgs(), and hasInitializer().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
const_arg_iterator clang::CXXNewExpr::placement_arg_end | ( | ) | const [inline] |
Definition at line 1769 of file ExprCXX.h.
References getNumPlacementArgs(), and hasInitializer().
raw_arg_iterator clang::CXXNewExpr::raw_arg_begin | ( | ) | [inline] |
Definition at line 1774 of file ExprCXX.h.
Referenced by children().
const_arg_iterator clang::CXXNewExpr::raw_arg_begin | ( | ) | const [inline] |
raw_arg_iterator clang::CXXNewExpr::raw_arg_end | ( | ) | [inline] |
Definition at line 1775 of file ExprCXX.h.
References getNumPlacementArgs(), and hasInitializer().
Referenced by children().
const_arg_iterator clang::CXXNewExpr::raw_arg_end | ( | ) | const [inline] |
Definition at line 1779 of file ExprCXX.h.
References getNumPlacementArgs(), and hasInitializer().
void clang::CXXNewExpr::setOperatorDelete | ( | FunctionDecl * | D | ) | [inline] |
void clang::CXXNewExpr::setOperatorNew | ( | FunctionDecl * | D | ) | [inline] |
bool CXXNewExpr::shouldNullCheckAllocation | ( | const ASTContext & | Ctx | ) | const |
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.
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()?".
Definition at line 210 of file ExprCXX.cpp.
References getOperatorNew(), and clang::ValueDecl::getType().
friend class ASTStmtReader [friend] |
Reimplemented from clang::Stmt.
friend class ASTStmtWriter [friend] |
Reimplemented from clang::Stmt.