[cfe-commits] r65073 - /cfe/trunk/lib/AST/ExprConstant.cpp
Daniel Dunbar
daniel at zuster.org
Thu Feb 19 14:16:29 PST 2009
Author: ddunbar
Date: Thu Feb 19 16:16:29 2009
New Revision: 65073
URL: http://llvm.org/viewvc/llvm-project?rev=65073&view=rev
Log:
Simplify, no functionality change.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=65073&r1=65072&r2=65073&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Feb 19 16:16:29 2009
@@ -1039,6 +1039,7 @@
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 @@
}
// Handle simple integer->integer casts.
- if (SubExpr->getType()->isIntegralType()) {
+ if (SrcType->isIntegralType()) {
if (!Visit(SubExpr))
return false;
@@ -1056,12 +1057,12 @@
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 @@
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);
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list