Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Index / comment-c-decls.c
blob0ac526c92dbad333739ac742c22b4228ae95f7fa
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
10 /**
11 * \brief Aaa.
13 int global_function();
14 // CHECK: <Declaration>int global_function()</Declaration>
16 /**
17 * \param x1 Aaa.
19 extern void external_function(int x1);
20 // CHECK: <Declaration>extern void external_function(int x1)</Declaration>
22 /**
23 * \brief global variable;
25 int global_variable;
26 // CHECK: <Declaration>int global_variable</Declaration>
28 /**
29 * \brief local variable;
31 static int static_variable;
32 // CHECK: <Declaration>static int static_variable</Declaration>
34 /**
35 * \brief external variable
37 extern int external_variable;
38 // CHECK: <Declaration>extern int external_variable</Declaration>
40 int global_function() {
41 /**
42 * \brief a local variable
44 int local = 10;
45 return local;
47 // CHECK: <Declaration>int global_function()</Declaration>
48 // CHECK: <Declaration>int local = 10</Declaration>
50 /**
51 * \brief initialized decl.
53 int initialized_global = 100;
54 // CHECK: <Declaration>int initialized_global = 100</Declaration>
56 /**
57 * \brief typedef example
59 typedef int INT_T;
60 // CHECK: <Declaration>typedef int INT_T</Declaration>
62 /**
63 * \brief aggregate type example
65 struct S {
66 /**
67 * \brief iS1;
69 int iS1;
70 /**
71 * \brief dS1;
73 double dS1;
75 // CHECK: <Declaration>struct S {}</Declaration>
76 // CHECK: <Declaration>int iS1</Declaration>
77 // CHECK: <Declaration>double dS1</Declaration>
79 /**
80 * \brief enum e;
82 enum e {
83 One,
84 /**
85 * \brief Two;
87 Two,
88 Three
90 // CHECK: <Declaration>enum e {}</Declaration>
91 // CHECK: <Declaration>Two</Declaration>
93 /**
94 *\brief block declaration
96 int (^Block) (int i, int j);
97 // CHECK: <Declaration>int (^Block)(int, int)</Declaration>
99 /**
100 *\brief block declaration
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>