Adjust calls to APFloat conversion for new interface.

llvm-svn: 57332
This commit is contained in:
Dale Johannesen 2008-10-09 23:02:32 +00:00
parent 62a2e5cb2f
commit c48814bc98
3 changed files with 13 additions and 6 deletions

View File

@ -29,7 +29,9 @@ using namespace clang;
/// debugging dumps, etc. /// debugging dumps, etc.
double FloatingLiteral::getValueAsApproximateDouble() const { double FloatingLiteral::getValueAsApproximateDouble() const {
llvm::APFloat V = getValue(); llvm::APFloat V = getValue();
V.convert(llvm::APFloat::IEEEdouble, llvm::APFloat::rmNearestTiesToEven); bool ignored;
V.convert(llvm::APFloat::IEEEdouble, llvm::APFloat::rmNearestTiesToEven,
&ignored);
return V.convertToDouble(); return V.convertToDouble();
} }
@ -977,9 +979,11 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
// TODO: Warn on overflow, but probably not here: isIntegerConstantExpr can // TODO: Warn on overflow, but probably not here: isIntegerConstantExpr can
// be called multiple times per AST. // be called multiple times per AST.
uint64_t Space[4]; uint64_t Space[4];
bool ignored;
(void)FL->getValue().convertToInteger(Space, DestWidth, DestSigned, (void)FL->getValue().convertToInteger(Space, DestWidth, DestSigned,
llvm::APFloat::rmTowardZero); llvm::APFloat::rmTowardZero,
&ignored);
Result = llvm::APInt(DestWidth, 4, Space); Result = llvm::APInt(DestWidth, 4, Space);
break; break;
} }

View File

@ -557,9 +557,10 @@ bool IntExprEvaluator::HandleCast(SourceLocation CastLoc,
bool DestSigned = DestType->isSignedIntegerType(); bool DestSigned = DestType->isSignedIntegerType();
// FIXME: Warning for overflow. // FIXME: Warning for overflow.
uint64_t Space[4]; uint64_t Space[4];
bool ignored;
(void)F.convertToInteger(Space, DestWidth, DestSigned, (void)F.convertToInteger(Space, DestWidth, DestSigned,
llvm::APFloat::rmTowardZero); llvm::APFloat::rmTowardZero, &ignored);
Result = llvm::APInt(DestWidth, 4, Space); Result = llvm::APInt(DestWidth, 4, Space);
Result.setIsUnsigned(!DestSigned); Result.setIsUnsigned(!DestSigned);
return true; return true;

View File

@ -605,7 +605,9 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
llvm::ConstantFP::get(llvm::APFloat(static_cast<double>(AmountVal))); llvm::ConstantFP::get(llvm::APFloat(static_cast<double>(AmountVal)));
else { else {
llvm::APFloat F(static_cast<float>(AmountVal)); llvm::APFloat F(static_cast<float>(AmountVal));
F.convert(CGF.Target.getLongDoubleFormat(), llvm::APFloat::rmTowardZero); bool ignored;
F.convert(CGF.Target.getLongDoubleFormat(), llvm::APFloat::rmTowardZero,
&ignored);
NextVal = llvm::ConstantFP::get(F); NextVal = llvm::ConstantFP::get(F);
} }
NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec"); NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");