diff options
author | Mike Stump <mrs@apple.com> | 2009-10-26 18:57:47 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-10-26 18:57:47 +0000 |
commit | 4fc8758077ced5cdc11f30a5ed07e9af71d5787a (patch) | |
tree | 0006f52a0cac51d0d4c4611ad4044dc71ea5605f /lib/AST/ExprConstant.cpp | |
parent | 64eda9e50b593f935c95bd1edc98c4bfda03f601 (diff) |
Be sure to zero-extend. And refactor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 9129558421..f1a446ef6e 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -875,11 +875,6 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) { return Error(E->getLocStart(), diag::note_invalid_subexpr_in_ice, E); case Builtin::BI__builtin_object_size: { - llvm::APSInt Result(32); - - if (!E->getArg(1)->isIntegerConstantExpr(Result, Info.Ctx)) - assert(0 && "arg2 not ice in __builtin_object_size"); - const Expr *Arg = E->getArg(0)->IgnoreParens(); Expr::EvalResult Base; if (Arg->Evaluate(Base, Info.Ctx) @@ -895,7 +890,7 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) { } if (Base.HasSideEffects) { - if (Result.getSExtValue() < 2) + if (E->getArg(1)->EvaluateAsInt(Info.Ctx).getZExtValue() < 2) return Success(-1, E); return Success(0, E); } |