Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 1 | // Code-completion through the C interface |
Douglas Gregor | ac06a7c | 2009-11-09 16:06:30 +0000 | [diff] [blame] | 2 | #include "nonexistent_header.h" |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 3 | struct X { |
| 4 | int member; |
Douglas Gregor | ff4393c | 2009-11-09 21:35:27 +0000 | [diff] [blame] | 5 | |
| 6 | enum E { Val1 }; |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 7 | }; |
| 8 | |
| 9 | struct Y { |
| 10 | float member; |
| 11 | void memfunc(int i = 17); |
| 12 | }; |
| 13 | |
| 14 | struct Z : X, Y { |
| 15 | double member; |
| 16 | operator int() const; |
| 17 | }; |
| 18 | |
| 19 | struct Z get_Z(); |
| 20 | |
| 21 | void test_Z() { |
Douglas Gregor | ff4393c | 2009-11-09 21:35:27 +0000 | [diff] [blame] | 22 | // RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 23 | get_Z().member = 17; |
| 24 | } |
| 25 | |
| 26 | |
| 27 | float& overloaded(int i, long second); |
| 28 | double& overloaded(float f, int second); |
| 29 | int& overloaded(Z z, int second); |
| 30 | |
| 31 | void test_overloaded() { |
Douglas Gregor | ff4393c | 2009-11-09 21:35:27 +0000 | [diff] [blame] | 32 | // RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 33 | overloaded(Z(), 0); |
| 34 | } |
| 35 | |
Douglas Gregor | ff4393c | 2009-11-09 21:35:27 +0000 | [diff] [blame] | 36 | // CHECK-MEMBER: EnumDecl:{Informative X::}{TypedText E} |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 37 | // CHECK-MEMBER: FieldDecl:{TypedText member} |
| 38 | // CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} |
Douglas Gregor | ff4393c | 2009-11-09 21:35:27 +0000 | [diff] [blame] | 39 | // CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1} |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 40 | // CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} |
Douglas Gregor | 3ac7385 | 2009-11-09 16:04:45 +0000 | [diff] [blame] | 41 | // CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )} |
| 42 | // CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )} |
| 43 | // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} |
| 44 | // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} |
| 45 | // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} |
| 46 | // CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member} |
| 47 | // CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member} |
| 48 | // CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )} |
| 49 | // CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )} |
| 50 | |
| 51 | // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )} |
| 52 | // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} |
| 53 | // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )} |