diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-21 16:06:22 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-21 16:06:22 +0000 |
commit | 6f942b2cabf32b96f9901b889d8e44a34e0e7c62 (patch) | |
tree | 7bb74e2ffe505aeb68dcf56a5bc00e99ad9369d7 /test/Index/complete-exprs.cpp | |
parent | 3475cfeebe00908af47396d5a055237a0ad7cb8d (diff) |
Add code completion for C++ constructors wherever we see the class (or
class template) and are in a context where we can have a value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/complete-exprs.cpp')
-rw-r--r-- | test/Index/complete-exprs.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Index/complete-exprs.cpp b/test/Index/complete-exprs.cpp new file mode 100644 index 0000000000..1c99e7e7f8 --- /dev/null +++ b/test/Index/complete-exprs.cpp @@ -0,0 +1,37 @@ +// Line- and column-sensitive test; run lines follow. + +class string { + public: + string(); + string(const char *); + string(const char *, int n); +}; + +template<typename T> +class vector { +public: + vector(const T &, unsigned n); + + template<typename InputIterator> + vector(InputIterator first, InputIterator last); +}; + +void f() { + +} + +// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ClassDecl:{TypedText string} (50) +// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50) +// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{RightParen )} (50) +// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{Comma , }{Placeholder int n}{RightParen )} (50) +// CHECK-CC1: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50) +// CHECK-CC1: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder T const &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50) +// CHECK-CC1: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50) + +// RUN: c-index-test -code-completion-at=%s:19:1 %s | FileCheck -check-prefix=CHECK-CC2 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:19:1 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: ClassDecl:{TypedText string} (50) +// CHECK-CC2-NOT: CXXConstructor +// CHECK-CC2: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50) |