[llvm-branch-commits] [cfe-branch] r122856 - in /cfe/branches/Apple/whitney: lib/Sema/SemaExpr.cpp lib/Sema/SemaObjCProperty.cpp test/CodeGenObjC/interface-layout-64.m test/SemaObjC/synthesized-ivar.m

Daniel Dunbar daniel at zuster.org
Tue Jan 4 18:19:41 PST 2011


Author: ddunbar
Date: Tue Jan  4 20:19:41 2011
New Revision: 122856

URL: http://llvm.org/viewvc/llvm-project?rev=122856&view=rev
Log:
Merge r121913:
--
Author: Fariborz Jahanian <fjahanian at apple.com>
Date:   Wed Dec 15 23:29:04 2010 +0000

    ivars craeted for explicit @synthesize and those
    created for auto-synthesis are @private.
    Fixes: // rdar://8769582

Modified:
    cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp
    cfe/branches/Apple/whitney/lib/Sema/SemaObjCProperty.cpp
    cfe/branches/Apple/whitney/test/CodeGenObjC/interface-layout-64.m
    cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp?rev=122856&r1=122855&r2=122856&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp Tue Jan  4 20:19:41 2011
@@ -1101,7 +1101,7 @@
     ObjCIvarDecl *Ivar = ObjCIvarDecl::Create(SemaRef.Context, ClassImpDecl, 
                                               NameLoc,
                                               II, PropType, /*Dinfo=*/0,
-                                              ObjCIvarDecl::Protected,
+                                              ObjCIvarDecl::Private,
                                               (Expr *)0, true);
     ClassImpDecl->addDecl(Ivar);
     IDecl->makeDeclVisibleInContext(Ivar, false);

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaObjCProperty.cpp?rev=122856&r1=122855&r2=122856&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaObjCProperty.cpp Tue Jan  4 20:19:41 2011
@@ -395,7 +395,7 @@
     if (!Ivar) {
       Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl, PropertyLoc,
                                   PropertyIvar, PropType, /*Dinfo=*/0,
-                                  ObjCIvarDecl::Protected,
+                                  ObjCIvarDecl::Private,
                                   (Expr *)0, true);
       ClassImpDecl->addDecl(Ivar);
       IDecl->makeDeclVisibleInContext(Ivar, false);

Modified: cfe/branches/Apple/whitney/test/CodeGenObjC/interface-layout-64.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeGenObjC/interface-layout-64.m?rev=122856&r1=122855&r2=122856&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeGenObjC/interface-layout-64.m (original)
+++ cfe/branches/Apple/whitney/test/CodeGenObjC/interface-layout-64.m Tue Jan  4 20:19:41 2011
@@ -5,8 +5,8 @@
 // RUN: grep '@"OBJC_IVAR_$_I3._iv3" = global i64 12, section "__DATA, __objc_const", align 8' %t
 // RUN: grep '@"OBJC_IVAR_$_I4._iv4" = global i64 13, section "__DATA, __objc_const", align 8' %t
 // RUN: grep '@"OBJC_IVAR_$_I5._iv5" = global i64 14, section "__DATA, __objc_const", align 8' %t
-// RUN: grep '@"OBJC_IVAR_$_I5._iv6_synth" = global i64 16, section "__DATA, __objc_const", align 8' %t
-// RUN: grep '@"OBJC_IVAR_$_I5._iv7_synth" = global i64 20, section "__DATA, __objc_const", align 8' %t
+// RUN: grep '@"OBJC_IVAR_$_I5._iv6_synth" = hidden global i64 16, section "__DATA, __objc_const", align 8' %t
+// RUN: grep '@"OBJC_IVAR_$_I5._iv7_synth" = hidden global i64 20, section "__DATA, __objc_const", align 8' %t
 // RUN: grep '@"OBJC_IVAR_$_I6.iv0" = global i64 0, section "__DATA, __objc_const", align 8' %t
 // RUN: grep '@"OBJC_IVAR_$_I8.b" = global i64 8, section "__DATA, __objc_const", align 8' %t
 // RUN: grep '@"OBJC_IVAR_$_I9.iv0" = global i64 0, section "__DATA, __objc_const", align 8' %t

Modified: cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m?rev=122856&r1=122855&r2=122856&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m (original)
+++ cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m Tue Jan  4 20:19:41 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
 @interface I
 {
 }
@@ -13,4 +13,41 @@
 @end
 
 // rdar: // 7823675
-int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is protected}}
+int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is private}}
+
+// rdar://8769582
+
+ at interface I1 {
+ int protected_ivar;
+}
+ at property int PROP_INMAIN;
+ at end
+
+ at interface I1() {
+ int private_ivar;
+}
+ at property int PROP_INCLASSEXT;
+ at end
+
+ at implementation I1
+- (int) Meth {
+   PROP_INMAIN = 1;
+   PROP_INCLASSEXT = 2;
+   protected_ivar = 1;	// OK
+   return private_ivar; // OK
+}
+ at end
+
+
+ at interface DER : I1
+ at end
+
+ at implementation DER
+- (int) Meth {
+   protected_ivar = 1;	// OK
+   PROP_INMAIN = 1; // expected-error {{instance variable 'PROP_INMAIN' is private}}
+   PROP_INCLASSEXT = 2; // expected-error {{instance variable 'PROP_INCLASSEXT' is private}}
+   return private_ivar; // expected-error {{instance variable 'private_ivar' is private}}
+}
+ at end
+





More information about the llvm-branch-commits mailing list