diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2008-10-14 05:41:12 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-14 05:41:12 +0000 |
| commit | 1be9f88a2f4e2928abc78e21135c5a3cf85498af (patch) | |
| tree | 07ebc23c96e19a08ff1c44d62d783beef6875b90 | |
| parent | 5460374cd986a6ec52aeed1d61e25f00eb8bca66 (diff) | |
| download | bcm5719-llvm-1be9f88a2f4e2928abc78e21135c5a3cf85498af.tar.gz bcm5719-llvm-1be9f88a2f4e2928abc78e21135c5a3cf85498af.zip | |
Fix test suite regression, getFloatTypeSemantics shouldn't be called
on non-float types.
llvm-svn: 57477
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 2b94964a918..cc2b4e67357 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -596,9 +596,6 @@ static bool EvaluateFloat(const Expr* E, APFloat& Result, EvalInfo &Info) { } bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) { - const llvm::fltSemantics &Sem = - Info.Ctx.getFloatTypeSemantics(E->getType()); - switch (E->isBuiltinCall()) { default: return false; case Builtin::BI__builtin_huge_val: @@ -606,9 +603,12 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) { case Builtin::BI__builtin_huge_vall: case Builtin::BI__builtin_inf: case Builtin::BI__builtin_inff: - case Builtin::BI__builtin_infl: + case Builtin::BI__builtin_infl: { + const llvm::fltSemantics &Sem = + Info.Ctx.getFloatTypeSemantics(E->getType()); Result = llvm::APFloat::getInf(Sem); return true; + } case Builtin::BI__builtin_nan: case Builtin::BI__builtin_nanf: @@ -618,6 +618,8 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) { if (const StringLiteral *S = dyn_cast<StringLiteral>(E->getArg(0)->IgnoreParenCasts())) { if (!S->isWide() && S->getByteLength() == 0) { // empty string. + const llvm::fltSemantics &Sem = + Info.Ctx.getFloatTypeSemantics(E->getType()); Result = llvm::APFloat::getNaN(Sem); return true; } |

