Douglas Gregor | 6f942b2 | 2010-09-21 16:06:22 +0000 | [diff] [blame] | 1 | // Line- and column-sensitive test; run lines follow. |
| 2 | |
| 3 | class string { |
| 4 | public: |
| 5 | string(); |
| 6 | string(const char *); |
| 7 | string(const char *, int n); |
| 8 | }; |
| 9 | |
| 10 | template<typename T> |
| 11 | class vector { |
| 12 | public: |
| 13 | vector(const T &, unsigned n); |
Douglas Gregor | 6f942b2 | 2010-09-21 16:06:22 +0000 | [diff] [blame] | 14 | template<typename InputIterator> |
| 15 | vector(InputIterator first, InputIterator last); |
Douglas Gregor | 9b0ba87 | 2010-11-09 03:59:40 +0000 | [diff] [blame] | 16 | void push_back(const T&); |
Douglas Gregor | 6f942b2 | 2010-09-21 16:06:22 +0000 | [diff] [blame] | 17 | }; |
Douglas Gregor | 9b0ba87 | 2010-11-09 03:59:40 +0000 | [diff] [blame] | 18 | template<typename T> void vector<T>::push_back(const T&) { } |
Douglas Gregor | 6f942b2 | 2010-09-21 16:06:22 +0000 | [diff] [blame] | 19 | void f() { |
| 20 | |
| 21 | } |
| 22 | |
Douglas Gregor | 4706e87 | 2011-02-17 03:09:23 +0000 | [diff] [blame] | 23 | int foo(); |
| 24 | |
| 25 | void g() { |
| 26 | vector<int>(foo(), foo()); |
| 27 | } |
| 28 | |
Douglas Gregor | ab795d6 | 2011-10-19 04:17:22 +0000 | [diff] [blame] | 29 | struct X { |
| 30 | void f() const; |
| 31 | }; |
| 32 | |
| 33 | void X::f() const { |
| 34 | |
| 35 | } |
| 36 | |
Douglas Gregor | ba10306 | 2012-03-27 23:34:16 +0000 | [diff] [blame^] | 37 | namespace N { |
| 38 | int x; |
| 39 | class C { |
| 40 | int member; |
| 41 | |
| 42 | int f(int param) { |
| 43 | return member; |
| 44 | } |
| 45 | }; |
| 46 | } |
| 47 | |
Douglas Gregor | a50216c | 2011-10-18 16:29:03 +0000 | [diff] [blame] | 48 | // RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s |
| 49 | // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 -std=c++0x %s | FileCheck -check-prefix=CHECK-CC1 %s |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 50 | // CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40) |
| 51 | // CHECK-CC1: NotImplemented:{ResultType bool}{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40) |
| 52 | // CHECK-CC1: NotImplemented:{ResultType std::nullptr_t}{TypedText nullptr} (40) |
Douglas Gregor | 9b0ba87 | 2010-11-09 03:59:40 +0000 | [diff] [blame] | 53 | // CHECK-CC1: NotImplemented:{TypedText operator} (40) |
| 54 | // CHECK-CC1-NOT: push_back |
Douglas Gregor | 6f942b2 | 2010-09-21 16:06:22 +0000 | [diff] [blame] | 55 | // CHECK-CC1: ClassDecl:{TypedText string} (50) |
| 56 | // CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50) |
| 57 | // CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{RightParen )} (50) |
| 58 | // CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{Comma , }{Placeholder int n}{RightParen )} (50) |
| 59 | // CHECK-CC1: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50) |
Douglas Gregor | c6daf0b | 2011-02-17 06:52:25 +0000 | [diff] [blame] | 60 | // CHECK-CC1: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50) |
Douglas Gregor | 6f942b2 | 2010-09-21 16:06:22 +0000 | [diff] [blame] | 61 | // CHECK-CC1: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50) |
| 62 | |
| 63 | // RUN: c-index-test -code-completion-at=%s:19:1 %s | FileCheck -check-prefix=CHECK-CC2 %s |
| 64 | // 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 |
| 65 | // CHECK-CC2: ClassDecl:{TypedText string} (50) |
| 66 | // CHECK-CC2-NOT: CXXConstructor |
| 67 | // CHECK-CC2: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50) |
Douglas Gregor | 4706e87 | 2011-02-17 03:09:23 +0000 | [diff] [blame] | 68 | |
| 69 | // RUN: c-index-test -code-completion-at=%s:26:15 %s | FileCheck -check-prefix=CHECK-CC3 %s |
| 70 | // CHECK-CC3: NotImplemented:{TypedText float} (50) |
| 71 | // CHECK-CC3: FunctionDecl:{ResultType int}{TypedText foo}{LeftParen (}{RightParen )} (50) |
| 72 | // CHECK-CC3: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{RightParen )} (50) |
| 73 | // CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50) |
Douglas Gregor | c6daf0b | 2011-02-17 06:52:25 +0000 | [diff] [blame] | 74 | // CHECK-CC3: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50) |
Douglas Gregor | 4706e87 | 2011-02-17 03:09:23 +0000 | [diff] [blame] | 75 | // CHECK-CC3: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50) |
Douglas Gregor | 8ca7208 | 2011-10-18 21:20:17 +0000 | [diff] [blame] | 76 | |
Douglas Gregor | ab795d6 | 2011-10-19 04:17:22 +0000 | [diff] [blame] | 77 | // RUN: c-index-test -code-completion-at=%s:34:1 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC4 %s |
| 78 | // CHECK-CC4: NotImplemented:{ResultType const X *}{TypedText this} (40) |
Douglas Gregor | ba10306 | 2012-03-27 23:34:16 +0000 | [diff] [blame^] | 79 | |
| 80 | // RUN: c-index-test -code-completion-at=%s:43:14 %s | FileCheck -check-prefix=CHECK-CC5 %s |
| 81 | // CHECK-CC5: FieldDecl:{ResultType int}{TypedText member} (8) (parent: ClassDecl 'N::C') |
| 82 | // CHECK-CC5: ParmDecl:{ResultType int}{TypedText param} (8) |
| 83 | // CHECK-CC5: StructDecl:{TypedText X} (50) (parent: TranslationUnit '(null)') |
| 84 | // CHECK-CC5: VarDecl:{ResultType int}{TypedText x} (12) (parent: Namespace 'N') |