clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::CXXNewExpr Class Reference

#include <ExprCXX.h>

Inheritance diagram for clang::CXXNewExpr:
Inheritance graph
[legend]
Collaboration diagram for clang::CXXNewExpr:
Collaboration graph
[legend]

List of all members.

Public Types

enum  InitializationStyle { NoInit, CallInit, ListInit }
typedef ExprIterator arg_iterator
typedef ConstExprIterator const_arg_iterator
typedef Stmt ** raw_arg_iterator

Public Member Functions

 CXXNewExpr (ASTContext &C, bool globalNew, FunctionDecl *operatorNew, FunctionDecl *operatorDelete, bool usualArrayDeleteWantsSize, Expr **placementArgs, unsigned numPlaceArgs, SourceRange typeIdParens, Expr *arraySize, InitializationStyle initializationStyle, Expr *initializer, QualType ty, TypeSourceInfo *AllocatedTypeInfo, SourceLocation startLoc, SourceRange directInitRange)
 CXXNewExpr (EmptyShell Shell)
void AllocateArgsArray (ASTContext &C, bool isArray, unsigned numPlaceArgs, bool hasInitializer)
QualType getAllocatedType () const
TypeSourceInfogetAllocatedTypeSourceInfo () const
bool shouldNullCheckAllocation (ASTContext &Ctx) const
 True if the allocation result needs to be null-checked. C++0x [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()?".
FunctionDeclgetOperatorNew () const
void setOperatorNew (FunctionDecl *D)
FunctionDeclgetOperatorDelete () const
void setOperatorDelete (FunctionDecl *D)
bool isArray () const
ExprgetArraySize ()
const ExprgetArraySize () const
unsigned getNumPlacementArgs () const
Expr ** getPlacementArgs ()
ExprgetPlacementArg (unsigned i)
const ExprgetPlacementArg (unsigned i) const
bool isParenTypeId () const
SourceRange getTypeIdParens () const
bool isGlobalNew () const
bool hasInitializer () const
 Whether this new-expression has any initializer at all.
InitializationStyle getInitializationStyle () const
 The kind of initializer this new-expression has.
ExprgetInitializer ()
 The initializer of this new-expression.
const ExprgetInitializer () const
const CXXConstructExprgetConstructExpr ()
 Returns the CXXConstructExpr from this new-expression, or NULL.
bool doesUsualArrayDeleteWantSize () const
arg_iterator placement_arg_begin ()
arg_iterator placement_arg_end ()
const_arg_iterator placement_arg_begin () const
const_arg_iterator placement_arg_end () const
raw_arg_iterator raw_arg_begin ()
raw_arg_iterator raw_arg_end ()
const_arg_iterator raw_arg_begin () const
const_arg_iterator raw_arg_end () const
SourceLocation getStartLoc () const
SourceLocation getEndLoc () const
SourceRange getDirectInitRange () const
SourceRange getSourceRange () const LLVM_READONLY
child_range children ()

Static Public Member Functions

static bool classof (const Stmt *T)
static bool classof (const CXXNewExpr *)

Friends

class ASTStmtReader
class ASTStmtWriter

Detailed Description

CXXNewExpr - A new expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".

Definition at line 1441 of file ExprCXX.h.


Member Typedef Documentation

Definition at line 1581 of file ExprCXX.h.

Definition at line 1582 of file ExprCXX.h.

Definition at line 1597 of file ExprCXX.h.


Member Enumeration Documentation

Enumerator:
NoInit 

New-expression has no initializer as written.

CallInit 

New-expression has a C++98 paren-delimited initializer.

ListInit 

New-expression has a C++11 list-initializer.

Definition at line 1480 of file ExprCXX.h.


Constructor & Destructor Documentation

CXXNewExpr::CXXNewExpr ( ASTContext C,
bool  globalNew,
FunctionDecl operatorNew,
FunctionDecl operatorDelete,
bool  usualArrayDeleteWantsSize,
Expr **  placementArgs,
unsigned  numPlaceArgs,
SourceRange  typeIdParens,
Expr arraySize,
InitializationStyle  initializationStyle,
Expr initializer,
QualType  ty,
TypeSourceInfo AllocatedTypeInfo,
SourceLocation  startLoc,
SourceRange  directInitRange 
)
clang::CXXNewExpr::CXXNewExpr ( EmptyShell  Shell) [inline, explicit]

Definition at line 1493 of file ExprCXX.h.


Member Function Documentation

void CXXNewExpr::AllocateArgsArray ( ASTContext C,
bool  isArray,
unsigned  numPlaceArgs,
bool  hasInitializer 
)

Definition at line 99 of file ExprCXX.cpp.

References isArray().

Referenced by CXXNewExpr().

child_range clang::CXXNewExpr::children ( ) [inline]

Reimplemented from clang::Stmt.

Definition at line 1622 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 1616 of file ExprCXX.h.

References clang::Stmt::getStmtClass().

static bool clang::CXXNewExpr::classof ( const CXXNewExpr ) [inline, static]

Definition at line 1619 of file ExprCXX.h.

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 1577 of file ExprCXX.h.

Referenced by clang::CodeGen::CGCXXABI::requiresArrayCookie().

QualType clang::CXXNewExpr::getAllocatedType ( ) const [inline]
TypeSourceInfo* clang::CXXNewExpr::getAllocatedTypeSourceInfo ( ) const [inline]

Definition at line 1504 of file ExprCXX.h.

Expr* clang::CXXNewExpr::getArraySize ( ) [inline]

Definition at line 1525 of file ExprCXX.h.

Referenced by EmitCXXNewAllocSize().

const Expr* clang::CXXNewExpr::getArraySize ( ) const [inline]

Definition at line 1528 of file ExprCXX.h.

const CXXConstructExpr* clang::CXXNewExpr::getConstructExpr ( ) [inline]

Returns the CXXConstructExpr from this new-expression, or NULL.

Definition at line 1570 of file ExprCXX.h.

References getInitializer().

SourceRange clang::CXXNewExpr::getDirectInitRange ( ) const [inline]

Definition at line 1610 of file ExprCXX.h.

SourceLocation CXXNewExpr::getEndLoc ( ) const
InitializationStyle clang::CXXNewExpr::getInitializationStyle ( ) const [inline]

The kind of initializer this new-expression has.

Definition at line 1555 of file ExprCXX.h.

References NoInit.

Referenced by getEndLoc().

Expr* clang::CXXNewExpr::getInitializer ( ) [inline]
const Expr* clang::CXXNewExpr::getInitializer ( ) const [inline]

Definition at line 1565 of file ExprCXX.h.

References hasInitializer().

unsigned clang::CXXNewExpr::getNumPlacementArgs ( ) const [inline]

Definition at line 1532 of file ExprCXX.h.

Referenced by EnterNewDeleteCleanup(), placement_arg_end(), and raw_arg_end().

FunctionDecl* clang::CXXNewExpr::getOperatorDelete ( ) const [inline]
FunctionDecl* clang::CXXNewExpr::getOperatorNew ( ) const [inline]
Expr* clang::CXXNewExpr::getPlacementArg ( unsigned  i) [inline]

Definition at line 1537 of file ExprCXX.h.

References getPlacementArgs().

Referenced by getPlacementArg().

const Expr* clang::CXXNewExpr::getPlacementArg ( unsigned  i) const [inline]

Definition at line 1541 of file ExprCXX.h.

References getPlacementArg().

Expr** clang::CXXNewExpr::getPlacementArgs ( ) [inline]

Definition at line 1533 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 1612 of file ExprCXX.h.

References getEndLoc(), and getStartLoc().

SourceLocation clang::CXXNewExpr::getStartLoc ( ) const [inline]

Definition at line 1607 of file ExprCXX.h.

Referenced by getSourceRange().

SourceRange clang::CXXNewExpr::getTypeIdParens ( ) const [inline]

Definition at line 1547 of file ExprCXX.h.

bool clang::CXXNewExpr::hasInitializer ( ) const [inline]
bool clang::CXXNewExpr::isArray ( ) const [inline]
bool clang::CXXNewExpr::isGlobalNew ( ) const [inline]

Definition at line 1549 of file ExprCXX.h.

bool clang::CXXNewExpr::isParenTypeId ( ) const [inline]

Definition at line 1546 of file ExprCXX.h.

References clang::SourceRange::isValid().

arg_iterator clang::CXXNewExpr::placement_arg_begin ( ) [inline]

Definition at line 1584 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 1590 of file ExprCXX.h.

References hasInitializer().

arg_iterator clang::CXXNewExpr::placement_arg_end ( ) [inline]

Definition at line 1587 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 1593 of file ExprCXX.h.

References getNumPlacementArgs(), and hasInitializer().

raw_arg_iterator clang::CXXNewExpr::raw_arg_begin ( ) [inline]

Definition at line 1598 of file ExprCXX.h.

Referenced by children().

const_arg_iterator clang::CXXNewExpr::raw_arg_begin ( ) const [inline]

Definition at line 1602 of file ExprCXX.h.

raw_arg_iterator clang::CXXNewExpr::raw_arg_end ( ) [inline]

Definition at line 1599 of file ExprCXX.h.

References getNumPlacementArgs(), and hasInitializer().

Referenced by children().

const_arg_iterator clang::CXXNewExpr::raw_arg_end ( ) const [inline]

Definition at line 1603 of file ExprCXX.h.

References getNumPlacementArgs(), and hasInitializer().

void clang::CXXNewExpr::setOperatorDelete ( FunctionDecl D) [inline]

Definition at line 1522 of file ExprCXX.h.

void clang::CXXNewExpr::setOperatorNew ( FunctionDecl D) [inline]

Definition at line 1520 of file ExprCXX.h.

bool CXXNewExpr::shouldNullCheckAllocation ( ASTContext Ctx) const

True if the allocation result needs to be null-checked. C++0x [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 109 of file ExprCXX.cpp.

References getOperatorNew(), and clang::ValueDecl::getType().


Friends And Related Function Documentation

friend class ASTStmtReader [friend]

Reimplemented from clang::Stmt.

Definition at line 1477 of file ExprCXX.h.

friend class ASTStmtWriter [friend]

Reimplemented from clang::Stmt.

Definition at line 1478 of file ExprCXX.h.


The documentation for this class was generated from the following files: