| 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 |
|
| 10 |
/** |
| 11 |
* \brief Aaa. |
| 12 |
*/ |
| 13 |
int global_function(); |
| 14 |
// CHECK: <Declaration>int global_function()</Declaration> |
| 15 |
|
| 16 |
/** |
| 17 |
* \param x1 Aaa. |
| 18 |
*/ |
| 19 |
extern void external_function(int x1); |
| 20 |
// CHECK: <Declaration>extern void external_function(int x1)</Declaration> |
| 21 |
|
| 22 |
/** |
| 23 |
* \brief global variable; |
| 24 |
*/ |
| 25 |
int global_variable; |
| 26 |
// CHECK: <Declaration>int global_variable</Declaration> |
| 27 |
|
| 28 |
/** |
| 29 |
* \brief local variable; |
| 30 |
*/ |
| 31 |
static int static_variable; |
| 32 |
// CHECK: <Declaration>static int static_variable</Declaration> |
| 33 |
|
| 34 |
/** |
| 35 |
* \brief external variable |
| 36 |
*/ |
| 37 |
extern int external_variable; |
| 38 |
// CHECK: <Declaration>extern int external_variable</Declaration> |
| 39 |
|
| 40 |
int global_function() { |
| 41 |
/** |
| 42 |
* \brief a local variable |
| 43 |
*/ |
| 44 |
int local = 10; |
| 45 |
return local; |
| 46 |
} |
| 47 |
// CHECK: <Declaration>int global_function()</Declaration> |
| 48 |
// CHECK: <Declaration>int local = 10</Declaration> |
| 49 |
|
| 50 |
/** |
| 51 |
* \brief initialized decl. |
| 52 |
*/ |
| 53 |
int initialized_global = 100; |
| 54 |
// CHECK: <Declaration>int initialized_global = 100</Declaration> |
| 55 |
|
| 56 |
/** |
| 57 |
* \brief typedef example |
| 58 |
*/ |
| 59 |
typedef int INT_T; |
| 60 |
// CHECK: <Declaration>typedef int INT_T</Declaration> |
| 61 |
|
| 62 |
/** |
| 63 |
* \brief aggregate type example |
| 64 |
*/ |
| 65 |
struct S { |
| 66 |
/** |
| 67 |
* \brief iS1; |
| 68 |
*/ |
| 69 |
int iS1; |
| 70 |
/** |
| 71 |
* \brief dS1; |
| 72 |
*/ |
| 73 |
double dS1; |
| 74 |
}; |
| 75 |
// CHECK: <Declaration>struct S {}</Declaration> |
| 76 |
// CHECK: <Declaration>int iS1</Declaration> |
| 77 |
// CHECK: <Declaration>double dS1</Declaration> |
| 78 |
|
| 79 |
/** |
| 80 |
* \brief enum e; |
| 81 |
*/ |
| 82 |
enum e { |
| 83 |
One, |
| 84 |
/** |
| 85 |
* \brief Two; |
| 86 |
*/ |
| 87 |
Two, |
| 88 |
Three |
| 89 |
}; |
| 90 |
// CHECK: <Declaration>enum e {}</Declaration> |
| 91 |
// CHECK: <Declaration>Two</Declaration> |
| 92 |
|
| 93 |
/** |
| 94 |
*\brief block declaration |
| 95 |
*/ |
| 96 |
int (^Block) (int i, int j); |
| 97 |
// CHECK: <Declaration>int (^Block)(int, int)</Declaration> |
| 98 |
|
| 99 |
/** |
| 100 |
*\brief block declaration |
| 101 |
*/ |
| 102 |
int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; }; |
| 103 |
// CHECK: <Declaration>int (^Block1)(int, int) = ^(int i, int j) {\n}</Declaration> |