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);
101 // expected-warning@+2 {{'@method' command should be used in a comment attached to an Objective-C method declaration}}
103 /*! @method Base64EncodeEx
106 - (unsigned) Base64EncodeEx : (ID)Arg;
109 // expected-warning@+5 {{'@interface' command should not be used in a comment attached to a non-interface declaration}}
110 // expected-warning@+5 {{'@classdesign' command should not be used in a comment attached to a non-container declaration}}
111 // expected-warning@+5 {{'@coclass' command should not be used in a comment attached to a non-container declaration}}
112 @interface NSObject @end
114 @interface IOCommandGate
115 @classdesign Multiple paragraphs go here.
120 @interface IOCommandGate : NSObject {
125 // expected-warning@+4 {{'@methodgroup' command should be used in a comment attached to an Objective-C method declaration}}
126 // expected-warning@+6 {{'@method' command should be used in a comment attached to an Objective-C method declaratio}}
127 @interface rdar12379114
129 @methodgroup Creating a request
132 @method initWithTimeout is the 2nd method
134 typedef unsigned int NSTimeInterval;
135 - (id)initWithTimeout:(NSTimeInterval)timeout;
138 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
145 @interface NSArray This is an array
148 @interface NSArray @end
150 // expected-warning@+3 {{unknown command tag name}}
152 @interface NSMutableArray
155 @interface NSMutableArray : NSArray @end
160 @protocol MyProto @end
162 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
166 @interface INTF <MyProto> @end
168 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
170 @struct S1 THIS IS IT
174 // expected-warning@+1 {{unknown command tag name}}
175 /// \t bbb IS_DOXYGEN_END
178 /** \brief Module handling the incoming notifications from the system.
181 * - Network Reachability
185 @interface BRC : NSObject
186 - (void)removeReach:(NSObject*)observer;
189 @implementation BRC : NSObject
190 - (void)removeReach:(NSObject*)observer // expected-note {{previous declaration is here}}
193 - (void)removeReach:(NSObject*)observer // expected-error {{duplicate declaration of method 'removeReach:'}}
198 /// @class Asset <- '@class' may be used in a comment attached to a an interface declaration
199 @interface Asset : NSObject
202 // Check that this does not enter an infinite loop
203 @interface rdar14024851
204 -(void)meth; // expected-note {{declared here}}
207 @implementation rdar14024851 // expected-warning {{method definition for 'meth' not found}} expected-note {{previous definition}}
210 @implementation rdar14024851 // expected-error {{reimplementation}}
215 @interface test_vararg1
216 /// @param[in] arg something
217 /// @param[in] ... This is vararg
218 - (void) VarArgMeth : (id)arg, ...;
221 @implementation test_vararg1
222 /// @param[in] arg something
223 /// @param[in] ... This is vararg
224 - (void) VarArgMeth : (id)arg, ... {}
228 * blockPointerVariable
230 * @param i is integer.
233 int (^blockPointerVariable)(int i);
239 * \param i is integer.
242 int (^blockPointerFields)(int i);
245 // expected-warning@+5 {{parameter 'p' not found in the function declaration}}
246 // expected-warning@+5 {{'\returns' command used in a comment that is attached to a function returning void}}
248 * functionPointerVariable
253 void (^_Nullable blockPointerVariableThatLeadsNowhere)(void);
255 @interface CheckFunctionBlockPointerVars {
257 * functionPointerIVar
259 * @param i is integer.
262 int (*functionPointerIVar)(int i);
267 * \param i is integer.
270 int (^blockPointerIVar)(int i);
274 * functionPointerProperty
276 * @param i is integer.
279 @property int (*functionPointerProperty)(int i);
282 * blockPointerProperty
284 * \param i is integer.
287 @property int (^blockPointerProperty)(int i);
290 * blockReturnsNothing
292 * \returns Nothing, but can allow this as this pattern is used to document the
293 * value that the property getter returns.
295 @property void (^blockReturnsNothing)(void);
300 * Block typedef with variadic params.
306 * now should work too.
308 typedef void (^VariadicBlockType)(int a, ...);
310 // PR42844 - Assertion failures when using typedefed block pointers
311 typedef void(^VoidBlockType)(void);
312 typedef VoidBlockType VoidBlockTypeCall(void);
313 VoidBlockTypeCall *d; ///< \return none
314 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
315 VoidBlockTypeCall ^e; ///< \return none
316 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
319 @interface HasAnonNamespace @end
320 @implementation HasAnonNamespace