[cfe-commits] r65232 - /cfe/trunk/test/SemaObjC/protocol-undef.m

Steve Naroff snaroff at apple.com
Sat Feb 21 09:03:44 PST 2009


Author: snaroff
Date: Sat Feb 21 11:03:43 2009
New Revision: 65232

URL: http://llvm.org/viewvc/llvm-project?rev=65232&view=rev
Log:
Add test case to record a couple inconsistencies with GCC (found in <rdar://problem/6561076> [clang on Xcode] warning: cannot find protocol definition for 'OzzyP').

Removing the "cannot find protocol" warning is trivial if necessary (but I don't think it's the right thing to do).

Added:
    cfe/trunk/test/SemaObjC/protocol-undef.m

Added: cfe/trunk/test/SemaObjC/protocol-undef.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-undef.m?rev=65232&view=auto

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-undef.m (added)
+++ cfe/trunk/test/SemaObjC/protocol-undef.m Sat Feb 21 11:03:43 2009
@@ -0,0 +1,47 @@
+// RUN: clang -fsyntax-only -verify %s
+
+typedef signed char BOOL;
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+ at protocol NSObject
+- (BOOL)isEqual:(id)object;
+ at end
+ at protocol NSCoding
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+ at end 
+ at interface NSObject <NSObject> {} @end
+ at class NSArray, NSAttributedString, NSEvent, NSInputServer, NSImage;
+ at interface NSController : NSObject <NSCoding> {} @end
+ at class OzzyView;
+typedef struct _OzzyInset {} OzzyInset;
+ at protocol OzzyP;
+typedef NSObject <OzzyP> Ozzy;
+ at protocol OzzyAnchorP;
+typedef NSObject <OzzyAnchorP> OzzyAnchor;
+ at protocol OzzyAnchorDelegateP
+- (BOOL)anchor:(OzzyAnchor *)anchor confirmRepresentedObject:(id)newObject;
+ at end
+typedef NSObject <OzzyAnchorDelegateP> OzzyAnchorDelegate;
+// GCC doesn't warn about the following (which is inconsistent with it's handling of @interface below).
+ at protocol OzzyAnchorP <OzzyP> // expected-warning{{cannot find protocol definition for 'OzzyP'}}
+  @property(nonatomic,retain) id representedObject;
+  @property(nonatomic,retain) Ozzy * contentGroup;
+ at end
+ at interface XXX : NSObject <OzzyP> // expected-warning{{cannot find protocol definition for 'OzzyP'}}
+ at end
+ at protocol OzzyActionDelegateP
+  @optional - (BOOL)elementView:(OzzyView *)elementView shouldDragElement:(Ozzy *)element;
+ at end
+typedef NSObject <OzzyActionDelegateP> OzzyActionDelegate;
+ at interface OzzyUnit : OzzyAnchorDelegate <OzzyAnchorDelegateP> {}
+ at end
+ at interface OzzyArrayUnit : OzzyUnit {} @end
+ at implementation OzzyArrayUnit
+- (BOOL)willChangeLayoutForObjects:(NSArray *)objects fromObjects:(NSArray *)oldObjects {}
+- (void)_recalculateStoredArraysForAnchor:(OzzyAnchor *)anchor {
+  Ozzy * contentGroup = anchor.contentGroup;
+  if (contentGroup == ((void *)0)) {
+    // GCC doesn't warn about the following (which seems wrong).
+    contentGroup = anchor; // expected-warning{{incompatible pointer types assigning 'OzzyAnchor *', expected 'Ozzy *'}}
+  }
+}
+ at end





More information about the cfe-commits mailing list