aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-09-13 01:26:11 +0000
committerChris Lattner <sabre@nondot.org>2007-09-13 01:26:11 +0000
commit191396c96db9edd2abec9d1d789f39a5cbee81f6 (patch)
treebc34c753b4fda8db70391e0b39d6557cf408b4e7
parent419ea7ec6a528cea0b0d7fc4a7150f01fca9a93d (diff)
adjust to a change in the LLVM APIs, this is still very hackish until
the front-end adopts APFloat though. This fixes test/CodeGen/mandel.c git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41908 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CodeGen/CGExprScalar.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp
index 9c2e55f6ea..62137b03b7 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -93,7 +93,13 @@ public:
return llvm::ConstantInt::get(E->getValue());
}
Value *VisitFloatingLiteral(const FloatingLiteral *E) {
- return llvm::ConstantFP::get(ConvertType(E->getType()), E->getValue());
+ double V = E->getValue();
+ // FIXME: Change this when FloatingLiteral uses an APFloat internally.
+ const llvm::Type *Ty = ConvertType(E->getType());
+ if (Ty == llvm::Type::FloatTy)
+ return llvm::ConstantFP::get(Ty, llvm::APFloat((float)V));
+ assert(Ty == llvm::Type::DoubleTy && "Unknown float type!");
+ return llvm::ConstantFP::get(Ty, llvm::APFloat((double)V));
}
Value *VisitCharacterLiteral(const CharacterLiteral *E) {
return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());