blob: 6da59f0342b6cb0ee5002c4f6bfca77ad3146903 [file] [log] [blame]
Argyrios Kyrtzidis5d51ae22009-07-15 18:59:40 +00001// Run lines are sensitive to line numbers and come below the code.
2
Argyrios Kyrtzidis58f6eaf2009-07-14 05:34:59 +00003int top_var;
4
5void top_func_decl(int param1);
6
7void top_func_def(int param2) {
8 int local_var1;
9 for (int for_var = 100; for_var < 500; ++for_var) {
10 int local_var2 = for_var + 1;
11 }
12}
13
14struct S {
15 int field_var;
16};
17
18
19// RUN: clang-cc -emit-pch %s -o %t.ast &&
Argyrios Kyrtzidis5d51ae22009-07-15 18:59:40 +000020// RUN: index-test %t.ast -point-at %s:3:8 | grep top_var &&
21// RUN: index-test %t.ast -point-at %s:5:15 | grep top_func_decl &&
22// RUN: index-test %t.ast -point-at %s:5:25 | grep param1 &&
23// RUN: index-test %t.ast -point-at %s:7:17 | grep top_func_def &&
24// RUN: index-test %t.ast -point-at %s:7:23 | grep param2 &&
25// RUN: index-test %t.ast -point-at %s:8:10 | grep local_var1 &&
26// RUN: index-test %t.ast -point-at %s:9:15 | grep for_var &&
Argyrios Kyrtzidis3e8efd92009-07-21 00:06:46 +000027
28// RUN: index-test %t.ast -point-at %s:9:43 > %t &&
29// RUN: grep top_func_def %s &&
30// RUN: grep '++for_var' %s &&
31
Argyrios Kyrtzidis5d51ae22009-07-15 18:59:40 +000032// RUN: index-test %t.ast -point-at %s:10:9 | grep local_var2 &&
Argyrios Kyrtzidis3e8efd92009-07-21 00:06:46 +000033
34// RUN: index-test %t.ast -point-at %s:10:30 > %t &&
35// RUN: grep local_var2 %t &&
36// RUN: grep 'for_var + 1' %t &&
Argyrios Kyrtzidis12585542009-07-14 03:18:40 +000037
38// fields test.
Argyrios Kyrtzidis5d51ae22009-07-15 18:59:40 +000039// RUN: index-test %t.ast -point-at %s:15:10 | grep field_var