Make a few related changes:
1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their
fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52914 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 9008884..b328b2f 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -46,9 +46,8 @@
return true;
return TheCall.take();
case Builtin::BI__builtin_va_start:
- if (SemaBuiltinVAStart(TheCall.get())) {
+ if (SemaBuiltinVAStart(TheCall.get()))
return true;
- }
return TheCall.take();
case Builtin::BI__builtin_isgreater:
case Builtin::BI__builtin_isgreaterequal:
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 8ef9486..32d7a60 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -214,23 +214,18 @@
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()) {