[cfe-commits] r57477 - /cfe/trunk/lib/AST/ExprConstant.cpp
Daniel Dunbar
daniel at zuster.org
Mon Oct 13 22:41:12 PDT 2008
Author: ddunbar
Date: Tue Oct 14 00:41:12 2008
New Revision: 57477
URL: http://llvm.org/viewvc/llvm-project?rev=57477&view=rev
Log:
Fix test suite regression, getFloatTypeSemantics shouldn't be called
on non-float types.
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=57477&r1=57476&r2=57477&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Oct 14 00:41:12 2008
@@ -596,9 +596,6 @@
}
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 @@
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 @@
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;
}
More information about the cfe-commits
mailing list