diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-08 18:03:17 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-08 18:03:17 +0000 |
commit | 5ac085ab3ac779b5819b4e02cdd26fa1b5ac79f6 (patch) | |
tree | c3c81c1638ca25421f390b8ad277e4b71a3060e2 /clang/test | |
parent | 62422209667ec09be01ae31734bfc3c395c890e1 (diff) | |
download | bcm5719-llvm-5ac085ab3ac779b5819b4e02cdd26fa1b5ac79f6.tar.gz bcm5719-llvm-5ac085ab3ac779b5819b4e02cdd26fa1b5ac79f6.zip |
objective-c: diagnose protocol inconsistencies in following
situation. When a class explicitly or implicitly (through inheritance)
"conformsTo" two protocols which conflict (have methods which conflict).
This patch fixes the previous patch where warnings were coming out in
non-deterministic order. This is 2nd part of // rdar://6191214.
llvm-svn: 137055
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaObjC/class-protocol-method-match.m | 6 | ||||
-rw-r--r-- | clang/test/SemaObjC/qualified-protocol-method-conflicts.m | 39 |
2 files changed, 42 insertions, 3 deletions
diff --git a/clang/test/SemaObjC/class-protocol-method-match.m b/clang/test/SemaObjC/class-protocol-method-match.m index bffdb79e074..4022ce3aee5 100644 --- a/clang/test/SemaObjC/class-protocol-method-match.m +++ b/clang/test/SemaObjC/class-protocol-method-match.m @@ -4,7 +4,7 @@ @protocol Bar @required - (unsigned char) baz; // expected-note {{previous definition is here}} -- (char) ok; +- (char) ok; // expected-note {{previous definition is here}} - (void) also_ok; @end @@ -17,11 +17,11 @@ @protocol Baz <Bar, Bar1> - (void) bar : (unsigned char)arg; // expected-note {{previous definition is here}} -- (void) ok; +- (void) ok; // expected-warning {{conflicting return type in declaration of 'ok': 'char' vs 'void'}} - (char) bak; // expected-note {{previous definition is here}} @end -@interface Foo <Baz> +@interface Foo <Baz> // expected-note {{class is declared here}} - (void) baz; // expected-warning {{conflicting return type in declaration of 'baz': 'unsigned char' vs 'void'}} - (void) bar : (unsigned char*)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'unsigned char' vs 'unsigned char *'}} - (void) ok; diff --git a/clang/test/SemaObjC/qualified-protocol-method-conflicts.m b/clang/test/SemaObjC/qualified-protocol-method-conflicts.m new file mode 100644 index 00000000000..da83c8338c1 --- /dev/null +++ b/clang/test/SemaObjC/qualified-protocol-method-conflicts.m @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://6191214 + +@protocol Xint +-(void) setX: (int) arg0; // expected-note 3 {{previous definition is here}} ++(int) C; // expected-note 3 {{previous definition is here}} +@end + +@protocol Xfloat +-(void) setX: (float) arg0; // expected-warning 3 {{conflicting parameter types in declaration of 'setX:': 'int' vs 'float'}} ++(float) C; // expected-warning 3 {{conflicting return type in declaration of 'C': 'int' vs 'float'}} +@end + +@interface A <Xint, Xfloat> // expected-note {{class is declared here}} +@end + +@implementation A +-(void) setX: (int) arg0 { } ++(int) C {return 0; } +@end + +@interface B <Xfloat, Xint> // expected-note {{class is declared here}} +@end + +@implementation B +-(void) setX: (float) arg0 { } ++ (float) C {return 0.0; } +@end + +@protocol Xint_float<Xint, Xfloat> +@end + +@interface C<Xint_float> // expected-note {{class is declared here}} +@end + +@implementation C +-(void) setX: (int) arg0 { } ++ (int) C {return 0;} +@end |