diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-25 17:56:43 +0000 | 
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-25 17:56:43 +0000 | 
| commit | 9a207ee4dc85e08be4935f3f972e066314f680e2 (patch) | |
| tree | 6e193587219472383a81a37a0d2c13a7a400a66f /clang/lib/AST/Expr.cpp | |
| parent | 910046d17472e7d4396059a7199958b82c0751c0 (diff) | |
| download | bcm5719-llvm-9a207ee4dc85e08be4935f3f972e066314f680e2.tar.gz bcm5719-llvm-9a207ee4dc85e08be4935f3f972e066314f680e2.zip | |
Patch to allow over-riding of readonly property to 
a writable property in one of its category.
llvm-svn: 60035
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 22 | 
1 files changed, 18 insertions, 4 deletions
| diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 835a467fc21..56f08b28d95 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -551,14 +551,28 @@ Expr::isModifiableLvalueResult Expr::isModifiableLvalue(ASTContext &Ctx) const {    if (getStmtClass() == ObjCPropertyRefExprClass) {      const ObjCPropertyRefExpr* PropExpr = cast<ObjCPropertyRefExpr>(this);      if (ObjCPropertyDecl *PDecl = PropExpr->getProperty()) { -      ObjCPropertyDecl::PropertyAttributeKind Pkind =  -        PDecl->getPropertyAttributes(); -      if (Pkind == ObjCPropertyDecl::OBJC_PR_readonly) +      if (PDecl->isReadOnly()) { +        // Main class has the property as 'readyonly'. Must search +        // through the category list to see if the property's  +        // attribute has been over-ridden to 'readwrite'. +        const Expr *BaseExpr = PropExpr->getBase(); +        QualType BaseType = BaseExpr->getType(); +        const PointerType *PTy = BaseType->getAsPointerType(); +        const ObjCInterfaceType *IFTy =  +          PTy->getPointeeType()->getAsObjCInterfaceType(); +        ObjCInterfaceDecl *IFace = IFTy->getDecl(); +        for (ObjCCategoryDecl *Category = IFace->getCategoryList(); +             Category; Category = Category->getNextClassCategory()) { +          PDecl= Category->FindPropertyDeclaration(PDecl->getIdentifier()); +          if (PDecl && !PDecl->isReadOnly()) +            return MLV_Valid; +        }          return MLV_ReadonlyProperty; +      }      }    }    // Assigning to an 'implicit' property? -  if (getStmtClass() == ObjCKVCRefExprClass) { +  else if (getStmtClass() == ObjCKVCRefExprClass) {      const ObjCKVCRefExpr* KVCExpr = cast<ObjCKVCRefExpr>(this);      if (KVCExpr->getSetterMethod() == 0)        return MLV_NoSetterProperty; | 

