diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-27 16:10:05 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-27 16:10:05 +0000 |
commit | c737acb8e86564becc5939d681089d1851e6be1a (patch) | |
tree | fd98affb4b15cfae12b3ac0cc8f378e0f7b7eb9e /lib/Sema/SemaExpr.cpp | |
parent | 7f9b58b171ea24a5ed14dddb43fe057abcad0ece (diff) |
Revert r139989 and r140031, which implemented the Objective-C type
system change in <rdar://problem/10109725> that allows conversion from
'self' in class methods to the root of the class's hierarchy. This
conversion rule is a hack that has non-trivial repurcussions
(particularly with overload resolution).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 3397680ee1..2a9abd4b38 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -5107,25 +5107,6 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, OK)); } -/// ConvertObjCSelfToClassRootType - convet type of 'self' in class method -/// to pointer to root of method's class. -static QualType -ConvertObjCSelfToClassRootType(Sema &S, Expr *selfExpr) { - QualType SelfType; - if (const ObjCMethodDecl *MD = S.GetMethodIfSelfExpr(selfExpr)) - if (MD->isClassMethod()) { - const ObjCInterfaceDecl *Root = 0; - if (const ObjCInterfaceDecl * IDecl = MD->getClassInterface()) - do { - Root = IDecl; - } while ((IDecl = IDecl->getSuperClass())); - if (Root) - SelfType = S.Context.getObjCObjectPointerType( - S.Context.getObjCInterfaceType(Root)); - } - return SelfType; -} - // checkPointerTypesForAssignment - This is a very tricky routine (despite // being closely modeled after the C99 spec:-). The odd characteristic of this // routine is it effectively iqnores the qualifiers on the top level pointee. @@ -5453,7 +5434,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, Kind = CK_BitCast; return Compatible; } - + Kind = CK_BitCast; return IncompatiblePointer; } @@ -5501,9 +5482,6 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // Conversions to Objective-C pointers. if (isa<ObjCObjectPointerType>(LHSType)) { - QualType RHSQT = ConvertObjCSelfToClassRootType(*this, RHS.get()); - if (!RHSQT.isNull()) - RHSType = RHSQT; // A* -> B* if (RHSType->isObjCObjectPointerType()) { Kind = CK_BitCast; @@ -9619,7 +9597,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) { Selector Sel = ME->getSelector(); // self = [<foo> init...] - if (GetMethodIfSelfExpr(Op->getLHS()) && Sel.getNameForSlot(0).startswith("init")) + if (isSelfExpr(Op->getLHS()) && Sel.getNameForSlot(0).startswith("init")) diagnostic = diag::warn_condition_is_idiomatic_assignment; // <foo> = [<bar> nextObject] |