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
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp
index 9c2e55f..62137b0 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -93,7 +93,13 @@
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());