aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-26 20:52:22 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-26 20:52:22 +0000
commit8958891f5fa1e593c4519a36b3df427ee019d70b (patch)
treef57fc5020048e30615e3ed3a817d5a8ffe148af3 /lib/AST/ExprConstant.cpp
parent3daea0a051d90f8ff660a6392f0112a0e78e6dba (diff)
Add Type::hasPointerRepresentation predicate.
- For types whose native representation is a pointer. - Use to replace ExprConstant.cpp:HasPointerEvalType, CodeGenFunction::isObjCPointerType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65569 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 6899b61703..5cfc6e6ab3 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -279,14 +279,8 @@ public:
};
} // end anonymous namespace
-static bool HasPointerEvalType(const Expr* E) {
- return E->getType()->isPointerType()
- || E->getType()->isBlockPointerType()
- || E->getType()->isObjCQualifiedIdType();
-}
-
static bool EvaluatePointer(const Expr* E, APValue& Result, EvalInfo &Info) {
- if (!HasPointerEvalType(E))
+ if (!E->getType()->hasPointerRepresentation())
return false;
Result = PointerExprEvaluator(Info).Visit(const_cast<Expr*>(E));
return Result.isLValue();
@@ -1570,7 +1564,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 (HasPointerEvalType(this)) {
+ } else if (getType()->hasPointerRepresentation()) {
if (!EvaluatePointer(this, Result.Val, Info))
return false;
} else if (getType()->isRealFloatingType()) {