Home | History | Annotate | Download | only in Index
      1 // RUN: rm -rf %t
      2 // RUN: mkdir %t
      3 // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out
      4 // RUN: FileCheck %s < %t/out
      5 
      6 // Ensure that XML we generate is not invalid.
      7 // RUN: FileCheck %s -check-prefix=WRONG < %t/out
      8 // WRONG-NOT: CommentXMLInvalid
      9 // rdar://12378714
     10 
     11 /**
     12  * \brief Aaa.
     13 */
     14 int global_function();
     15 // CHECK: <Declaration>int global_function()</Declaration>
     16 
     17 /**
     18  * \param x1 Aaa.
     19 */
     20 extern void external_function(int x1);
     21 // CHECK: <Declaration>extern void external_function(int x1)</Declaration>
     22 
     23 /**
     24  * \brief global variable;
     25 */
     26 int global_variable;
     27 // CHECK: <Declaration>int global_variable</Declaration>
     28 
     29 /**
     30  * \brief local variable;
     31 */
     32 static int static_variable;
     33 // CHECK: <Declaration>static int static_variable</Declaration>
     34 
     35 /**
     36  * \brief external variable
     37 */
     38 extern int external_variable;
     39 // CHECK: <Declaration>extern int external_variable</Declaration>
     40 
     41 int global_function() {
     42   /**
     43    * \brief a local variable
     44   */
     45   int local = 10;
     46   return local;
     47 }
     48 // CHECK: <Declaration>int global_function()</Declaration>
     49 // CHECK: <Declaration>int local = 10</Declaration>
     50 
     51 /**
     52  * \brief initialized decl.
     53 */
     54 int initialized_global = 100;
     55 // CHECK: <Declaration>int initialized_global = 100</Declaration>
     56 
     57 /**
     58  * \brief typedef example
     59 */
     60 typedef int INT_T;
     61 // CHECK: <Declaration>typedef int INT_T</Declaration>
     62 
     63 /**
     64  * \brief aggregate type example
     65 */
     66 struct S {
     67 /**
     68  * \brief iS1;
     69 */
     70   int iS1;
     71 /**
     72  * \brief dS1;
     73 */
     74   double dS1;
     75 };
     76 // CHECK: <Declaration>struct S {}</Declaration>
     77 // CHECK: <Declaration>int iS1</Declaration>
     78 // CHECK: <Declaration>double dS1</Declaration>
     79 
     80 /**
     81  * \brief enum e;
     82 */
     83 enum e {
     84   One,
     85 /**
     86  * \brief Two;
     87 */
     88   Two,
     89   Three
     90 };
     91 // CHECK: <Declaration>enum e {}</Declaration>
     92 // CHECK: <Declaration>Two</Declaration>
     93 
     94 /**
     95  *\brief block declaration
     96 */
     97 int (^Block) (int i, int j);
     98 // CHECK: <Declaration>int (^Block)(int, int)</Declaration>
     99 
    100 /**
    101  *\brief block declaration
    102 */
    103 int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; };
    104 // CHECK: <Declaration>int (^Block1)(int, int) = ^(int i, int j) {}</Declaration>
    105