[cfe-commits] r147504 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/ClassPropertyNotObject.m

Fariborz Jahanian fjahanian at apple.com
Tue Jan 3 16:31:53 PST 2012


Author: fjahanian
Date: Tue Jan  3 18:31:53 2012
New Revision: 147504

URL: http://llvm.org/viewvc/llvm-project?rev=147504&view=rev
Log:
In non-gc, non-arc mode, property of 'Class' type
variety is treated as a 'void *'. No need to issue
warning reserved for objc object properties.
// rdar://10565506

Added:
    cfe/trunk/test/SemaObjC/ClassPropertyNotObject.m
Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=147504&r1=147503&r2=147504&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Jan  3 18:31:53 2012
@@ -1797,6 +1797,14 @@
         // not specified; including when property is 'readonly'.
         PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
       else if (!(Attributes & ObjCDeclSpec::DQ_PR_readonly)) {
+        bool isAnyClassTy = 
+          (PropertyTy->isObjCClassType() || 
+           PropertyTy->isObjCQualifiedClassType());
+        // In non-gc, non-arc mode, 'Class' is treated as a 'void *' no need to
+        // issue any warning.
+        if (isAnyClassTy && getLangOptions().getGC() == LangOptions::NonGC)
+          ;
+        else {
           // Skip this warning in gc-only mode.
           if (getLangOptions().getGC() != LangOptions::GCOnly)
             Diag(Loc, diag::warn_objc_property_no_assignment_attribute);
@@ -1804,6 +1812,7 @@
           // If non-gc code warn that this is likely inappropriate.
           if (getLangOptions().getGC() == LangOptions::NonGC)
             Diag(Loc, diag::warn_objc_property_default_assign_on_object);
+        }
       }
 
     // FIXME: Implement warning dependent on NSCopying being

Added: cfe/trunk/test/SemaObjC/ClassPropertyNotObject.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/ClassPropertyNotObject.m?rev=147504&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/ClassPropertyNotObject.m (added)
+++ cfe/trunk/test/SemaObjC/ClassPropertyNotObject.m Tue Jan  3 18:31:53 2012
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// rdar://10565506
+
+ at protocol P @end
+
+ at interface I
+ at property Class<P> MyClass;
+ at property Class MyClass1;
+ at property void * VOIDSTAR;
+ at end
+
+ at implementation I
+ at synthesize MyClass, MyClass1, VOIDSTAR;
+ at end





More information about the cfe-commits mailing list