aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaNamedCast.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-03-15 17:47:39 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-03-15 17:47:39 +0000
commitf53597fb16142bdb4a66901f8c0b768db4f2a548 (patch)
treeb1d6b9bccdbcf7c2eccac31709a90eee515a1342 /lib/Sema/SemaNamedCast.cpp
parent3e287c2a53e88d583fa2e0cafc33dbb49772db05 (diff)
Convert a bunch of actions to smart pointers, and also bring PrintParserCallbacks a bit more in line with reality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaNamedCast.cpp')
-rw-r--r--lib/Sema/SemaNamedCast.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/Sema/SemaNamedCast.cpp b/lib/Sema/SemaNamedCast.cpp
index fbde930f0b..a8ad10d382 100644
--- a/lib/Sema/SemaNamedCast.cpp
+++ b/lib/Sema/SemaNamedCast.cpp
@@ -55,13 +55,13 @@ static TryStaticCastResult TryStaticImplicitCast(Sema &Self, Expr *SrcExpr,
const SourceRange &OpRange);
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
-Action::ExprResult
+Action::OwningExprResult
Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
SourceLocation LAngleBracketLoc, TypeTy *Ty,
SourceLocation RAngleBracketLoc,
- SourceLocation LParenLoc, ExprTy *E,
+ SourceLocation LParenLoc, ExprArg E,
SourceLocation RParenLoc) {
- Expr *Ex = (Expr*)E;
+ Expr *Ex = (Expr*)E.release();
QualType DestType = QualType::getFromOpaquePtr(Ty);
SourceRange OpRange(OpLoc, RParenLoc);
SourceRange DestRange(LAngleBracketLoc, RAngleBracketLoc);
@@ -76,29 +76,30 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
case tok::kw_const_cast:
if (!TypeDependent)
CheckConstCast(*this, Ex, DestType, OpRange, DestRange);
- return new (Context) CXXConstCastExpr(DestType.getNonReferenceType(), Ex,
- DestType, OpLoc);
+ return Owned(new (Context) CXXConstCastExpr(DestType.getNonReferenceType(),
+ Ex, DestType, OpLoc));
case tok::kw_dynamic_cast:
if (!TypeDependent)
CheckDynamicCast(*this, Ex, DestType, OpRange, DestRange);
- return new (Context)CXXDynamicCastExpr(DestType.getNonReferenceType(), Ex,
- DestType, OpLoc);
+ return Owned(new (Context)CXXDynamicCastExpr(DestType.getNonReferenceType(),
+ Ex, DestType, OpLoc));
case tok::kw_reinterpret_cast:
if (!TypeDependent)
CheckReinterpretCast(*this, Ex, DestType, OpRange, DestRange);
- return new (Context) CXXReinterpretCastExpr(DestType.getNonReferenceType(),
- Ex, DestType, OpLoc);
+ return Owned(new (Context) CXXReinterpretCastExpr(
+ DestType.getNonReferenceType(),
+ Ex, DestType, OpLoc));
case tok::kw_static_cast:
if (!TypeDependent)
CheckStaticCast(*this, Ex, DestType, OpRange);
- return new (Context) CXXStaticCastExpr(DestType.getNonReferenceType(), Ex,
- DestType, OpLoc);
+ return Owned(new (Context) CXXStaticCastExpr(DestType.getNonReferenceType(),
+ Ex, DestType, OpLoc));
}
- return true;
+ return ExprError();
}
/// CheckConstCast - Check that a const_cast\<DestType\>(SrcExpr) is valid.