From 642038d7c5855b54afbca298631da93b7889d4a5 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 27 Jun 2013 01:36:36 +0000 Subject: [PATCH] Delete dead code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185053 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Expr.h | 1 - include/clang/Sema/Sema.h | 6 -- lib/Sema/SemaExpr.cpp | 27 +-------- lib/Sema/SemaObjCProperty.cpp | 104 ---------------------------------- 4 files changed, 1 insertion(+), 137 deletions(-) diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 3411e0f8b7..d035fbdf66 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -277,7 +277,6 @@ public: MLV_IncompleteType, MLV_ConstQualified, MLV_ArrayType, - MLV_ReadonlyProperty, MLV_NoSetterProperty, MLV_MemberFunction, MLV_SubObjCPropertySetting, diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 23623a43a8..f9846361e5 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2499,9 +2499,6 @@ public: ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl); - bool isPropertyReadonly(ObjCPropertyDecl *PropertyDecl, - ObjCInterfaceDecl *IDecl); - typedef llvm::SmallPtrSet SelectorSet; typedef llvm::DenseMap ProtocolsMethodsMap; @@ -6428,9 +6425,6 @@ public: void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID); - void MatchOneProtocolPropertiesInClass(Decl *CDecl, - ObjCProtocolDecl *PDecl); - Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd, Decl **allMethods = 0, unsigned allNum = 0, Decl **allProperties = 0, unsigned pNum = 0, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 218eeef71a..3e7e146342 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -7872,28 +7872,6 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] return Context.BoolTy; } -/// IsReadonlyProperty - Verify that otherwise a valid l-value expression -/// is a read-only property; return true if so. A readonly property expression -/// depends on various declarations and thus must be treated specially. -/// -static bool IsReadonlyProperty(Expr *E, Sema &S) { - const ObjCPropertyRefExpr *PropExpr = dyn_cast(E); - if (!PropExpr) return false; - if (PropExpr->isImplicitProperty()) return false; - - ObjCPropertyDecl *PDecl = PropExpr->getExplicitProperty(); - QualType BaseType = PropExpr->isSuperReceiver() ? - PropExpr->getSuperReceiverType() : - PropExpr->getBase()->getType(); - - if (const ObjCObjectPointerType *OPT = - BaseType->getAsObjCInterfacePointerType()) - if (ObjCInterfaceDecl *IFace = OPT->getInterfaceDecl()) - if (S.isPropertyReadonly(PDecl, IFace)) - return true; - return false; -} - static bool IsReadonlyMessage(Expr *E, Sema &S) { const MemberExpr *ME = dyn_cast(E); if (!ME) return false; @@ -7937,9 +7915,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) { SourceLocation OrigLoc = Loc; Expr::isModifiableLvalueResult IsLV = E->isModifiableLvalue(S.Context, &Loc); - if (IsLV == Expr::MLV_Valid && IsReadonlyProperty(E, S)) - IsLV = Expr::MLV_ReadonlyProperty; - else if (IsLV == Expr::MLV_ClassTemporary && IsReadonlyMessage(E, S)) + if (IsLV == Expr::MLV_ClassTemporary && IsReadonlyMessage(E, S)) IsLV = Expr::MLV_InvalidMessageExpression; if (IsLV == Expr::MLV_Valid) return false; @@ -8022,7 +7998,6 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) { case Expr::MLV_DuplicateVectorComponents: Diag = diag::err_typecheck_duplicate_vector_components_not_mlvalue; break; - case Expr::MLV_ReadonlyProperty: case Expr::MLV_NoSetterProperty: llvm_unreachable("readonly properties should be processed differently"); case Expr::MLV_InvalidMessageExpression: diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 90abe7fd52..7b8aba957d 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -1445,110 +1445,6 @@ bool Sema::DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *property, return false; } -/// MatchOneProtocolPropertiesInClass - This routine goes thru the list -/// of properties declared in a protocol and compares their attribute against -/// the same property declared in the class or category. -void -Sema::MatchOneProtocolPropertiesInClass(Decl *CDecl, ObjCProtocolDecl *PDecl) { - if (!CDecl) - return; - - // Category case. - if (ObjCCategoryDecl *CatDecl = dyn_cast(CDecl)) { - // FIXME: We should perform this check when the property in the category - // is declared. - assert (CatDecl && "MatchOneProtocolPropertiesInClass"); - if (!CatDecl->IsClassExtension()) - for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), - E = PDecl->prop_end(); P != E; ++P) { - ObjCPropertyDecl *ProtoProp = *P; - DeclContext::lookup_result R - = CatDecl->lookup(ProtoProp->getDeclName()); - for (unsigned I = 0, N = R.size(); I != N; ++I) { - if (ObjCPropertyDecl *CatProp = dyn_cast(R[I])) { - if (CatProp != ProtoProp) { - // Property protocol already exist in class. Diagnose any mismatch. - DiagnosePropertyMismatch(CatProp, ProtoProp, - PDecl->getIdentifier()); - } - } - } - } - return; - } - - // Class - // FIXME: We should perform this check when the property in the class - // is declared. - ObjCInterfaceDecl *IDecl = cast(CDecl); - for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), - E = PDecl->prop_end(); P != E; ++P) { - ObjCPropertyDecl *ProtoProp = *P; - DeclContext::lookup_result R - = IDecl->lookup(ProtoProp->getDeclName()); - for (unsigned I = 0, N = R.size(); I != N; ++I) { - if (ObjCPropertyDecl *ClassProp = dyn_cast(R[I])) { - if (ClassProp != ProtoProp) { - // Property protocol already exist in class. Diagnose any mismatch. - DiagnosePropertyMismatch(ClassProp, ProtoProp, - PDecl->getIdentifier()); - } - } - } - } -} - -/// isPropertyReadonly - Return true if property is readonly, by searching -/// for the property in the class and in its categories and implementations -/// -bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, - ObjCInterfaceDecl *IDecl) { - // by far the most common case. - if (!PDecl->isReadOnly()) - return false; - // Even if property is ready only, if interface has a user defined setter, - // it is not considered read only. - if (IDecl->getInstanceMethod(PDecl->getSetterName())) - return false; - - // Main class has the property as 'readonly'. Must search - // through the category list to see if the property's - // attribute has been over-ridden to 'readwrite'. - for (ObjCInterfaceDecl::visible_categories_iterator - Cat = IDecl->visible_categories_begin(), - CatEnd = IDecl->visible_categories_end(); - Cat != CatEnd; ++Cat) { - if (Cat->getInstanceMethod(PDecl->getSetterName())) - return false; - ObjCPropertyDecl *P = - Cat->FindPropertyDeclaration(PDecl->getIdentifier()); - if (P && !P->isReadOnly()) - return false; - } - - // Also, check for definition of a setter method in the implementation if - // all else failed. - if (ObjCMethodDecl *OMD = dyn_cast(CurContext)) { - if (ObjCImplementationDecl *IMD = - dyn_cast(OMD->getDeclContext())) { - if (IMD->getInstanceMethod(PDecl->getSetterName())) - return false; - } else if (ObjCCategoryImplDecl *CIMD = - dyn_cast(OMD->getDeclContext())) { - if (CIMD->getInstanceMethod(PDecl->getSetterName())) - return false; - } - } - // Lastly, look through the implementation (if one is in scope). - if (ObjCImplementationDecl *ImpDecl = IDecl->getImplementation()) - if (ImpDecl->getInstanceMethod(PDecl->getSetterName())) - return false; - // If all fails, look at the super class. - if (ObjCInterfaceDecl *SIDecl = IDecl->getSuperClass()) - return isPropertyReadonly(PDecl, SIDecl); - return true; -} - /// CollectImmediateProperties - This routine collects all properties in /// the class and its conforming protocols; but not those in its super class. void Sema::CollectImmediateProperties(ObjCContainerDecl *CDecl, -- 2.50.1