Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -Wdocumentation -Wdocumentation-pedantic -verify %s
      2 
      3 @class NSString;
      4 
      5 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
      6 /// \brief\author Aaa
      7 @interface Test1
      8 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
      9 /**
     10  * \brief\author Aaa
     11  * \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;
     21 
     22 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     23 /// \brief\author Aaa
     24 @property int test3; // a property: ObjCPropertyDecl
     25 
     26 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     27 /// \brief\author Aaa
     28 @property int test4; // a property: ObjCPropertyDecl
     29 @end
     30 
     31 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     32 /// \brief\author Aaa
     33 @interface Test1()
     34 @end
     35 
     36 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     37 /// \brief\author Aaa
     38 @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}}
     51 /// \brief\author Aaa
     52 NSString *_test5;
     53 @end
     54 
     55 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     56 /// \brief\author Aaa
     57 @interface Test1(Test1Category) // a category: ObjCCategoryDecl
     58 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     59 /// \brief\author Aaa
     60 + (NSString *)test3:(NSString *)aaa;
     61 @end
     62 
     63 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     64 /// \brief\author Aaa
     65 @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}}
     72 /// \brief\author Aaa
     73 @protocol TestProto1 // a protocol: ObjCProtocolDecl
     74 @end
     75 
     76 int a;
     77 
     78 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
     79 /// \brief\author Aaa
     80 @interface Test4
     81 @end
     82 
     83 int b;
     84 
     85 @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 
     94 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
     95 /// \param aaa Meow.
     96 /// \param bbb Bbb.
     97 /// \returns aaa.
     98 typedef int (^test_param1)(int aaa, int ccc);
     99 
    100 // rdar://13094352
    101 // expected-warning@+2 {{'@method' command should be used in a comment attached to an Objective-C method declaration}}
    102 @interface I
    103 /*!	@method Base64EncodeEx
    104 */
    105 typedef id ID;
    106 - (unsigned) Base64EncodeEx : (ID)Arg;
    107 @end
    108 
    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 
    120 typedef id OBJ;
    121 @interface IOCommandGate : NSObject {
    122   OBJ iv;
    123 }
    124 @end
    125 
    126 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
    127 /*!
    128 @protocol PROTO
    129 */
    130 struct S;
    131 
    132 /*!
    133   @interface NSArray This is an array
    134 */
    135 @class NSArray;
    136 @interface NSArray @end
    137 
    138 /*!
    139 @interface NSMutableArray 
    140 @super NSArray
    141 */
    142 @interface NSMutableArray : NSArray @end
    143 
    144 /*!
    145   @protocol MyProto
    146 */
    147 @protocol MyProto @end
    148 
    149 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
    150 /*!
    151  @protocol MyProto
    152 */
    153 @interface INTF <MyProto> @end
    154 
    155 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
    156 /*!
    157   @struct S1 THIS IS IT
    158 */
    159 @interface S1 @end
    160