summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-06 05:53:16 +0000
committerChris Lattner <sabre@nondot.org>2008-10-06 05:53:16 +0000
commit37346e081c47a7a9921baf568cd4299cb85813b5 (patch)
tree9b06194ef1c3485ca478444d57a8261412b1dc51 /clang
parentc43467526d90f9e8cbcfd14e5c64f608a4fce505 (diff)
downloadbcm5719-llvm-37346e081c47a7a9921baf568cd4299cb85813b5.tar.gz
bcm5719-llvm-37346e081c47a7a9921baf568cd4299cb85813b5.zip
Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.
llvm-svn: 57154
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ExprConstant.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 45724d318c9..c20cf4c0c5a 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -543,17 +543,19 @@ static bool EvaluateFloat(const Expr* E, APFloat& Result, EvalInfo &Info) {
}
bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
- //Result.zextOrTrunc(getIntTypeSizeInBits(E->getType()));
+ const llvm::fltSemantics &Sem =
+ Info.Ctx.getFloatTypeSemantics(E->getType());
switch (E->isBuiltinCall()) {
+ default: return false;
case Builtin::BI__builtin_huge_val:
case Builtin::BI__builtin_huge_valf:
case Builtin::BI__builtin_huge_vall:
case Builtin::BI__builtin_inf:
case Builtin::BI__builtin_inff:
case Builtin::BI__builtin_infl:
- // FIXME: Implement me.
- default: return false;
+ Result = llvm::APFloat::getInf(Sem);
+ return true;
}
}
OpenPOWER on IntegriCloud