aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 8ef9486459..32d7a6086d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -214,23 +214,18 @@ Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) {
if (Literal.isFloatingLiteral()) {
QualType Ty;
- const llvm::fltSemantics *Format;
-
- if (Literal.isFloat) {
+ if (Literal.isFloat)
Ty = Context.FloatTy;
- Format = Context.Target.getFloatFormat();
- } else if (!Literal.isLong) {
+ else if (!Literal.isLong)
Ty = Context.DoubleTy;
- Format = Context.Target.getDoubleFormat();
- } else {
+ else
Ty = Context.LongDoubleTy;
- Format = Context.Target.getLongDoubleFormat();
- }
-
+
+ const llvm::fltSemantics &Format = Context.getFloatTypeSemantics(Ty);
+
// isExact will be set by GetFloatValue().
bool isExact = false;
-
- Res = new FloatingLiteral(Literal.GetFloatValue(*Format,&isExact), &isExact,
+ Res = new FloatingLiteral(Literal.GetFloatValue(Format, &isExact), &isExact,
Ty, Tok.getLocation());
} else if (!Literal.isIntegerLiteral()) {