summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-07-17 21:03:05 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-07-17 21:03:05 +0000
commit4eafb6b77b00d4e0276942d3219f088583fc9e2b (patch)
treee927f44978732483d0326f0b0e8b3577c6715dc3 /clang/lib/AST/ExprConstant.cpp
parent60a2bba9760a52dfc6f5256c5130580e6bbf519e (diff)
downloadbcm5719-llvm-4eafb6b77b00d4e0276942d3219f088583fc9e2b.tar.gz
bcm5719-llvm-4eafb6b77b00d4e0276942d3219f088583fc9e2b.zip
Don't treat overflow in floating-point conversions as a hard error in constant evaluation. <rdar://problem/11874571>.
llvm-svn: 160394
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index eb34fc5fcad..f88206cee71 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1151,11 +1151,10 @@ static bool EvaluateAsBooleanCondition(const Expr *E, bool &Result,
}
template<typename T>
-static bool HandleOverflow(EvalInfo &Info, const Expr *E,
+static void HandleOverflow(EvalInfo &Info, const Expr *E,
const T &SrcValue, QualType DestType) {
- Info.Diag(E, diag::note_constexpr_overflow)
+ Info.CCEDiag(E, diag::note_constexpr_overflow)
<< SrcValue << DestType;
- return false;
}
static bool HandleFloatToIntCast(EvalInfo &Info, const Expr *E,
@@ -1169,7 +1168,7 @@ static bool HandleFloatToIntCast(EvalInfo &Info, const Expr *E,
bool ignored;
if (Value.convertToInteger(Result, llvm::APFloat::rmTowardZero, &ignored)
& APFloat::opInvalidOp)
- return HandleOverflow(Info, E, Value, DestType);
+ HandleOverflow(Info, E, Value, DestType);
return true;
}
@@ -1181,7 +1180,7 @@ static bool HandleFloatToFloatCast(EvalInfo &Info, const Expr *E,
if (Result.convert(Info.Ctx.getFloatTypeSemantics(DestType),
APFloat::rmNearestTiesToEven, &ignored)
& APFloat::opOverflow)
- return HandleOverflow(Info, E, Value, DestType);
+ HandleOverflow(Info, E, Value, DestType);
return true;
}
@@ -1204,7 +1203,7 @@ static bool HandleIntToFloatCast(EvalInfo &Info, const Expr *E,
if (Result.convertFromAPInt(Value, Value.isSigned(),
APFloat::rmNearestTiesToEven)
& APFloat::opOverflow)
- return HandleOverflow(Info, E, Value, DestType);
+ HandleOverflow(Info, E, Value, DestType);
return true;
}
OpenPOWER on IntegriCloud