clang API Documentation

Public Member Functions | Static Public Member Functions
clang::CXXDynamicCastExpr Class Reference

A C++ dynamic_cast expression (C++ [expr.dynamic.cast]). More...

#include <ExprCXX.h>

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

List of all members.

Public Member Functions

bool isAlwaysNull () const

Static Public Member Functions

static CXXDynamicCastExprCreate (const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXDynamicCastExprCreateEmpty (const ASTContext &Context, unsigned pathSize)
static bool classof (const Stmt *T)

Detailed Description

A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).

This expression node represents a dynamic cast, e.g., dynamic_cast<Derived*>(BasePtr). Such a cast may perform a run-time check to determine how to perform the type conversion.

Definition at line 262 of file ExprCXX.h.


Member Function Documentation

static bool clang::CXXDynamicCastExpr::classof ( const Stmt T) [inline, static]

Reimplemented from clang::CXXNamedCastExpr.

Definition at line 286 of file ExprCXX.h.

References clang::Stmt::getStmtClass().

CXXDynamicCastExpr * CXXDynamicCastExpr::Create ( const ASTContext Context,
QualType  T,
ExprValueKind  VK,
CastKind  Kind,
Expr Op,
const CXXCastPath Path,
TypeSourceInfo Written,
SourceLocation  L,
SourceLocation  RParenLoc,
SourceRange  AngleBrackets 
) [static]
CXXDynamicCastExpr * CXXDynamicCastExpr::CreateEmpty ( const ASTContext Context,
unsigned  pathSize 
) [static]

Definition at line 628 of file ExprCXX.cpp.

References clang::ASTContext::Allocate().

isAlwaysNull - Return whether the result of the dynamic_cast is proven to always be null. For example:

struct A { }; struct B final : A { }; struct C { };

C *f(B* b) { return dynamic_cast<C*>(b); }

Definition at line 643 of file ExprCXX.cpp.

References clang::Type::castAs(), clang::Type::getAs(), clang::Type::getPointeeType(), clang::CastExpr::getSubExpr(), clang::Expr::getType(), clang::Decl::hasAttr(), clang::CXXRecordDecl::isDerivedFrom(), and clang::Type::isVoidType().

Referenced by clang::CodeGen::CodeGenFunction::EmitDynamicCast().


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