summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-30 18:32:54 +0000
committerChris Lattner <sabre@nondot.org>2008-06-30 18:32:54 +0000
commit9a8d1d9e56ecdc052add3620b478253fda0cb615 (patch)
treeb3af06907b71283efd6ac83b249414f38395864c /clang/lib/Sema/SemaExpr.cpp
parent51a685cf270ef7d49db47cd718689fbf0037255a (diff)
downloadbcm5719-llvm-9a8d1d9e56ecdc052add3620b478253fda0cb615.tar.gz
bcm5719-llvm-9a8d1d9e56ecdc052add3620b478253fda0cb615.zip
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. llvm-svn: 52914
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 8ef94864590..32d7a6086dd 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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()) {
OpenPOWER on IntegriCloud