[cfe-commits] r57154 - /cfe/trunk/lib/AST/ExprConstant.cpp

Chris Lattner sabre at nondot.org
Sun Oct 5 22:53:16 PDT 2008


Author: lattner
Date: Mon Oct  6 00:53:16 2008
New Revision: 57154

URL: http://llvm.org/viewvc/llvm-project?rev=57154&view=rev
Log:
Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.


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=57154&r1=57153&r2=57154&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Oct  6 00:53:16 2008
@@ -543,17 +543,19 @@
 }
 
 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;
   }
 }
 





More information about the cfe-commits mailing list