aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-07-07 05:08:32 +0000
committerJohn McCall <rjmccall@apple.com>2010-07-07 05:08:32 +0000
commit0f2b692bb10be35fdc60d0a72a847bdd73124670 (patch)
tree0c611c43ddba0af4edde19b4d6f54447e3ead36b /lib/AST/ExprConstant.cpp
parentc34c2116346a29869b47b190f6dea589823d6947 (diff)
Don't consider casted non-global pointers to be evaluatable.
Fixes rdar://problem/8154689 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index bec3792000..5dae4d4475 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -2210,6 +2210,8 @@ bool Expr::Evaluate(EvalResult &Result, ASTContext &Ctx) const {
} else if (E->getType()->isIntegerType()) {
if (!IntExprEvaluator(Info, Info.EvalResult.Val).Visit(const_cast<Expr*>(E)))
return false;
+ if (Result.Val.isLValue() && !IsGlobalLValue(Result.Val.getLValueBase()))
+ return false;
} else if (E->getType()->hasPointerRepresentation()) {
LValue LV;
if (!EvaluatePointer(E, LV, Info))