aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 103bc37f4f..8f43700e46 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -279,9 +279,15 @@ public:
};
} // end anonymous namespace
+static bool HasPointerEvalType(const Expr* E) {
+ return E->getType()->isPointerType()
+ || E->getType()->isBlockPointerType()
+ || E->getType()->isObjCQualifiedIdType()
+ || E->getType()->isObjCQualifiedClassType();
+}
+
static bool EvaluatePointer(const Expr* E, APValue& Result, EvalInfo &Info) {
- if (!E->getType()->isPointerType()
- && !E->getType()->isBlockPointerType())
+ if (!HasPointerEvalType(E))
return false;
Result = PointerExprEvaluator(Info).Visit(const_cast<Expr*>(E));
return Result.isLValue();
@@ -1519,8 +1525,7 @@ bool Expr::Evaluate(EvalResult &Result, ASTContext &Ctx) const {
} else if (getType()->isIntegerType()) {
if (!IntExprEvaluator(Info, Result.Val).Visit(const_cast<Expr*>(this)))
return false;
- } else if (getType()->isPointerType()
- || getType()->isBlockPointerType()) {
+ } else if (HasPointerEvalType(this)) {
if (!EvaluatePointer(this, Result.Val, Info))
return false;
} else if (getType()->isRealFloatingType()) {