From: Mike Stump Date: Mon, 26 Oct 2009 18:57:47 +0000 (+0000) Subject: Be sure to zero-extend. And refactor. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fc8758077ced5cdc11f30a5ed07e9af71d5787a;p=clang Be sure to zero-extend. And refactor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85140 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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); }