diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-02-22 04:02:33 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-02-22 04:02:33 +0000 |
commit | 4bdf08770e75a068de2430e21a43b381aeb13b95 (patch) | |
tree | a7f2fbd43f33ce6fe21f60e713a9f3f92bf3dc10 /lib/AST/ExprConstant.cpp | |
parent | c508203a278f6a9238fff46ae1f025b4b402b233 (diff) |
Enhance Evaluate to handle ObjC qualified id and class types; as far as
I know, these follow the exact same rules as pointers, so I just made
them use the same codepath. Someone more familiar with ObjC should
double-check this, though.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 13 |
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()) { |