Use APFloat for the representation of FP immediates, ask the target
for *which* apfloat to use for a particular type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42234 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 11c3ecc..15bf4fd 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -150,9 +150,23 @@
   Expr *Res;
   
   if (Literal.isFloatingLiteral()) {
-    // FIXME: handle float values > 32 (including compute the real type...).
-    QualType Ty = Literal.isFloat ? Context.FloatTy : Context.DoubleTy;
-    Res = new FloatingLiteral(Literal.GetFloatValue(), Ty, Tok.getLocation());
+    QualType Ty;
+    const llvm::fltSemantics *Format;
+    uint64_t Size; unsigned Align;
+
+    if (Literal.isFloat) {
+      Ty = Context.FloatTy;
+      Context.Target.getFloatInfo(Size, Align, Format, Tok.getLocation());
+    } else if (Literal.isLong) {
+      Ty = Context.LongDoubleTy;
+      Context.Target.getLongDoubleInfo(Size, Align, Format, Tok.getLocation());
+    } else {
+      Ty = Context.DoubleTy;
+      Context.Target.getDoubleInfo(Size, Align, Format, Tok.getLocation());
+    }
+    
+    Res = new FloatingLiteral(Literal.GetFloatValue(*Format), Ty,
+                              Tok.getLocation());
   } else if (!Literal.isIntegerLiteral()) {
     return ExprResult(true);
   } else {