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 | |
| 25 | // FIXME: It would be great for message sends to have the same |
| 26 | // benefits as function calls, but we don't quite have the |
| 27 | // infrastructure yet. |
| 28 | |
| 29 | // RUN: c-index-test -code-completion-at=%s:16:11 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 30 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (30) |
| 31 | // CHECK-CC1: ParmDecl:{ResultType enum Color}{TypedText color} (4) |
| 32 | // CHECK-CC1: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (12) |
| 33 | // CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (25) |
| 34 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (30) |
| 35 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (30) |
| 36 | // CHECK-CC1: VarDecl:{ResultType int}{TypedText i} (2) |
| 37 | // CHECK-CC1: ParmDecl:{ResultType int}{TypedText integer} (2) |
| 38 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (30) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 39 | // CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (4) |
| 40 | // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (30) |
| 41 | // CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) |
| 42 | // CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25) |
| 43 | // RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s |
| 44 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15) |
| 45 | // CHECK-CC2: VarDecl:{ResultType enum Color}{TypedText c} (2) |
| 46 | // CHECK-CC2: ParmDecl:{ResultType enum Color}{TypedText color} (2) |
| 47 | // CHECK-CC2: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 48 | // CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
| 49 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15) |
| 50 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60) |
| 51 | // CHECK-CC2: VarDecl:{ResultType int}{TypedText i} (4) |
| 52 | // CHECK-CC2: ParmDecl:{ResultType int}{TypedText integer} (4) |
| 53 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 54 | // CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) |
| 55 | // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15) |
| 56 | // CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) |
| 57 | // CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |
| 58 | // RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s |
| 59 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (60) |
| 60 | // CHECK-CC3: VarDecl:{ResultType enum Color}{TypedText c} (8) |
| 61 | // CHECK-CC3: ParmDecl:{ResultType enum Color}{TypedText color} (8) |
| 62 | // CHECK-CC3: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 63 | // CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (12) |
| 64 | // CHECK-CC3: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
| 65 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (60) |
| 66 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (15) |
| 67 | // CHECK-CC3: VarDecl:{ResultType int}{TypedText i} (4) |
| 68 | // CHECK-CC3: ParmDecl:{ResultType int}{TypedText integer} (4) |
| 69 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (15) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 70 | // CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (2) |
| 71 | // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (60) |
| 72 | // CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) |
| 73 | // CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12) |
| 74 | // RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s |
| 75 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15) |
| 76 | // CHECK-CC4: VarDecl:{ResultType enum Color}{TypedText c} (2) |
| 77 | // CHECK-CC4: ParmDecl:{ResultType enum Color}{TypedText color} (2) |
| 78 | // CHECK-CC4: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 79 | // CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
| 80 | // CHECK-CC4: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
| 81 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15) |
| 82 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60) |
| 83 | // CHECK-CC4: VarDecl:{ResultType int}{TypedText i} (4) |
| 84 | // CHECK-CC4: ParmDecl:{ResultType int}{TypedText integer} (4) |
| 85 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 86 | // CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) |
| 87 | // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15) |
| 88 | // CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) |
| 89 | // CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |
| 90 | // RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s |
| 91 | // RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s |
| 92 | // CHECK-CC6: VarDecl:{ResultType void (^)(enum Color, int)}{TypedText block} (8) |
| 93 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15) |
| 94 | // CHECK-CC6: VarDecl:{ResultType enum Color}{TypedText c} (2) |
| 95 | // CHECK-CC6: ParmDecl:{ResultType enum Color}{TypedText color} (2) |
| 96 | // CHECK-CC6: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) |
| 97 | // CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) |
| 98 | // CHECK-CC6: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) |
| 99 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15) |
| 100 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60) |
| 101 | // CHECK-CC6: VarDecl:{ResultType int}{TypedText i} (4) |
| 102 | // CHECK-CC6: ParmDecl:{ResultType int}{TypedText integer} (4) |
| 103 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60) |
Douglas Gregor | 5ac3bdb | 2010-05-30 01:49:25 +0000 | [diff] [blame] | 104 | // CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) |
| 105 | // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15) |
| 106 | // CHECK-CC6: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) |
| 107 | // CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) |