[cfe-commits] r65261 - in /cfe/trunk/lib/AST: ASTContext.cpp ExprConstant.cpp
Eli Friedman
eli.friedman at gmail.com
Sat Feb 21 20:02:36 PST 2009
Author: efriedma
Date: Sat Feb 21 22:02:33 2009
New Revision: 65261
URL: http://llvm.org/viewvc/llvm-project?rev=65261&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=65261&r1=65260&r2=65261&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sat Feb 21 22:02:33 2009
@@ -387,6 +387,7 @@
// alignment requirements: getPointerInfo should take an AddrSpace.
return getTypeInfo(QualType(cast<ExtQualType>(T)->getBaseType(), 0));
case Type::ObjCQualifiedId:
+ case Type::ObjCQualifiedClass:
Width = Target.getPointerWidth(0);
Align = Target.getPointerAlign(0);
break;
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=65261&r1=65260&r2=65261&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sat Feb 21 22:02:33 2009
@@ -279,9 +279,15 @@
};
} // 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 @@
} 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()) {
More information about the cfe-commits
mailing list