1 // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -Wdocumentation -Wdocumentation-pedantic -verify %s
2 // RUN: %clang_cc1 -xobjective-c++ -fsyntax-only -fblocks -Wno-objc-root-class -Wdocumentation -Wdocumentation-pedantic -verify %s
6 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
9 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
15 + (NSString *)test1:(NSString *)aaa suffix:(NSString *)bbb;
17 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'aaa'?}}
21 + (NSString *)test2:(NSString *)aaa;
23 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
25 @property int test3; // a property: ObjCPropertyDecl
27 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
29 @property int test4; // a property: ObjCPropertyDecl
32 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
37 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
39 @implementation Test1 // a class implementation : ObjCImplementationDecl
40 + (NSString *)test1:(NSString *)aaa suffix:(NSString *)bbb {
44 + (NSString *)test2:(NSString *)aaa {
48 @synthesize test3; // a property implementation: ObjCPropertyImplDecl
49 @dynamic test4; // a property implementation: ObjCPropertyImplDecl
51 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
56 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
58 @interface Test1(Test1Category) // a category: ObjCCategoryDecl
59 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
61 + (NSString *)test3:(NSString *)aaa;
64 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
66 @implementation Test1(Test1Category) // a category implementation: ObjCCategoryImplDecl
67 + (NSString *)test3:(NSString *)aaa {
72 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
74 @protocol TestProto1 // a protocol: ObjCProtocolDecl
79 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
86 @interface TestReturns1
88 - (int)test1:(NSString *)aaa;
90 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a method returning void}}
92 - (void)test2:(NSString *)aaa;
95 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
99 typedef int (^test_param1)(int aaa, int ccc);
102 // expected-warning@+2 {{'@method' command should be used in a comment attached to an Objective-C method declaration}}
104 /*! @method Base64EncodeEx
107 - (unsigned) Base64EncodeEx : (ID)Arg;
111 // expected-warning@+5 {{'@interface' command should not be used in a comment attached to a non-interface declaration}}
112 // expected-warning@+5 {{'@classdesign' command should not be used in a comment attached to a non-container declaration}}
113 // expected-warning@+5 {{'@coclass' command should not be used in a comment attached to a non-container declaration}}
114 @interface NSObject @end
116 @interface IOCommandGate
117 @classdesign Multiple paragraphs go here.
122 @interface IOCommandGate : NSObject {
128 // expected-warning@+4 {{'@methodgroup' command should be used in a comment attached to an Objective-C method declaration}}
129 // expected-warning@+6 {{'@method' command should be used in a comment attached to an Objective-C method declaratio}}
130 @interface rdar12379114
132 @methodgroup Creating a request
135 @method initWithTimeout is the 2nd method
137 typedef unsigned int NSTimeInterval;
138 - (id)initWithTimeout:(NSTimeInterval)timeout;
141 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
148 @interface NSArray This is an array
151 @interface NSArray @end
153 // expected-warning@+3 {{unknown command tag name}}
155 @interface NSMutableArray
158 @interface NSMutableArray : NSArray @end
163 @protocol MyProto @end
165 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
169 @interface INTF <MyProto> @end
171 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
173 @struct S1 THIS IS IT
177 // expected-warning@+1 {{unknown command tag name}}
178 /// \t bbb IS_DOXYGEN_END
182 /** \brief Module handling the incoming notifications from the system.
185 * - Network Reachability
189 @interface BRC : NSObject
190 - (void)removeReach:(NSObject*)observer;
193 @implementation BRC : NSObject
194 - (void)removeReach:(NSObject*)observer // expected-note {{previous declaration is here}}
197 - (void)removeReach:(NSObject*)observer // expected-error {{duplicate declaration of method 'removeReach:'}}
203 /// @class Asset <- '@class' may be used in a comment attached to a an interface declaration
204 @interface Asset : NSObject
207 // rdar://14024851 Check that this does not enter an infinite loop
208 @interface rdar14024851
209 -(void)meth; // expected-note {{declared here}}
212 @implementation rdar14024851 // expected-warning {{method definition for 'meth' not found}} expected-note {{previous definition}}
215 @implementation rdar14024851 // expected-error {{reimplementation}}
221 @interface test_vararg1
222 /// @param[in] arg something
223 /// @param[in] ... This is vararg
224 - (void) VarArgMeth : (id)arg, ...;
227 @implementation test_vararg1
228 /// @param[in] arg something
229 /// @param[in] ... This is vararg
230 - (void) VarArgMeth : (id)arg, ... {}
234 * blockPointerVariable
236 * @param i is integer.
239 int (^blockPointerVariable)(int i);
245 * \param i is integer.
248 int (^blockPointerFields)(int i);
251 // expected-warning@+5 {{parameter 'p' not found in the function declaration}}
252 // expected-warning@+5 {{'\returns' command used in a comment that is attached to a function returning void}}
254 * functionPointerVariable
259 void (^_Nullable blockPointerVariableThatLeadsNowhere)(void);
261 @interface CheckFunctionBlockPointerVars {
263 * functionPointerIVar
265 * @param i is integer.
268 int (*functionPointerIVar)(int i);
273 * \param i is integer.
276 int (^blockPointerIVar)(int i);
280 * functionPointerProperty
282 * @param i is integer.
285 @property int (*functionPointerProperty)(int i);
288 * blockPointerProperty
290 * \param i is integer.
293 @property int (^blockPointerProperty)(int i);
296 * blockReturnsNothing
298 * \returns Nothing, but can allow this as this pattern is used to document the
299 * value that the property getter returns.
301 @property void (^blockReturnsNothing)(void);
306 * Block typedef with variadic params.
312 * now should work too.
314 typedef void (^VariadicBlockType)(int a, ...);
316 // PR42844 - Assertion failures when using typedefed block pointers
317 typedef void(^VoidBlockType)(void);
318 typedef VoidBlockType VoidBlockTypeCall(void);
319 VoidBlockTypeCall *d; ///< \return none
320 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
321 VoidBlockTypeCall ^e; ///< \return none
322 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
325 @interface HasAnonNamespace @end
326 @implementation HasAnonNamespace