[llvm-branch-commits] [cfe-branch] r81771 - in /cfe/branches/Apple/Dib: lib/AST/Expr.cpp test/SemaObjC/property-error-readonly-assign.m

Fariborz Jahanian fjahanian at apple.com
Mon Sep 14 09:54:14 PDT 2009


Author: fjahanian
Date: Mon Sep 14 11:54:14 2009
New Revision: 81771

URL: http://llvm.org/viewvc/llvm-project?rev=81771&view=rev
Log:
Merged fix for radar 7203680 into the Dib branch.


Modified:
    cfe/branches/Apple/Dib/lib/AST/Expr.cpp
    cfe/branches/Apple/Dib/test/SemaObjC/property-error-readonly-assign.m

Modified: cfe/branches/Apple/Dib/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/AST/Expr.cpp?rev=81771&r1=81770&r2=81771&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/AST/Expr.cpp (original)
+++ cfe/branches/Apple/Dib/lib/AST/Expr.cpp Mon Sep 14 11:54:14 2009
@@ -861,6 +861,12 @@
     if (!BDR->isByRef() && isa<VarDecl>(BDR->getDecl()))
       return MLV_NotBlockQualified;
   }
+  // Assigning to an 'implicit' property?
+  if (isa<ObjCKVCRefExpr>(this)) {
+    const ObjCKVCRefExpr* KVCExpr = cast<ObjCKVCRefExpr>(this);
+    if (KVCExpr->getSetterMethod() == 0)
+      return MLV_NoSetterProperty;
+  }
 
   QualType CT = Ctx.getCanonicalType(getType());
   
@@ -876,12 +882,6 @@
       return MLV_ConstQualified;
   }
   
-  // Assigning to an 'implicit' property?
-  else if (isa<ObjCKVCRefExpr>(this)) {
-    const ObjCKVCRefExpr* KVCExpr = cast<ObjCKVCRefExpr>(this);
-    if (KVCExpr->getSetterMethod() == 0)
-      return MLV_NoSetterProperty;
-  }
   return MLV_Valid;    
 }
 

Modified: cfe/branches/Apple/Dib/test/SemaObjC/property-error-readonly-assign.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/SemaObjC/property-error-readonly-assign.m?rev=81771&r1=81770&r2=81771&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/SemaObjC/property-error-readonly-assign.m (original)
+++ cfe/branches/Apple/Dib/test/SemaObjC/property-error-readonly-assign.m Mon Sep 14 11:54:14 2009
@@ -19,3 +19,26 @@
   b.ok = 20;
 }
 
+typedef struct {
+  int i1, i2;
+} NSRect;
+
+NSRect NSMakeRect();
+
+ at interface NSWindow 
+{
+    NSRect _frame;
+}
+- (NSRect)frame;
+ at end
+
+ at interface NSWindow (Category)
+-(void)methodToMakeClangCrash;
+ at end
+
+ at implementation NSWindow (Category)
+-(void)methodToMakeClangCrash
+{
+ self.frame =  NSMakeRect(); // expected-error {{setter method is needed to assign to object using property assignment syntax}}
+}
+ at end





More information about the llvm-branch-commits mailing list