From 0c20bddc417134f88c3cf52de6bdca7276bef10b Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 14 May 2009 23:52:54 +0000 Subject: Don't warn if result/argument type of an implemented method is a qualified id which conforms to the matching type of its method declaration. llvm-svn: 71817 --- clang/test/SemaObjC/class-conforming-protocol-2.m | 22 ++++++++++++++++++++++ clang/test/SemaObjC/method-conflict.m | 5 ++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 clang/test/SemaObjC/class-conforming-protocol-2.m (limited to 'clang/test') diff --git a/clang/test/SemaObjC/class-conforming-protocol-2.m b/clang/test/SemaObjC/class-conforming-protocol-2.m new file mode 100644 index 00000000000..7b218bdbd80 --- /dev/null +++ b/clang/test/SemaObjC/class-conforming-protocol-2.m @@ -0,0 +1,22 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@protocol NSWindowDelegate @end + +@interface NSWindow +- (void)setDelegate:(id )anObject; +- (id ) delegate; +@end + +@protocol IBStringsTableWindowDelegate +@end + +@interface IBStringsTableWindow : NSWindow {} +@end + +@implementation IBStringsTableWindow +- (void)setDelegate:(id )delegate { +} +- (id )delegate { + return 0; +} +@end diff --git a/clang/test/SemaObjC/method-conflict.m b/clang/test/SemaObjC/method-conflict.m index 1524fbae56c..7a9b9f0beee 100644 --- a/clang/test/SemaObjC/method-conflict.m +++ b/clang/test/SemaObjC/method-conflict.m @@ -40,7 +40,7 @@ typedef NSUInteger XDSourceLanguage; @end @class XDSCOperation; @interface XDSCClassFormatter : NSObject { } -+ (NSUInteger) compartmentsForClassifier: (id ) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec; // expected-note {{previous definition is here}} ++ (NSUInteger) compartmentsForClassifier: (id ) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec; @end @class NSString; @implementation XDSCClassFormatter @@ -48,7 +48,6 @@ typedef NSUInteger XDSourceLanguage; + appendVisibility: (id ) element withSpecification: (XDSCDisplaySpecification *) displaySpec to: (NSMutableAttributedString *) attributedString { } -// GCC doesn't currently warn about this. -+ (NSUInteger) compartmentsForClassifier: (id ) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec { // expected-warning {{conflicting parameter types in implementation of 'compartmentsForClassifier:withSpecification:': 'id' vs 'id'}} ++ (NSUInteger) compartmentsForClassifier: (id ) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec { } @end -- cgit v1.2.3