blob: 6b7f2f9e91715553a60dad20fb538f6b28a8baf2 [file] [log] [blame]
Douglas Gregor6f942b22010-09-21 16:06:22 +00001// Line- and column-sensitive test; run lines follow.
2
3class string {
4 public:
5 string();
6 string(const char *);
7 string(const char *, int n);
8};
9
10template<typename T>
11class vector {
12public:
13 vector(const T &, unsigned n);
Douglas Gregor6f942b22010-09-21 16:06:22 +000014 template<typename InputIterator>
15 vector(InputIterator first, InputIterator last);
Douglas Gregor9b0ba872010-11-09 03:59:40 +000016 void push_back(const T&);
Douglas Gregor6f942b22010-09-21 16:06:22 +000017};
Douglas Gregor9b0ba872010-11-09 03:59:40 +000018template<typename T> void vector<T>::push_back(const T&) { }
Douglas Gregor6f942b22010-09-21 16:06:22 +000019void f() {
20
21}
22
Douglas Gregor4706e872011-02-17 03:09:23 +000023int foo();
24
25void g() {
26 vector<int>(foo(), foo());
27}
28
Douglas Gregorab795d62011-10-19 04:17:22 +000029struct X {
30 void f() const;
31};
32
33void X::f() const {
34
35}
36
Douglas Gregora50216c2011-10-18 16:29:03 +000037// RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s
38// 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 Gregor8ca72082011-10-18 21:20:17 +000039// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
40// CHECK-CC1: NotImplemented:{ResultType bool}{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40)
41// CHECK-CC1: NotImplemented:{ResultType std::nullptr_t}{TypedText nullptr} (40)
Douglas Gregor9b0ba872010-11-09 03:59:40 +000042// CHECK-CC1: NotImplemented:{TypedText operator} (40)
43// CHECK-CC1-NOT: push_back
Douglas Gregor6f942b22010-09-21 16:06:22 +000044// CHECK-CC1: ClassDecl:{TypedText string} (50)
45// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50)
46// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{RightParen )} (50)
47// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{Comma , }{Placeholder int n}{RightParen )} (50)
48// CHECK-CC1: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
Douglas Gregorc6daf0b2011-02-17 06:52:25 +000049// CHECK-CC1: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50)
Douglas Gregor6f942b22010-09-21 16:06:22 +000050// CHECK-CC1: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
51
52// RUN: c-index-test -code-completion-at=%s:19:1 %s | FileCheck -check-prefix=CHECK-CC2 %s
53// 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
54// CHECK-CC2: ClassDecl:{TypedText string} (50)
55// CHECK-CC2-NOT: CXXConstructor
56// CHECK-CC2: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
Douglas Gregor4706e872011-02-17 03:09:23 +000057
58// RUN: c-index-test -code-completion-at=%s:26:15 %s | FileCheck -check-prefix=CHECK-CC3 %s
59// CHECK-CC3: NotImplemented:{TypedText float} (50)
60// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText foo}{LeftParen (}{RightParen )} (50)
61// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{RightParen )} (50)
62// CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
Douglas Gregorc6daf0b2011-02-17 06:52:25 +000063// CHECK-CC3: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50)
Douglas Gregor4706e872011-02-17 03:09:23 +000064// CHECK-CC3: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
Douglas Gregor8ca72082011-10-18 21:20:17 +000065
Douglas Gregorab795d62011-10-19 04:17:22 +000066// RUN: c-index-test -code-completion-at=%s:34:1 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC4 %s
67// CHECK-CC4: NotImplemented:{ResultType const X *}{TypedText this} (40)