| 1 |
// Note: the run lines follow their respective tests, since line/column |
| 2 |
// matter in this test. |
| 3 |
|
| 4 |
void foo(int a = 42, int = 42); |
| 5 |
void bar(int a, int b = 42, int c = 42); |
| 6 |
void baz(int a = 42, ...); |
| 7 |
struct S{ S(int a = 42, int = 42) {} }; |
| 8 |
|
| 9 |
class Bar1 { public: Bar1() {} }; class Bar2; |
| 10 |
void foo_2(Bar1 b1 = Bar1(), Bar2 b2 = Bar2()); |
| 11 |
|
| 12 |
int main() { |
| 13 |
foo(42, 42); |
| 14 |
bar(42, 42, 42); |
| 15 |
baz(42, 42, 42); |
| 16 |
S s(42, 42); |
| 17 |
foo_2(); |
| 18 |
} |
| 19 |
|
| 20 |
// RUN: c-index-test -code-completion-at=%s:13:9 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 21 |
// CHECK-CC1: OverloadCandidate:{ResultType void}{Text foo}{LeftParen (}{Optional {CurrentParameter int a = 42}{Optional {Comma , }{Placeholder int = 42}}}{RightParen )} (1) |
| 22 |
// CHECK-CC1: Completion contexts: |
| 23 |
// CHECK-CC1-NEXT: Any type |
| 24 |
// CHECK-CC1-NEXT: Any value |
| 25 |
// CHECK-CC1-NEXT: Enum tag |
| 26 |
// CHECK-CC1-NEXT: Union tag |
| 27 |
// CHECK-CC1-NEXT: Struct tag |
| 28 |
// CHECK-CC1-NEXT: Class name |
| 29 |
// CHECK-CC1-NEXT: Nested name specifier |
| 30 |
// CHECK-CC1-NEXT: Objective-C interface |
| 31 |
|
| 32 |
// RUN: c-index-test -code-completion-at=%s:14:9 %s | FileCheck -check-prefix=CHECK-CC2 %s |
| 33 |
// CHECK-CC2: OverloadCandidate:{ResultType void}{Text bar}{LeftParen (}{CurrentParameter int a}{Optional {Comma , }{Placeholder int b = 42}{Optional {Comma , }{Placeholder int c = 42}}}{RightParen )} (1) |
| 34 |
// CHECK-CC2: Completion contexts: |
| 35 |
// CHECK-CC2-NEXT: Any type |
| 36 |
// CHECK-CC2-NEXT: Any value |
| 37 |
// CHECK-CC2-NEXT: Enum tag |
| 38 |
// CHECK-CC2-NEXT: Union tag |
| 39 |
// CHECK-CC2-NEXT: Struct tag |
| 40 |
// CHECK-CC2-NEXT: Class name |
| 41 |
// CHECK-CC2-NEXT: Nested name specifier |
| 42 |
// CHECK-CC2-NEXT: Objective-C interface |
| 43 |
|
| 44 |
// RUN: c-index-test -code-completion-at=%s:14:16 %s | FileCheck -check-prefix=CHECK-CC3 %s |
| 45 |
// CHECK-CC3: OverloadCandidate:{ResultType void}{Text bar}{LeftParen (}{Placeholder int a}{Optional {Comma , }{Placeholder int b = 42}{Optional {Comma , }{CurrentParameter int c = 42}}}{RightParen )} (1) |
| 46 |
// CHECK-CC3: Completion contexts: |
| 47 |
// CHECK-CC3-NEXT: Any type |
| 48 |
// CHECK-CC3-NEXT: Any value |
| 49 |
// CHECK-CC3-NEXT: Enum tag |
| 50 |
// CHECK-CC3-NEXT: Union tag |
| 51 |
// CHECK-CC3-NEXT: Struct tag |
| 52 |
// CHECK-CC3-NEXT: Class name |
| 53 |
// CHECK-CC3-NEXT: Nested name specifier |
| 54 |
// CHECK-CC3-NEXT: Objective-C interface |
| 55 |
|
| 56 |
// RUN: c-index-test -code-completion-at=%s:15:16 %s | FileCheck -check-prefix=CHECK-CC4 %s |
| 57 |
// CHECK-CC4: OverloadCandidate:{ResultType void}{Text baz}{LeftParen (}{Optional {Placeholder int a = 42}{Optional {Comma , }{CurrentParameter ...}}}{RightParen )} (1) |
| 58 |
// CHECK-CC4: Completion contexts: |
| 59 |
// CHECK-CC4-NEXT: Any type |
| 60 |
// CHECK-CC4-NEXT: Any value |
| 61 |
// CHECK-CC4-NEXT: Enum tag |
| 62 |
// CHECK-CC4-NEXT: Union tag |
| 63 |
// CHECK-CC4-NEXT: Struct tag |
| 64 |
// CHECK-CC4-NEXT: Class name |
| 65 |
// CHECK-CC4-NEXT: Nested name specifier |
| 66 |
// CHECK-CC4-NEXT: Objective-C interface |
| 67 |
|
| 68 |
// RUN: c-index-test -code-completion-at=%s:16:9 %s | FileCheck -check-prefix=CHECK-CC5 %s |
| 69 |
// CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{Optional {CurrentParameter int a = 42}{Optional {Comma , }{Placeholder int = 42}}}{RightParen )} (1) |
| 70 |
// CHECK-CC5: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S &}{RightParen )} (1) |
| 71 |
// CHECK-CC5: Completion contexts: |
| 72 |
// CHECK-CC5-NEXT: Any type |
| 73 |
// CHECK-CC5-NEXT: Any value |
| 74 |
// CHECK-CC5-NEXT: Enum tag |
| 75 |
// CHECK-CC5-NEXT: Union tag |
| 76 |
// CHECK-CC5-NEXT: Struct tag |
| 77 |
// CHECK-CC5-NEXT: Class name |
| 78 |
// CHECK-CC5-NEXT: Nested name specifier |
| 79 |
// CHECK-CC5-NEXT: Objective-C interface |
| 80 |
|
| 81 |
// RUN: c-index-test -code-completion-at=%s:17:11 %s | FileCheck -check-prefix=CHECK-CC6 %s |
| 82 |
// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText foo_2}{LeftParen (}{Optional {Placeholder Bar1 b1 = Bar1()}{Optional {Comma , }{Placeholder Bar2 b2 = Bar2()}}}{RightParen )} (50) |
| 83 |
// CHECK-CC6: Completion contexts: |
| 84 |
// CHECK-CC6-NEXT: Any type |
| 85 |
// CHECK-CC6-NEXT: Any value |
| 86 |
// CHECK-CC6-NEXT: Enum tag |
| 87 |
// CHECK-CC6-NEXT: Union tag |
| 88 |
// CHECK-CC6-NEXT: Struct tag |
| 89 |
// CHECK-CC6-NEXT: Class name |
| 90 |
// CHECK-CC6-NEXT: Nested name specifier |
| 91 |
// CHECK-CC6-NEXT: Objective-C interface |