blob: 5e95e2a1e8a2f359d826321a3c269b772a3c34f4 [file] [log] [blame]
Dmitri Gribenko70ff1092012-08-24 00:05:30 +00001// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -Wdocumentation -Wdocumentation-pedantic -verify %s
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00002
3@class NSString;
4
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +00005// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +00006/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +00007@interface Test1
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00008// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
9/**
Dmitri Gribenko9443c572012-08-06 17:08:27 +000010 * \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000011 * \param aaa Aaa
12 * \param bbb Bbb
13 */
14+ (NSString *)test1:(NSString *)aaa suffix:(NSString *)bbb;
15
16// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'aaa'?}}
17/**
18 * \param aab Aaa
19 */
20+ (NSString *)test2:(NSString *)aaa;
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000021
22// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000023/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000024@property int test3; // a property: ObjCPropertyDecl
25
26// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000027/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000028@property int test4; // a property: ObjCPropertyDecl
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000029@end
30
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000031// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000032/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000033@interface Test1()
34@end
35
36// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000037/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000038@implementation Test1 // a class implementation : ObjCImplementationDecl
39+ (NSString *)test1:(NSString *)aaa suffix:(NSString *)bbb {
40 return 0;
41}
42
43+ (NSString *)test2:(NSString *)aaa {
44 return 0;
45}
46
47@synthesize test3; // a property implementation: ObjCPropertyImplDecl
48@dynamic test4; // a property implementation: ObjCPropertyImplDecl
49
50// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000051/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000052NSString *_test5;
53@end
54
55// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000056/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000057@interface Test1(Test1Category) // a category: ObjCCategoryDecl
58// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000059/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000060+ (NSString *)test3:(NSString *)aaa;
61@end
62
63// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000064/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000065@implementation Test1(Test1Category) // a category implementation: ObjCCategoryImplDecl
66+ (NSString *)test3:(NSString *)aaa {
67 return 0;
68}
69@end
70
71// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000072/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000073@protocol TestProto1 // a protocol: ObjCProtocolDecl
74@end
75
76int a;
77
78// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000079/// \brief\author Aaa
Dmitri Gribenkoabd56c82012-07-13 01:06:46 +000080@interface Test4
81@end
82
83int b;
84
Dmitri Gribenko88815f32012-08-06 16:29:26 +000085@interface TestReturns1
86/// \returns Aaa
87- (int)test1:(NSString *)aaa;
88
89// expected-warning@+1 {{'\returns' command used in a comment that is attached to a method returning void}}
90/// \returns Aaa
91- (void)test2:(NSString *)aaa;
92@end
93
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +000094// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
Dmitri Gribenko70ff1092012-08-24 00:05:30 +000095/// \param aaa Meow.
96/// \param bbb Bbb.
97/// \returns aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +000098typedef int (^test_param1)(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +000099
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000100// rdar://13094352
Fariborz Jahanian26facfa2013-03-06 17:55:30 +0000101// expected-warning@+2 {{'@method' command should be used in a comment attached to an Objective-C method declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000102@interface I
103/*! @method Base64EncodeEx
104*/
105typedef id ID;
106- (unsigned) Base64EncodeEx : (ID)Arg;
107@end
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +0000108
109// rdar://12379114
110// expected-warning@+5 {{'@interface' command should not be used in a comment attached to a non-interface declaration}}
111// expected-warning@+5 {{'@classdesign' command should not be used in a comment attached to a non-container declaration}}
112// expected-warning@+5 {{'@coclass' command should not be used in a comment attached to a non-container declaration}}
113@interface NSObject @end
114/*!
115@interface IOCommandGate
116@classdesign Multiple paragraphs go here.
117@coclass myCoClass
118*/
119
120typedef id OBJ;
121@interface IOCommandGate : NSObject {
122 OBJ iv;
123}
124@end
125
Fariborz Jahanian2aa5cf42013-03-18 23:45:52 +0000126// rdar://12379114
127// expected-warning@+4 {{'@methodgroup' command should be used in a comment attached to an Objective-C method declaration}}
128// expected-warning@+6 {{'@method' command should be used in a comment attached to an Objective-C method declaratio}}
129@interface rdar12379114
130/*!
131 @methodgroup Creating a request
132*/
133/*!
134 @method initWithTimeout is the 2nd method
135*/
136typedef unsigned int NSTimeInterval;
137- (id)initWithTimeout:(NSTimeInterval)timeout;
138@end
139
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +0000140// expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
141/*!
142@protocol PROTO
143*/
144struct S;
145
146/*!
147 @interface NSArray This is an array
148*/
149@class NSArray;
150@interface NSArray @end
151
Fariborz Jahanianad6fd9f2013-05-03 23:15:20 +0000152// expected-warning@+3 {{unknown command tag name}}
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +0000153/*!
154@interface NSMutableArray
155@super NSArray
156*/
157@interface NSMutableArray : NSArray @end
158
159/*!
160 @protocol MyProto
161*/
162@protocol MyProto @end
163
164// expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
165/*!
166 @protocol MyProto
167*/
168@interface INTF <MyProto> @end
169
170// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
171/*!
172 @struct S1 THIS IS IT
173*/
174@interface S1 @end
Fariborz Jahanianf4030ae2013-05-09 17:18:52 +0000175
176// expected-warning@+1 {{unknown command tag name}}
177/// \t bbb IS_DOXYGEN_END
178int FooBar();
Fariborz Jahanianfbff0c42013-05-13 17:27:00 +0000179
180// rdar://13836387
181/** \brief Module handling the incoming notifications from the system.
182 *
183 * This includes:
184 * - Network Reachability
185 * - Power State
186 * - Low Disk
187 */
188@interface BRC : NSObject
189- (void)removeReach:(NSObject*)observer;
190@end
191
192@implementation BRC : NSObject
193- (void)removeReach:(NSObject*)observer // expected-note {{previous declaration is here}}
194{
195}
196- (void)removeReach:(NSObject*)observer // expected-error {{duplicate declaration of method 'removeReach:'}}
197{
198}
199@end
Fariborz Jahaniandbed7cc2013-05-20 23:40:39 +0000200
201// rdar://13927330
202/// @class Asset <- '@class' may be used in a comment attached to a an interface declaration
203@interface Asset : NSObject
204@end
205
Argyrios Kyrtzidisdf08c4b2013-05-30 18:53:21 +0000206// rdar://14024851 Check that this does not enter an infinite loop
207@interface rdar14024851
208-(void)meth; // expected-note {{declared here}}
209@end
210
211@implementation rdar14024851 // expected-warning {{method definition for 'meth' not found}} expected-note {{previous definition}}
212@end
213
214@implementation rdar14024851 // expected-error {{reimplementation}}
215/// \brief comment
216-(void)meth {}
217@end
Dmitri Gribenkoc5b00542013-06-24 04:41:32 +0000218
219// rdar://14124644
220@interface test_vararg1
221/// @param[in] arg somthing
222/// @param[in] ... This is vararg
223- (void) VarArgMeth : (id)arg, ...;
224@end
225
226@implementation test_vararg1
227/// @param[in] arg somthing
228/// @param[in] ... This is vararg
229- (void) VarArgMeth : (id)arg, ... {}
230@end
231