Douglas Gregor | 0396f46 | 2010-03-19 05:22:59 +0000 | [diff] [blame] | 1 | #define OBSCURE(X) X |
| 2 | #define DECORATION |
Argyrios Kyrtzidis | 664b06f | 2013-01-07 19:16:25 +0000 | [diff] [blame] | 3 | #define FNM(X) OBSCURE(X) |
Douglas Gregor | 0396f46 | 2010-03-19 05:22:59 +0000 | [diff] [blame] | 4 | typedef int T; |
| 5 | void OBSCURE(func)(int x) { |
| 6 | OBSCURE(T) DECORATION value; |
| 7 | } |
| 8 | |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 9 | #include "a.h" |
| 10 | |
Douglas Gregor | 85fe156 | 2010-12-10 07:23:11 +0000 | [diff] [blame] | 11 | #define A(X) X |
| 12 | #define B(X) A(X) |
| 13 | |
| 14 | B(int x); |
| 15 | |
Argyrios Kyrtzidis | 8f7c540 | 2011-09-08 17:18:41 +0000 | [diff] [blame] | 16 | const char *fname = __FILE__; |
| 17 | |
Argyrios Kyrtzidis | 59cabd7 | 2012-09-11 02:17:21 +0000 | [diff] [blame] | 18 | #include <a.h> |
| 19 | |
Argyrios Kyrtzidis | 5f5250b | 2012-12-08 02:21:17 +0000 | [diff] [blame] | 20 | #ifdef OBSCURE |
| 21 | #endif |
| 22 | |
| 23 | #if defined(OBSCURE) |
| 24 | #endif |
| 25 | |
Argyrios Kyrtzidis | 664b06f | 2013-01-07 19:16:25 +0000 | [diff] [blame] | 26 | #define C(A) A |
| 27 | |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 28 | // RUN: c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s |
Douglas Gregor | 0396f46 | 2010-03-19 05:22:59 +0000 | [diff] [blame] | 29 | // CHECK-1: macro definition=OBSCURE |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 30 | // RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s |
Douglas Gregor | 0396f46 | 2010-03-19 05:22:59 +0000 | [diff] [blame] | 31 | // CHECK-2: macro definition=DECORATION |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 32 | // RUN: c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s |
Chandler Carruth | 9b2a0ac | 2011-07-14 08:41:15 +0000 | [diff] [blame] | 33 | // CHECK-3: macro expansion=OBSCURE:1:9 |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 34 | // RUN: c-index-test -cursor-at=%s:6:6 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-4 %s |
Chandler Carruth | 9b2a0ac | 2011-07-14 08:41:15 +0000 | [diff] [blame] | 35 | // CHECK-4: macro expansion=OBSCURE:1:9 |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 36 | // RUN: c-index-test -cursor-at=%s:6:19 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-5 %s |
Chandler Carruth | 9b2a0ac | 2011-07-14 08:41:15 +0000 | [diff] [blame] | 37 | // CHECK-5: macro expansion=DECORATION:2:9 |
Douglas Gregor | d93fae6 | 2010-10-21 20:55:34 +0000 | [diff] [blame] | 38 | // 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 Gregor | 85fe156 | 2010-12-10 07:23:11 +0000 | [diff] [blame] | 40 | // RUN: c-index-test -cursor-at=%s:14:1 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-7 %s |
Chandler Carruth | 9b2a0ac | 2011-07-14 08:41:15 +0000 | [diff] [blame] | 41 | // CHECK-7: macro expansion=B:12:9 |
Argyrios Kyrtzidis | 8f7c540 | 2011-09-08 17:18:41 +0000 | [diff] [blame] | 42 | // 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 Kyrtzidis | 59cabd7 | 2012-09-11 02:17:21 +0000 | [diff] [blame] | 44 | // 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 Kyrtzidis | 5f5250b | 2012-12-08 02:21:17 +0000 | [diff] [blame] | 46 | // 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 Gregor | 89d9980 | 2010-11-30 06:16:57 +0000 | [diff] [blame] | 49 | |
Argyrios Kyrtzidis | 664b06f | 2013-01-07 19:16:25 +0000 | [diff] [blame] | 50 | // 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 Gregor | 89d9980 | 2010-11-30 06:16:57 +0000 | [diff] [blame] | 57 | // 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 Kyrtzidis | 664b06f | 2013-01-07 19:16:25 +0000 | [diff] [blame] | 62 | // 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 |