| 1 | #define OBSCURE(X) X |
| 2 | #define DECORATION |
| 3 | #define FNM(X) OBSCURE(X) |
| 4 | typedef int T; |
| 5 | void OBSCURE(func)(int x) { |
| 6 | OBSCURE(T) DECORATION value; |
| 7 | } |
| 8 | |
| 9 | #include "a.h" |
| 10 | |
| 11 | #define A(X) X |
| 12 | #define B(X) A(X) |
| 13 | |
| 14 | B(int x); |
| 15 | |
| 16 | const char *fname = __FILE__; |
| 17 | |
| 18 | #include <a.h> |
| 19 | |
| 20 | #ifdef OBSCURE |
| 21 | #endif |
| 22 | |
| 23 | #if defined(OBSCURE) |
| 24 | #endif |
| 25 | |
| 26 | #define C(A) A |
| 27 | |
| 28 | // RUN: c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s |
| 29 | // CHECK-1: macro definition=OBSCURE |
| 30 | // RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s |
| 31 | // CHECK-2: macro definition=DECORATION |
| 32 | // RUN: c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s |
| 33 | // CHECK-3: macro expansion=OBSCURE:1:9 |
| 34 | // RUN: c-index-test -cursor-at=%s:6:6 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-4 %s |
| 35 | // CHECK-4: macro expansion=OBSCURE:1:9 |
| 36 | // RUN: c-index-test -cursor-at=%s:6:19 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-5 %s |
| 37 | // CHECK-5: macro expansion=DECORATION:2:9 |
| 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 |
| 40 | // RUN: c-index-test -cursor-at=%s:14:1 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-7 %s |
| 41 | // CHECK-7: macro expansion=B:12:9 |
| 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__ |
| 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 |
| 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 |
| 49 | |
| 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 | |
| 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 |
| 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 |
| 64 | |