Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 1 | /* Run lines are at the end, since line/column matter in this test. */ |
| 2 | |
| 3 | enum Color { |
| 4 | Red, Green, Blue |
| 5 | }; |
| 6 | |
| 7 | enum Priority { |
| 8 | Low, |
| 9 | High |
| 10 | }; |
| 11 | |
| 12 | int func1(enum Color); |
| 13 | enum Priority func2(int); |
| 14 | void func3(float); |
| 15 | enum Priority test1(enum Priority priority, enum Color color, int integer) { |
| 16 | int i = integer; |
| 17 | enum Color c = color; |
| 18 | return priority; |
| 19 | func1(c); |
| 20 | void (^block)(enum Color, int); |
| 21 | block(c, 17); |
| 22 | c = color; |
| 23 | } |
| 24 | |
Douglas Gregor | b9d7757 | 2010-09-21 00:03:25 +0000 | [diff] [blame] | 25 | @interface A |
| 26 | + (void)method:(enum Color)color priority:(enum Priority)priority; |
| 27 | - (void)method:(enum Color)color priority:(enum Priority)priority; |
| 28 | @end |
| 29 | |
| 30 | void test2(A *a) { |
| 31 | [a method:Red priority:High]; |
| 32 | [A method:Red priority:Low]; |
| 33 | } |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 34 | |
| 35 | // RUN: c-index-test -code-completion-at=%s:16:11 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 36 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (32) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 37 | // CHECK-CC1: ParmDecl:{ResultType enum Color}{TypedText color} (17) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 38 | // CHECK-CC1: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (12) |
| 39 | // CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (25) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 40 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (32) |
| 41 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (32) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 42 | // CHECK-CC1: VarDecl:{ResultType int}{TypedText i} (8) |
| 43 | // CHECK-CC1: ParmDecl:{ResultType int}{TypedText integer} (8) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 44 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (32) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 45 | // CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (17) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 46 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (32) |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 47 | // CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 48 | // CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25) |
| 49 | // RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 50 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 51 | // CHECK-CC2: VarDecl:{ResultType enum Color}{TypedText c} (8) |
| 52 | // CHECK-CC2: ParmDecl:{ResultType enum Color}{TypedText color} (8) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 53 | // CHECK-CC2: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 54 | // CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 55 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16) |
| 56 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 57 | // CHECK-CC2: VarDecl:{ResultType int}{TypedText i} (17) |
| 58 | // CHECK-CC2: ParmDecl:{ResultType int}{TypedText integer} (17) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 59 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 60 | // CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (34) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 61 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 62 | // CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 63 | // CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |
| 64 | // RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 65 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 66 | // CHECK-CC3: VarDecl:{ResultType enum Color}{TypedText c} (34) |
| 67 | // CHECK-CC3: ParmDecl:{ResultType enum Color}{TypedText color} (34) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 68 | // CHECK-CC3: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 69 | // CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (12) |
| 70 | // CHECK-CC3: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 71 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (65) |
| 72 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (16) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 73 | // CHECK-CC3: VarDecl:{ResultType int}{TypedText i} (17) |
| 74 | // CHECK-CC3: ParmDecl:{ResultType int}{TypedText integer} (17) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 75 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 76 | // CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 77 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65) |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 78 | // CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 79 | // CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12) |
| 80 | // RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 81 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 82 | // CHECK-CC4: VarDecl:{ResultType enum Color}{TypedText c} (8) |
| 83 | // CHECK-CC4: ParmDecl:{ResultType enum Color}{TypedText color} (8) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 84 | // CHECK-CC4: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 85 | // CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
| 86 | // CHECK-CC4: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 87 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16) |
| 88 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 89 | // CHECK-CC4: VarDecl:{ResultType int}{TypedText i} (17) |
| 90 | // CHECK-CC4: ParmDecl:{ResultType int}{TypedText integer} (17) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 91 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 92 | // CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (34) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 93 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 94 | // CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 95 | // CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |
| 96 | // RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s |
| 97 | // RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 98 | // CHECK-CC6: VarDecl:{ResultType void (^)(enum Color, int)}{TypedText block} (34) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 99 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 100 | // CHECK-CC6: VarDecl:{ResultType enum Color}{TypedText c} (8) |
| 101 | // CHECK-CC6: ParmDecl:{ResultType enum Color}{TypedText color} (8) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 102 | // CHECK-CC6: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 103 | // CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
| 104 | // CHECK-CC6: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 105 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16) |
| 106 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 107 | // CHECK-CC6: VarDecl:{ResultType int}{TypedText i} (17) |
| 108 | // CHECK-CC6: ParmDecl:{ResultType int}{TypedText integer} (17) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 109 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 110 | // CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (34) |
Douglas Gregor | d754d55 | 2010-09-16 16:21:35 +0000 | [diff] [blame] | 111 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 112 | // CHECK-CC6: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 113 | // CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |
Douglas Gregor | b9d7757 | 2010-09-21 00:03:25 +0000 | [diff] [blame] | 114 | // RUN: c-index-test -code-completion-at=%s:31:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s |
| 115 | // RUN: c-index-test -code-completion-at=%s:32:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 116 | // CHECK-CC7: ParmDecl:{ResultType A *}{TypedText a} (34) |
Douglas Gregor | b9d7757 | 2010-09-21 00:03:25 +0000 | [diff] [blame] | 117 | // CHECK-CC7: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16) |
| 118 | // CHECK-CC7: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 119 | // CHECK-CC7: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
| 120 | // CHECK-CC7: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
| 121 | // CHECK-CC7: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16) |
| 122 | // CHECK-CC7: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65) |
| 123 | // CHECK-CC7: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) |
| 124 | // CHECK-CC7: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) |
| 125 | // CHECK-CC7: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |
| 126 | // RUN: c-index-test -code-completion-at=%s:31:26 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s |
| 127 | // RUN: c-index-test -code-completion-at=%s:32:26 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 128 | // CHECK-CC8: ParmDecl:{ResultType A *}{TypedText a} (34) |
Douglas Gregor | b9d7757 | 2010-09-21 00:03:25 +0000 | [diff] [blame] | 129 | // CHECK-CC8: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65) |
| 130 | // CHECK-CC8: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 131 | // CHECK-CC8: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (12) |
| 132 | // CHECK-CC8: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
| 133 | // CHECK-CC8: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (65) |
| 134 | // CHECK-CC8: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (16) |
| 135 | // CHECK-CC8: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16) |
| 136 | // CHECK-CC8: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65) |
| 137 | // CHECK-CC8: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12) |