clang API Documentation
A C++ dynamic_cast
expression (C++ [expr.dynamic.cast]).
More...
#include <ExprCXX.h>
Public Member Functions | |
bool | isAlwaysNull () const |
Static Public Member Functions | |
static 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 * | CreateEmpty (const ASTContext &Context, unsigned pathSize) |
static bool | classof (const Stmt *T) |
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.
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] |
Definition at line 610 of file ExprCXX.cpp.
References clang::ASTContext::Allocate(), and clang::CastExpr::setCastPath().
Referenced by clang::Sema::BuildCXXNamedCast().
CXXDynamicCastExpr * CXXDynamicCastExpr::CreateEmpty | ( | const ASTContext & | Context, |
unsigned | pathSize | ||
) | [static] |
Definition at line 628 of file ExprCXX.cpp.
References clang::ASTContext::Allocate().
bool CXXDynamicCastExpr::isAlwaysNull | ( | ) | const |
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().