2014-04-10 02:21:23 +08:00
|
|
|
#include "complete-macros.h"
|
|
|
|
// Note: the run lines follow their respective tests, since line/column matter in this test.
|
2010-04-06 00:10:30 +08:00
|
|
|
#define FOO(Arg1,Arg2) foobar
|
2010-07-09 04:55:51 +08:00
|
|
|
#define nil 0
|
2012-10-10 00:01:50 +08:00
|
|
|
#undef FOO
|
2010-04-06 00:10:30 +08:00
|
|
|
void f() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-07-09 04:55:51 +08:00
|
|
|
void g(int);
|
|
|
|
|
|
|
|
void f2() {
|
|
|
|
int *ip = nil;
|
|
|
|
ip = nil;
|
|
|
|
g(nil);
|
|
|
|
}
|
|
|
|
|
2011-07-30 16:17:44 +08:00
|
|
|
#define variadic1(...)
|
|
|
|
#define variadic2(args...)
|
|
|
|
#define variadic3(args, ...)
|
|
|
|
#define variadic4(first, second, args, ...)
|
2012-01-21 08:43:38 +08:00
|
|
|
#define variadic5(first, second, args ...)
|
2011-07-30 16:17:44 +08:00
|
|
|
|
|
|
|
void test_variadic() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-04-10 02:21:23 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC0 %s
|
2012-10-10 00:01:50 +08:00
|
|
|
// CHECK-CC0-NOT: FOO
|
2014-04-10 02:21:23 +08:00
|
|
|
// 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
|
2019-07-18 15:17:49 +08:00
|
|
|
// (we had a regression that only occurred when parsing as C++, so check that too)
|
|
|
|
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 -x c++ %s -I%S | FileCheck -check-prefix=CHECK-CC1 %s
|
2015-04-30 07:20:19 +08:00
|
|
|
// CHECK-CC1: macro definition:{TypedText FOO} (70)
|
2019-07-18 15:17:49 +08:00
|
|
|
// CHECK-CC1: macro definition:{TypedText MACRO_IN_HEADER} (70)
|
2014-04-10 02:21:23 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:13:13 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
|
|
|
|
// 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
|
2010-09-17 00:21:35 +08:00
|
|
|
// CHECK-CC2: macro definition:{TypedText nil} (32)
|
2014-04-10 02:21:23 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC3 %s
|
|
|
|
// 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
|
2010-09-17 00:21:35 +08:00
|
|
|
// CHECK-CC3: macro definition:{TypedText nil} (65)
|
2014-04-10 02:21:23 +08:00
|
|
|
// 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
|
2011-07-30 16:17:44 +08:00
|
|
|
// CHECK-VARIADIC: macro definition:{TypedText variadic1}{LeftParen (}{Placeholder ...}{RightParen )} (70)
|
|
|
|
// CHECK-VARIADIC: macro definition:{TypedText variadic2}{LeftParen (}{Placeholder args...}{RightParen )} (70)
|
|
|
|
// CHECK-VARIADIC: macro definition:{TypedText variadic3}{LeftParen (}{Placeholder args, ...}{RightParen )} (70)
|
2012-01-21 08:43:38 +08:00
|
|
|
// CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args, ...}{RightParen )} (70)
|
|
|
|
// CHECK-VARIADIC: macro definition:{TypedText variadic5}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args...}{RightParen )} (70)
|
2014-04-10 02:21:23 +08:00
|
|
|
|
|
|
|
// 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
|
|
|
|
// CHECK-CC4-NOT: COMPLETE_MACROS_H_GUARD
|