blob: 8efaaf26c136744f3081664b9a0e59a8db1b68cf [file] [log] [blame]
Douglas Gregor0396f462010-03-19 05:22:59 +00001#define OBSCURE(X) X
2#define DECORATION
Argyrios Kyrtzidis664b06f2013-01-07 19:16:25 +00003#define FNM(X) OBSCURE(X)
Douglas Gregor0396f462010-03-19 05:22:59 +00004typedef int T;
5void OBSCURE(func)(int x) {
6 OBSCURE(T) DECORATION value;
7}
8
Douglas Gregord93fae62010-10-21 20:55:34 +00009#include "a.h"
10
Douglas Gregor85fe1562010-12-10 07:23:11 +000011#define A(X) X
12#define B(X) A(X)
13
14B(int x);
15
Argyrios Kyrtzidis8f7c5402011-09-08 17:18:41 +000016const char *fname = __FILE__;
17
Argyrios Kyrtzidis59cabd72012-09-11 02:17:21 +000018#include <a.h>
19
Argyrios Kyrtzidis5f5250b2012-12-08 02:21:17 +000020#ifdef OBSCURE
21#endif
22
23#if defined(OBSCURE)
24#endif
25
Argyrios Kyrtzidis664b06f2013-01-07 19:16:25 +000026#define C(A) A
27
Douglas Gregord93fae62010-10-21 20:55:34 +000028// RUN: c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s
Douglas Gregor0396f462010-03-19 05:22:59 +000029// CHECK-1: macro definition=OBSCURE
Douglas Gregord93fae62010-10-21 20:55:34 +000030// RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s
Douglas Gregor0396f462010-03-19 05:22:59 +000031// CHECK-2: macro definition=DECORATION
Douglas Gregord93fae62010-10-21 20:55:34 +000032// RUN: c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s
Chandler Carruth9b2a0ac2011-07-14 08:41:15 +000033// CHECK-3: macro expansion=OBSCURE:1:9
Douglas Gregord93fae62010-10-21 20:55:34 +000034// RUN: c-index-test -cursor-at=%s:6:6 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-4 %s
Chandler Carruth9b2a0ac2011-07-14 08:41:15 +000035// CHECK-4: macro expansion=OBSCURE:1:9
Douglas Gregord93fae62010-10-21 20:55:34 +000036// RUN: c-index-test -cursor-at=%s:6:19 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-5 %s
Chandler Carruth9b2a0ac2011-07-14 08:41:15 +000037// CHECK-5: macro expansion=DECORATION:2:9
Douglas Gregord93fae62010-10-21 20:55:34 +000038// RUN: c-index-test -cursor-at=%s:9:10 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-6 %s
39// CHECK-6: inclusion directive=a.h
Douglas Gregor85fe1562010-12-10 07:23:11 +000040// RUN: c-index-test -cursor-at=%s:14:1 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-7 %s
Chandler Carruth9b2a0ac2011-07-14 08:41:15 +000041// CHECK-7: macro expansion=B:12:9
Argyrios Kyrtzidis8f7c5402011-09-08 17:18:41 +000042// RUN: c-index-test -cursor-at=%s:16:25 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-8 %s
43// CHECK-8: macro expansion=__FILE__
Argyrios Kyrtzidis59cabd72012-09-11 02:17:21 +000044// RUN: c-index-test -cursor-at=%s:18:12 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-9 %s
45// CHECK-9: inclusion directive=a.h
Argyrios Kyrtzidis5f5250b2012-12-08 02:21:17 +000046// RUN: c-index-test -cursor-at=%s:20:10 -cursor-at=%s:23:15 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-10 %s
47// CHECK-10: 20:8 macro expansion=OBSCURE
48// CHECK-10: 23:13 macro expansion=OBSCURE
Douglas Gregor89d99802010-11-30 06:16:57 +000049
Argyrios Kyrtzidis664b06f2013-01-07 19:16:25 +000050// RUN: c-index-test -cursor-at=%s:3:20 -cursor-at=%s:12:14 \
51// RUN: -cursor-at=%s:26:11 -cursor-at=%s:26:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-IN-MACRODEF %s
52// CHECK-IN-MACRODEF: 3:16 macro expansion=OBSCURE
53// CHECK-IN-MACRODEF: 12:14 macro expansion=A
54// CHECK-IN-MACRODEF: 26:9 macro definition=C
55// CHECK-IN-MACRODEF: 26:9 macro definition=C
56
Douglas Gregor89d99802010-11-30 06:16:57 +000057// Same tests, but with "editing" optimizations
58// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s
59// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s
60// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s
61// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:9:10 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-6 %s
Argyrios Kyrtzidis664b06f2013-01-07 19:16:25 +000062// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:3:20 -cursor-at=%s:12:14 \
63// RUN: -cursor-at=%s:26:11 -cursor-at=%s:26:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-IN-MACRODEF %s