1*f4a2713aSLionel Sambuc struct Point { 2*f4a2713aSLionel Sambuc float x; 3*f4a2713aSLionel Sambuc float y; 4*f4a2713aSLionel Sambuc float z; 5*f4a2713aSLionel Sambuc }; 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc #define MACRO2(x) x 8*f4a2713aSLionel Sambuc #define MACRO(x) MACRO2(x) 9*f4a2713aSLionel Sambuc test(struct Point * p)10*f4a2713aSLionel Sambucvoid test(struct Point *p) { 11*f4a2713aSLionel Sambuc p->x; 12*f4a2713aSLionel Sambuc MACRO(p->x); 13*f4a2713aSLionel Sambuc } 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc #define MACRO3(x,y,z) x;y;z 16*f4a2713aSLionel Sambuc test2(struct Point * p)17*f4a2713aSLionel Sambucvoid test2(struct Point *p) { 18*f4a2713aSLionel Sambuc MACRO3(p->x); 19*f4a2713aSLionel Sambuc MACRO3(p->x 20*f4a2713aSLionel Sambuc } 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc #define FM(x) x 23*f4a2713aSLionel Sambuc void test3(struct Point *p) { 24*f4a2713aSLionel Sambuc FM(p->x, a); 25*f4a2713aSLionel Sambuc } 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc #define VGM(...) 0 28*f4a2713aSLionel Sambuc #define VGM2(...) __VA_ARGS__ 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc // These need to be last, to test proper handling of EOF. 31*f4a2713aSLionel Sambuc #ifdef EOF_TEST1 32*f4a2713aSLionel Sambuc void test3(struct Point *p) { 33*f4a2713aSLionel Sambuc VGM(1,2, p->x 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc #elif EOF_TEST2 36*f4a2713aSLionel Sambuc void test3(struct Point *p) { 37*f4a2713aSLionel Sambuc VGM2(VGM(1,2, p->x 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc #endif 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:11:12 %s | FileCheck %s 42*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:12:12 %s | FileCheck %s 43*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:18:13 %s | FileCheck %s 44*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:19:13 %s | FileCheck %s 45*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:24:9 %s | FileCheck %s 46*f4a2713aSLionel Sambuc // CHECK: FieldDecl:{ResultType float}{TypedText x} (35) 47*f4a2713aSLionel Sambuc // CHECK-NEXT: FieldDecl:{ResultType float}{TypedText y} (35) 48*f4a2713aSLionel Sambuc // CHECK-NEXT: FieldDecl:{ResultType float}{TypedText z} (35) 49*f4a2713aSLionel Sambuc // CHECK-NEXT: Completion contexts: 50*f4a2713aSLionel Sambuc // CHECK-NEXT: Arrow member access 51*f4a2713aSLionel Sambuc // CHECK-NEXT: Container Kind: StructDecl 52*f4a2713aSLionel Sambuc 53*f4a2713aSLionel Sambuc // With these, code-completion is unknown because the macro argument (and the 54*f4a2713aSLionel Sambuc // completion point) is not expanded by the macro definition. 55*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:33:15 %s -DEOF_TEST1 | FileCheck %s -check-prefix=CHECK-EOF 56*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:37:20 %s -DEOF_TEST2 | FileCheck %s -check-prefix=CHECK-EOF 57*f4a2713aSLionel Sambuc // CHECK-EOF: Completion contexts: 58*f4a2713aSLionel Sambuc // CHECK-EOF: Unknown 59