]> granicus.if.org Git - clang/commitdiff
Simplify, no functionality change.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 19 Feb 2009 22:16:29 +0000 (22:16 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 19 Feb 2009 22:16:29 +0000 (22:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65073 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index 51c581a708381fa38f8d187189b891df5f31d69d..cfe1a74f3204480a89f8d737d0ca400a7fbd357e 100644 (file)
@@ -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);
 }
 
 //===----------------------------------------------------------------------===//