[cfe-commits] r45244 - in /cfe/trunk: Sema/SemaChecking.cpp Sema/SemaExpr.cpp include/clang/AST/Type.h
Fariborz Jahanian
fjahanian at apple.com
Wed Dec 19 17:06:58 PST 2007
Author: fjahanian
Date: Wed Dec 19 19:06:58 2007
New Revision: 45244
URL: http://llvm.org/viewvc/llvm-project?rev=45244&view=rev
Log:
More objective-c typechecking stuff. This is work in progress and more patches
are due to arrive.
Modified:
cfe/trunk/Sema/SemaChecking.cpp
cfe/trunk/Sema/SemaExpr.cpp
cfe/trunk/include/clang/AST/Type.h
Modified: cfe/trunk/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaChecking.cpp?rev=45244&r1=45243&r2=45244&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/Sema/SemaChecking.cpp Wed Dec 19 19:06:58 2007
@@ -594,7 +594,9 @@
static DeclRefExpr* EvalAddr(Expr *E) {
// We should only be called for evaluating pointer expressions.
- assert (E->getType()->isPointerType() && "EvalAddr only works on pointers");
+ assert ((E->getType()->isPointerType() ||
+ E->getType()->isObjcQualifiedIdType())
+ && "EvalAddr only works on pointers");
// Our "symbolic interpreter" is just a dispatch off the currently
// viewed AST node. We then recursively traverse the AST by calling
@@ -654,7 +656,8 @@
ImplicitCastExpr *IE = cast<ImplicitCastExpr>(E);
Expr* SubExpr = IE->getSubExpr();
- if (SubExpr->getType()->isPointerType())
+ if (SubExpr->getType()->isPointerType() ||
+ SubExpr->getType()->isObjcQualifiedIdType())
return EvalAddr(SubExpr);
else
return EvalVal(SubExpr);
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=45244&r1=45243&r2=45244&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Wed Dec 19 19:06:58 2007
@@ -1399,6 +1399,11 @@
promoteExprToType(rex, lType); // promote the pointer to pointer
return Context.IntTy;
}
+ if ((lType->isObjcQualifiedIdType() || rType->isObjcQualifiedIdType())
+ && Context.ObjcQualifiedIdTypesAreCompatible(lType, rType)) {
+ promoteExprToType(rex, lType);
+ return Context.IntTy;
+ }
if (lType->isPointerType() && rType->isIntegerType()) {
if (!RHSIsNull)
Diag(loc, diag::ext_typecheck_comparison_of_pointer_integer,
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=45244&r1=45243&r2=45244&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Dec 19 19:06:58 2007
@@ -1029,8 +1029,7 @@
return isa<FunctionType>(CanonicalType);
}
inline bool Type::isPointerType() const {
- return isa<PointerType>(CanonicalType) ||
- isa<ObjcQualifiedIdType>(CanonicalType);
+ return isa<PointerType>(CanonicalType);
}
inline bool Type::isFunctionPointerType() const {
if (const PointerType* T = getAsPointerType())
More information about the cfe-commits
mailing list