diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-02-19 22:16:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-19 22:16:29 +0000 |
commit | cf04aa1a024b8cbcf95593c06aaf62e8ce7ca6c0 (patch) | |
tree | 7940ab0853c64c70de62bfa44b44dba225ba63d7 /clang/lib/AST/ExprConstant.cpp | |
parent | e76eb060c7e5d9f0460da2b0a23415fbc20ca373 (diff) | |
download | bcm5719-llvm-cf04aa1a024b8cbcf95593c06aaf62e8ce7ca6c0.tar.gz bcm5719-llvm-cf04aa1a024b8cbcf95593c06aaf62e8ce7ca6c0.zip |
Simplify, no functionality change.
llvm-svn: 65073
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 51c581a7083..cfe1a74f320 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -1039,6 +1039,7 @@ bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) { bool IntExprEvaluator::VisitCastExpr(CastExpr *E) { Expr *SubExpr = E->getSubExpr(); QualType DestType = E->getType(); + QualType SrcType = SubExpr->getType(); if (DestType->isBooleanType()) { bool BoolResult; @@ -1048,7 +1049,7 @@ bool IntExprEvaluator::VisitCastExpr(CastExpr *E) { } // Handle simple integer->integer casts. - if (SubExpr->getType()->isIntegralType()) { + if (SrcType->isIntegralType()) { if (!Visit(SubExpr)) return false; @@ -1056,12 +1057,12 @@ bool IntExprEvaluator::VisitCastExpr(CastExpr *E) { if (!Result.isInt()) return false; - return Success(HandleIntToIntCast(DestType, SubExpr->getType(), + return Success(HandleIntToIntCast(DestType, SrcType, Result.getInt(), Info.Ctx), E); } // FIXME: Clean this up! - if (SubExpr->getType()->isPointerType()) { + if (SrcType->isPointerType()) { APValue LV; if (!EvaluatePointer(SubExpr, LV, Info)) return false; @@ -1072,15 +1073,14 @@ bool IntExprEvaluator::VisitCastExpr(CastExpr *E) { return Success(LV.getLValueOffset(), E); } - if (!SubExpr->getType()->isRealFloatingType()) + if (!SrcType->isRealFloatingType()) return Error(E->getExprLoc(), diag::note_invalid_subexpr_in_ice, E); APFloat F(0.0); if (!EvaluateFloat(SubExpr, F, Info)) return Error(E->getExprLoc(), diag::note_invalid_subexpr_in_ice, E); - return Success(HandleFloatToIntCast(DestType, SubExpr->getType(), - F, Info.Ctx), E); + return Success(HandleFloatToIntCast(DestType, SrcType, F, Info.Ctx), E); } //===----------------------------------------------------------------------===// |