diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-02-26 20:52:22 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-26 20:52:22 +0000 |
commit | 76ba41ce4fa0f614d8f56f8c3b1c13a2c74c1d85 (patch) | |
tree | 4fddd937d03dbb09cdb48159291e2c434743cd12 /clang/lib/AST/ExprConstant.cpp | |
parent | 8b09ad17f90dad6e7873bc8e45b42f30c724eb1a (diff) | |
download | bcm5719-llvm-76ba41ce4fa0f614d8f56f8c3b1c13a2c74c1d85.tar.gz bcm5719-llvm-76ba41ce4fa0f614d8f56f8c3b1c13a2c74c1d85.zip |
Add Type::hasPointerRepresentation predicate.
- For types whose native representation is a pointer.
- Use to replace ExprConstant.cpp:HasPointerEvalType,
CodeGenFunction::isObjCPointerType.
llvm-svn: 65569
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 6899b617036..5cfc6e6ab31 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/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()) { |