[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Index / comment-c-decls.c
blob2a99b36ea820079ad4e80dadf3fa76dda02a4ac0
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
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
11 /**
12 * \brief Aaa.
14 int global_function();
15 // CHECK: <Declaration>int global_function()</Declaration>
17 /**
18 * \param x1 Aaa.
20 extern void external_function(int x1);
21 // CHECK: <Declaration>extern void external_function(int x1)</Declaration>
23 /**
24 * \brief global variable;
26 int global_variable;
27 // CHECK: <Declaration>int global_variable</Declaration>
29 /**
30 * \brief local variable;
32 static int static_variable;
33 // CHECK: <Declaration>static int static_variable</Declaration>
35 /**
36 * \brief external variable
38 extern int external_variable;
39 // CHECK: <Declaration>extern int external_variable</Declaration>
41 int global_function() {
42 /**
43 * \brief a local variable
45 int local = 10;
46 return local;
48 // CHECK: <Declaration>int global_function()</Declaration>
49 // CHECK: <Declaration>int local = 10</Declaration>
51 /**
52 * \brief initialized decl.
54 int initialized_global = 100;
55 // CHECK: <Declaration>int initialized_global = 100</Declaration>
57 /**
58 * \brief typedef example
60 typedef int INT_T;
61 // CHECK: <Declaration>typedef int INT_T</Declaration>
63 /**
64 * \brief aggregate type example
66 struct S {
67 /**
68 * \brief iS1;
70 int iS1;
71 /**
72 * \brief dS1;
74 double dS1;
76 // CHECK: <Declaration>struct S {}</Declaration>
77 // CHECK: <Declaration>int iS1</Declaration>
78 // CHECK: <Declaration>double dS1</Declaration>
80 /**
81 * \brief enum e;
83 enum e {
84 One,
85 /**
86 * \brief Two;
88 Two,
89 Three
91 // CHECK: <Declaration>enum e {}</Declaration>
92 // CHECK: <Declaration>Two</Declaration>
94 /**
95 *\brief block declaration
97 int (^Block) (int i, int j);
98 // CHECK: <Declaration>int (^Block)(int, int)</Declaration>
101 *\brief block declaration
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) {\n}</Declaration>