brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 2507984 Raw
59 lines · c
1struct Point {2  float x;3  float y;4  float z;5};6 7#define MACRO2(x) x8#define MACRO(x) MACRO2(x)9 10void test(struct Point *p) {11        p->x;12  MACRO(p->x);13}14 15#define MACRO3(x,y,z) x;y;z16 17void test2(struct Point *p) {18  MACRO3(p->x);19  MACRO3(p->x20}21 22#define FM(x) x23void test3(struct Point *p) {24  FM(p->x, a);25}26 27#define VGM(...) 028#define VGM2(...) __VA_ARGS__29 30// These need to be last, to test proper handling of EOF.31#ifdef EOF_TEST132void test3(struct Point *p) {33  VGM(1,2, p->x34 35#elif EOF_TEST236void test3(struct Point *p) {37  VGM2(VGM(1,2, p->x38 39#endif40 41// RUN: c-index-test -code-completion-at=%s:11:12 %s | FileCheck %s42// RUN: c-index-test -code-completion-at=%s:12:12 %s | FileCheck %s43// RUN: c-index-test -code-completion-at=%s:18:13 %s | FileCheck %s44// RUN: c-index-test -code-completion-at=%s:19:13 %s | FileCheck %s45// RUN: c-index-test -code-completion-at=%s:24:9 %s | FileCheck %s46// CHECK:      FieldDecl:{ResultType float}{TypedText x} (35)47// CHECK-NEXT: FieldDecl:{ResultType float}{TypedText y} (35)48// CHECK-NEXT: FieldDecl:{ResultType float}{TypedText z} (35)49// CHECK-NEXT: Completion contexts:50// CHECK-NEXT: Arrow member access51// CHECK-NEXT: Container Kind: StructDecl52 53// With these, code-completion is unknown because the macro argument (and the54// completion point) is not expanded by the macro definition.55// RUN: c-index-test -code-completion-at=%s:33:15 %s -DEOF_TEST1 | FileCheck %s -check-prefix=CHECK-EOF56// RUN: c-index-test -code-completion-at=%s:37:20 %s -DEOF_TEST2 | FileCheck %s -check-prefix=CHECK-EOF57// CHECK-EOF: Completion contexts:58// CHECK-EOF: Unknown59