16bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines#include "complete-macros.h"
26bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// Note: the run lines follow their respective tests, since line/column matter in this test.
309d9fa1933499cb2808cd97b2db16ee11a990ef9Douglas Gregor#define FOO(Arg1,Arg2) foobar
4590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor#define nil 0
53644d970095d9c638c658cfd17f8e19fc333aadcDouglas Gregor#undef FOO
609d9fa1933499cb2808cd97b2db16ee11a990ef9Douglas Gregorvoid f() {
709d9fa1933499cb2808cd97b2db16ee11a990ef9Douglas Gregor
809d9fa1933499cb2808cd97b2db16ee11a990ef9Douglas Gregor}
909d9fa1933499cb2808cd97b2db16ee11a990ef9Douglas Gregor
10590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregorvoid g(int);
11590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor
12590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregorvoid f2() {
13590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor  int *ip = nil;
14590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor  ip = nil;
15590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor  g(nil);
16590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor}
17590c7d5e79d350162d485f039018cbeb47f3b547Douglas Gregor
18e42447021239015db97202fb04c304d82e84135fDouglas Gregor#define variadic1(...)
19e42447021239015db97202fb04c304d82e84135fDouglas Gregor#define variadic2(args...)
20e42447021239015db97202fb04c304d82e84135fDouglas Gregor#define variadic3(args, ...)
21e42447021239015db97202fb04c304d82e84135fDouglas Gregor#define variadic4(first, second, args, ...)
22c8dc1352071575c36401158094a865ad682fb886Douglas Gregor#define variadic5(first, second, args ...)
23e42447021239015db97202fb04c304d82e84135fDouglas Gregor
24e42447021239015db97202fb04c304d82e84135fDouglas Gregorvoid test_variadic() {
25e42447021239015db97202fb04c304d82e84135fDouglas Gregor
26e42447021239015db97202fb04c304d82e84135fDouglas Gregor}
27e42447021239015db97202fb04c304d82e84135fDouglas Gregor
286bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC0 %s
293644d970095d9c638c658cfd17f8e19fc333aadcDouglas Gregor// CHECK-CC0-NOT: FOO
306bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC1 %s
3109d9fa1933499cb2808cd97b2db16ee11a990ef9Douglas Gregor// CHECK-CC1: macro definition:{TypedText FOO}{LeftParen (}{Placeholder Arg1}{Comma , }{Placeholder Arg2}{RightParen )}
326bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: c-index-test -code-completion-at=%s:13:13 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
336bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
346bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
35d754d5546ef1faa4216298fd95bc6a7f15808fd2Douglas Gregor// CHECK-CC2: macro definition:{TypedText nil} (32)
366bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC3 %s
376bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC3 %s
38d754d5546ef1faa4216298fd95bc6a7f15808fd2Douglas Gregor// CHECK-CC3: macro definition:{TypedText nil} (65)
396bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:25:2 %s -I%S | FileCheck -check-prefix=CHECK-VARIADIC %s
40e42447021239015db97202fb04c304d82e84135fDouglas Gregor// CHECK-VARIADIC: macro definition:{TypedText variadic1}{LeftParen (}{Placeholder ...}{RightParen )} (70)
41e42447021239015db97202fb04c304d82e84135fDouglas Gregor// CHECK-VARIADIC: macro definition:{TypedText variadic2}{LeftParen (}{Placeholder args...}{RightParen )} (70)
42e42447021239015db97202fb04c304d82e84135fDouglas Gregor// CHECK-VARIADIC: macro definition:{TypedText variadic3}{LeftParen (}{Placeholder args, ...}{RightParen )} (70)
43c8dc1352071575c36401158094a865ad682fb886Douglas Gregor// CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args, ...}{RightParen )} (70)
44c8dc1352071575c36401158094a865ad682fb886Douglas Gregor// CHECK-VARIADIC: macro definition:{TypedText variadic5}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args...}{RightParen )} (70)
456bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines
466bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC4 %s
476bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines// CHECK-CC4-NOT: COMPLETE_MACROS_H_GUARD
48