aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-01-19 22:58:35 +0000
committerEric Christopher <echristo@apple.com>2010-01-19 22:58:35 +0000
commitb2aaf51ed73a4774322a39a0dd59d0fe7e3258c0 (patch)
tree1ea4fbe1ee418edaabd7d8bf869eeed0f3f9d98d
parent1d7d8d66eff7ed0f3e957d330930cc9ab8047add (diff)
Update and move around comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93942 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ExprConstant.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index dfff2099cb..c8d4e2b2b6 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -971,6 +971,8 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
case Builtin::BI__builtin_object_size: {
const Expr *Arg = E->getArg(0)->IgnoreParens();
Expr::EvalResult Base;
+
+ // TODO: Perhaps we should let LLVM lower this?
if (Arg->EvaluateAsAny(Base, Info.Ctx)
&& Base.Val.getKind() == APValue::LValue
&& !Base.HasSideEffects)
@@ -992,7 +994,8 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
}
}
- // TODO: Perhaps we should let LLVM lower this?
+ // If evaluating the argument has side-effects we can't determine
+ // the size of the object and lower it to unknown now.
if (E->getArg(0)->HasSideEffects(Info.Ctx)) {
if (E->getArg(1)->EvaluateAsInt(Info.Ctx).getZExtValue() <= 1)
return Success(-1ULL, E);