xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/method-conflict.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuctypedef signed char BOOL;
4*f4a2713aSLionel Sambuctypedef unsigned int NSUInteger;
5*f4a2713aSLionel Sambuctypedef struct _NSZone NSZone;
6*f4a2713aSLionel Sambuc@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
7*f4a2713aSLionel Sambuc@protocol NSObject  - (BOOL)isEqual:(id)object;
8*f4a2713aSLionel Sambuc@end  @protocol NSCopying  - (id)copyWithZone:(NSZone *)zone;
9*f4a2713aSLionel Sambuc@end  @protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone;
10*f4a2713aSLionel Sambuc@end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
11*f4a2713aSLionel Sambuc@end    @interface NSObject <NSObject> {
12*f4a2713aSLionel Sambuc}
13*f4a2713aSLionel Sambuc@end    extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
14*f4a2713aSLionel Sambuc@interface NSValue : NSObject <NSCopying, NSCoding>  - (void)getValue:(void *)value;
15*f4a2713aSLionel Sambuc@end        @class NSString;
16*f4a2713aSLionel Sambuctypedef struct _NSRange {
17*f4a2713aSLionel Sambuc}
18*f4a2713aSLionel Sambuc  NSRange;
19*f4a2713aSLionel Sambuc@interface NSValue (NSValueRangeExtensions)  + (NSValue *)valueWithRange:(NSRange)range;
20*f4a2713aSLionel Sambuc@end  @interface NSAttributedString : NSObject <NSCopying, NSMutableCopying, NSCoding>  - (NSString *)string;
21*f4a2713aSLionel Sambuc@end  @interface NSMutableAttributedString : NSAttributedString  - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str;
22*f4a2713aSLionel Sambuc@end       @class NSArray, NSDictionary, NSString, NSError;
23*f4a2713aSLionel Sambuc@interface NSScanner : NSObject <NSCopying>  - (NSString *)string;
24*f4a2713aSLionel Sambuc@end        typedef struct {
25*f4a2713aSLionel Sambuc}
26*f4a2713aSLionel Sambuc  CSSM_FIELDGROUP, *CSSM_FIELDGROUP_PTR;
27*f4a2713aSLionel Sambuc@protocol XDUMLClassifier;
28*f4a2713aSLionel Sambuc@protocol XDUMLClassInterfaceCommons <XDUMLClassifier>
29*f4a2713aSLionel Sambuc@end  @protocol XDUMLImplementation;
30*f4a2713aSLionel Sambuc@protocol XDUMLElement <NSObject> - (NSArray *) ownedElements;
31*f4a2713aSLionel Sambuc@end @protocol XDUMLDataType;
32*f4a2713aSLionel Sambuc@protocol XDUMLNamedElement <XDUMLElement>     - (NSString *) name;
33*f4a2713aSLionel Sambuc@end enum _XDSourceLanguage {
34*f4a2713aSLionel SambucXDSourceUnknown=0,     XDSourceJava,     XDSourceC,     XDSourceCPP,     XDSourceObjectiveC };
35*f4a2713aSLionel Sambuctypedef NSUInteger XDSourceLanguage;
36*f4a2713aSLionel Sambuc@protocol XDSCClassifier <XDUMLClassInterfaceCommons> - (XDSourceLanguage)language;
37*f4a2713aSLionel Sambuc@end  @class XDSCDocController;
38*f4a2713aSLionel Sambuc@interface XDSCDisplaySpecification : NSObject <NSCoding>{
39*f4a2713aSLionel Sambuc}
40*f4a2713aSLionel Sambuc@end  @class XDSCOperation;
41*f4a2713aSLionel Sambuc@interface XDSCClassFormatter : NSObject {
42*f4a2713aSLionel Sambuc}
43*f4a2713aSLionel Sambuc+ (NSUInteger) compartmentsForClassifier: (id <XDUMLClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec;  // expected-note {{previous definition is here}}
44*f4a2713aSLionel Sambuc@end
45*f4a2713aSLionel Sambuc@class NSString;
46*f4a2713aSLionel Sambuc@implementation XDSCClassFormatter
47*f4a2713aSLionel Sambuc
48*f4a2713aSLionel Sambuc+ appendVisibility: (id <XDUMLNamedElement>) element withSpecification: (XDSCDisplaySpecification *) displaySpec to: (NSMutableAttributedString *) attributedString
49*f4a2713aSLionel Sambuc{
50*f4a2713aSLionel Sambuc  return 0;
51*f4a2713aSLionel Sambuc}
52*f4a2713aSLionel Sambuc+ (NSUInteger) compartmentsForClassifier: (id <XDSCClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec { // expected-warning {{conflicting parameter types in implementation of 'compartmentsForClassifier:withSpecification:'}}
53*f4a2713aSLionel Sambuc  return 0;
54*f4a2713aSLionel Sambuc}
55*f4a2713aSLionel Sambuc@end
56*f4a2713aSLionel Sambuc
57*f4a2713aSLionel Sambuc// rdar: // 8006060
58*f4a2713aSLionel Sambuc@interface Bar
59*f4a2713aSLionel Sambuc- (void)foo:(id)format, ...;  // expected-note {{previous declaration is here}}
60*f4a2713aSLionel Sambuc- (void)foo1:(id)format;      // expected-note {{previous declaration is here}}
61*f4a2713aSLionel Sambuc@end
62*f4a2713aSLionel Sambuc@implementation Bar
63*f4a2713aSLionel Sambuc- (void)foo:(id)format {}; // expected-warning {{conflicting variadic declaration of method and its implementation}}
64*f4a2713aSLionel Sambuc- (void)foo1:(id)format, ... {}; // expected-warning {{conflicting variadic declaration of method and its implementation}}
65*f4a2713aSLionel Sambuc@end
66*f4a2713aSLionel Sambuc
67