diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-09 16:04:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-09 16:04:45 +0000 |
commit | 3ac738567fdf4df636b9e76c5a2d3dc3d6f80235 (patch) | |
tree | b75b81da1d4a99bdf03af9cefab8a882958270ac /test/Index/code-completion.cpp | |
parent | cd5a5056e0fbac624c504c4a33d57160723cd71d (diff) |
Minor cleanup for CIndex-based code-completion:
- Provide an actual test for code-completion via CIndex.
- Actually print optional strings in c-index-test
- Export clang_getCompletionChunkCompletionString from CIndex
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/code-completion.cpp')
-rw-r--r-- | test/Index/code-completion.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp new file mode 100644 index 0000000000..875c746525 --- /dev/null +++ b/test/Index/code-completion.cpp @@ -0,0 +1,51 @@ +// Code-completion through the C interface + +struct X { + int member; +}; + +struct Y { + float member; + void memfunc(int i = 17); +}; + +struct Z : X, Y { + double member; + operator int() const; +}; + +struct Z get_Z(); + +void test_Z() { + // RUN: c-index-test -code-completion-at=%s:21:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s + get_Z().member = 17; +} + + +float& overloaded(int i, long second); +double& overloaded(float f, int second); +int& overloaded(Z z, int second); + +void test_overloaded() { + // RUN: c-index-test -code-completion-at=%s:31:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s + overloaded(Z(), 0); +} + +// CHECK-MEMBER: FieldDecl:{TypedText member} +// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{TypedText ~Z}{LeftParen (}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )} +// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} +// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} +// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} +// CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member} +// CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member} +// CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )} + +// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )} +// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} +// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )} |