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