]> granicus.if.org Git - clang/commitdiff
Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.
authorChris Lattner <sabre@nondot.org>
Mon, 6 Oct 2008 05:53:16 +0000 (05:53 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 6 Oct 2008 05:53:16 +0000 (05:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57154 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index 45724d318c98e39f4bd9a074b237948e020445a1..c20cf4c0c5acc21985bfb7c12b685fc54213d8e8 100644 (file)
@@ -543,17 +543,19 @@ static bool EvaluateFloat(const Expr* E, APFloat& Result, EvalInfo &Info) {
 }
 
 bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
-  //Result.zextOrTrunc(getIntTypeSizeInBits(E->getType()));
+  const llvm::fltSemantics &Sem =
+    Info.Ctx.getFloatTypeSemantics(E->getType());
   
   switch (E->isBuiltinCall()) {
+  default: return false;
   case Builtin::BI__builtin_huge_val:
   case Builtin::BI__builtin_huge_valf:
   case Builtin::BI__builtin_huge_vall:
   case Builtin::BI__builtin_inf:
   case Builtin::BI__builtin_inff:
   case Builtin::BI__builtin_infl:
-    // FIXME: Implement me.
-  default: return false;
+    Result = llvm::APFloat::getInf(Sem);
+    return true;
   }
 }