aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeCompletion/call.cpp17
-rw-r--r--test/CodeCompletion/enum-switch-case-qualified.cpp22
-rw-r--r--test/CodeCompletion/enum-switch-case.c10
-rw-r--r--test/CodeCompletion/enum-switch-case.cpp30
-rw-r--r--test/CodeCompletion/function-templates.cpp7
-rw-r--r--test/CodeCompletion/functions.cpp6
-rw-r--r--test/CodeCompletion/member-access.c6
-rw-r--r--test/CodeCompletion/member-access.cpp8
-rw-r--r--test/CodeCompletion/namespace-alias.cpp9
-rw-r--r--test/CodeCompletion/namespace.cpp8
-rw-r--r--test/CodeCompletion/nested-name-specifier.cpp8
-rw-r--r--test/CodeCompletion/operator.cpp7
-rw-r--r--test/CodeCompletion/ordinary-name.c5
-rw-r--r--test/CodeCompletion/tag.c7
-rw-r--r--test/CodeCompletion/tag.cpp7
-rw-r--r--test/CodeCompletion/templates.cpp10
-rw-r--r--test/CodeCompletion/truncation.c12
-rw-r--r--test/CodeCompletion/truncation.c.h5
-rw-r--r--test/CodeCompletion/using-namespace.cpp9
-rw-r--r--test/CodeCompletion/using.cpp8
20 files changed, 108 insertions, 93 deletions
diff --git a/test/CodeCompletion/call.cpp b/test/CodeCompletion/call.cpp
index 4faff15c05..dd90083874 100644
--- a/test/CodeCompletion/call.cpp
+++ b/test/CodeCompletion/call.cpp
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
void f(float x, float y);
void f(int i, int j, int k);
struct X { };
@@ -10,13 +10,20 @@ namespace N {
operator int() const;
};
- void f(Y y);
+ void f(Y y, int);
}
typedef N::Y Y;
void f();
void test() {
- // CHECK-CC1: f : 0 : f(<#struct N::Y y#>)
+ f(Y(), 0, 0);
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s &&
+ // CHECK-CC1: f : 0 : f(<#struct N::Y y#>, <#int#>)
// CHECK-NEXT-CC1: f : 0 : f(<#int i#>, <#int j#>, <#int k#>)
// CHECK-NEXT-CC1: f : 0 : f(<#float x#>, <#float y#>)
- f(Y(),
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s &&
+ // CHECK-NOT-CC2: f : 0 : f(<#struct N::Y y#>, <#int#>)
+ // CHECK-CC2: f : 0 : f(<#int i#>, <#int j#>, <#int k#>)
+ // CHECK-NEXT-CC2: f : 0 : f(<#float x#>, <#float y#>)
+ // RUN: true
+}
diff --git a/test/CodeCompletion/enum-switch-case-qualified.cpp b/test/CodeCompletion/enum-switch-case-qualified.cpp
index fc1b0ea075..468a4f979f 100644
--- a/test/CodeCompletion/enum-switch-case-qualified.cpp
+++ b/test/CodeCompletion/enum-switch-case-qualified.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace M {
namespace N {
@@ -23,11 +20,14 @@ namespace M {
void test(enum N::C::Color color) {
switch (color) {
- // CHECK-NEXT-CC1: Blue : 0 : N::C::Blue
- // CHECK-NEXT-CC1: Green : 0 : N::C::Green
- // CHECK-NEXT-CC1: Indigo : 0 : N::C::Indigo
- // CHECK-NEXT-CC1: Orange : 0 : N::C::Orange
- // CHECK-NEXT-CC1: Red : 0 : N::C::Red
- // CHECK-NEXT-CC1: Violet : 0 : N::C::Violet
- // CHECK-NEXT-CC1: Yellow : 0 : N::C::Yellow
- case
+ case
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s &&
+ // RUN: true
+ // CHECK-NEXT-CC1: Blue : 0 : N::C::Blue
+ // CHECK-NEXT-CC1: Green : 0 : N::C::Green
+ // CHECK-NEXT-CC1: Indigo : 0 : N::C::Indigo
+ // CHECK-NEXT-CC1: Orange : 0 : N::C::Orange
+ // CHECK-NEXT-CC1: Red : 0 : N::C::Red
+ // CHECK-NEXT-CC1: Violet : 0 : N::C::Violet
+ // CHECK-NEXT-CC1: Yellow : 0 : N::C::Yellow
+
diff --git a/test/CodeCompletion/enum-switch-case.c b/test/CodeCompletion/enum-switch-case.c
index 08488f75c1..255fbbce2d 100644
--- a/test/CodeCompletion/enum-switch-case.c
+++ b/test/CodeCompletion/enum-switch-case.c
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
enum Color {
Red,
Orange,
@@ -19,9 +16,14 @@ void test(enum Color color) {
case Yellow:
break;
+ case Green:
+ break;
+
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: Blue : 0
// CHECK-NEXT-CC1: Green : 0
// CHECK-NEXT-CC1: Indigo : 0
// CHECK-NEXT-CC1: Orange : 0
// CHECK-NEXT-CC1: Violet : 0
- case
+ // RUN: true
+
diff --git a/test/CodeCompletion/enum-switch-case.cpp b/test/CodeCompletion/enum-switch-case.cpp
index 49b33c830a..15e50fdf48 100644
--- a/test/CodeCompletion/enum-switch-case.cpp
+++ b/test/CodeCompletion/enum-switch-case.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace N {
enum Color {
Red,
@@ -15,15 +12,18 @@ namespace N {
void test(enum N::Color color) {
switch (color) {
- case N::Red:
- break;
-
- case N::Yellow:
- break;
-
- // CHECK-CC1: Blue : 0 : N::Blue
- // CHECK-NEXT-CC1: Green : 0 : N::Green
- // CHECK-NEXT-CC1: Indigo : 0 : N::Indigo
- // CHECK-NEXT-CC1: Orange : 0 : N::Orange
- // CHECK-NEXT-CC1: Violet : 0 : N::Violet
- case
+ case N::Red:
+ break;
+
+ case N::Yellow:
+ break;
+
+ case
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s &&
+ // CHECK-CC1: Blue : 0 : N::Blue
+ // CHECK-NEXT-CC1: Green : 0 : N::Green
+ // CHECK-NEXT-CC1: Indigo : 0 : N::Indigo
+ // CHECK-NEXT-CC1: Orange : 0 : N::Orange
+ // CHECK-NEXT-CC1: Violet : 0 : N::Violet
+
+ // RUN: true
diff --git a/test/CodeCompletion/function-templates.cpp b/test/CodeCompletion/function-templates.cpp
index c9a893ec9c..52cba71bd2 100644
--- a/test/CodeCompletion/function-templates.cpp
+++ b/test/CodeCompletion/function-templates.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace std {
template<typename RandomAccessIterator>
void sort(RandomAccessIterator first, RandomAccessIterator last);
@@ -10,7 +7,9 @@ namespace std {
}
void f() {
+ std::
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: dyn_cast<<#class X#>>(<#Y *Val#>)
// CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>)
- std::
+ // RUN: true
diff --git a/test/CodeCompletion/functions.cpp b/test/CodeCompletion/functions.cpp
index f722e9a07e..f04ef01d70 100644
--- a/test/CodeCompletion/functions.cpp
+++ b/test/CodeCompletion/functions.cpp
@@ -1,9 +1,9 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
void f(int i, int j = 2, int k = 5);
void f(float x, float y);
void test() {
+ ::
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: f(<#int i#>{#, <#int j#>{#, <#int k#>#}#})
// CHECK-CC1: f(<#float x#>, <#float y#>)
- ::
+ // RUN: true
diff --git a/test/CodeCompletion/member-access.c b/test/CodeCompletion/member-access.c
index 25b2b9ce22..1e8e563098 100644
--- a/test/CodeCompletion/member-access.c
+++ b/test/CodeCompletion/member-access.c
@@ -1,5 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
struct Point {
float x;
float y;
@@ -7,7 +5,9 @@ struct Point {
};
void test(struct Point *p) {
+ p->
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: x
// CHECK-CC1: y
// CHECK-CC1: z
- p-> \ No newline at end of file
+ // RUN: true
diff --git a/test/CodeCompletion/member-access.cpp b/test/CodeCompletion/member-access.cpp
index c2dfee44dd..cbd19db1a5 100644
--- a/test/CodeCompletion/member-access.cpp
+++ b/test/CodeCompletion/member-access.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
struct Base1 {
int member1;
float member2;
@@ -29,6 +26,8 @@ public:
};
void test(const Proxy &p) {
+ p->
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: member4 : 0
// CHECK-CC1: memfun3 : 0
// CHECK-CC1: memfun1 : 1
@@ -39,4 +38,5 @@ void test(const Proxy &p) {
// CHECK-CC1: member2 : 2
// CHECK-CC1: member3 : 2
// CHECK-CC1: memfun1 : 2 (Hidden) : Base2::memfun1(<#int#>)
- p-> \ No newline at end of file
+ // RUN: true
+
diff --git a/test/CodeCompletion/namespace-alias.cpp b/test/CodeCompletion/namespace-alias.cpp
index 8d70c4517d..cae3d561d1 100644
--- a/test/CodeCompletion/namespace-alias.cpp
+++ b/test/CodeCompletion/namespace-alias.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace N4 {
namespace N3 { }
}
@@ -13,10 +10,12 @@ namespace N2 {
namespace I5 { }
namespace I1 { }
+ namespace New =
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: I1 : 1
// CHECK-CC1: I4 : 1
// CHECK-CC1: I5 : 1
// CHECK-CC1: N2 : 2
// CHECK-NEXT-CC1: N4 : 2
- namespace New =
-
+ // RUN: true
+ \ No newline at end of file
diff --git a/test/CodeCompletion/namespace.cpp b/test/CodeCompletion/namespace.cpp
index db841248ab..5563698e93 100644
--- a/test/CodeCompletion/namespace.cpp
+++ b/test/CodeCompletion/namespace.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace N3 {
}
@@ -10,6 +7,9 @@ namespace N2 {
namespace I5 { }
namespace I1 { }
+ namespace
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: I1 : 0
// CHECK-NEXT-CC1: I5 : 0
- namespace
+ // RUN: true
+
diff --git a/test/CodeCompletion/nested-name-specifier.cpp b/test/CodeCompletion/nested-name-specifier.cpp
index 4d6a75f8cb..0cc5a19421 100644
--- a/test/CodeCompletion/nested-name-specifier.cpp
+++ b/test/CodeCompletion/nested-name-specifier.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace N {
struct A { };
namespace M {
@@ -12,7 +9,10 @@ namespace N {
struct B { };
}
+N::
+// RUN: clang-cc -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: A : 0
// CHECK-CC1: B : 0
// CHECK-CC1: M : 0
-N:: \ No newline at end of file
+// RUN: true
+
diff --git a/test/CodeCompletion/operator.cpp b/test/CodeCompletion/operator.cpp
index 808940526f..72a3f6bb71 100644
--- a/test/CodeCompletion/operator.cpp
+++ b/test/CodeCompletion/operator.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
class T { };
typedef int Integer;
@@ -10,10 +7,12 @@ namespace N { }
void f() {
typedef float Float;
+ operator
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: Float : 0
// CHECK-CC1: + : 0
// CHECK-CC1: short : 0
// CHECK-CC1: Integer : 2
// CHECK-CC1: T : 2
// CHECK-CC1: N : 5
- operator
+ // RUN: true
diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c
index a532409d60..caba130f8b 100644
--- a/test/CodeCompletion/ordinary-name.c
+++ b/test/CodeCompletion/ordinary-name.c
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
struct X { int x; };
typedef struct X TYPEDEF;
@@ -10,3 +7,5 @@ void foo() {
// CHECK-CC1: y : 0
// CHECK-NEXT-CC1: TYPEDEF : 2
// CHECK-NEXT-CC1: foo : 2
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CC1 %s &&
+ // RUN: true
diff --git a/test/CodeCompletion/tag.c b/test/CodeCompletion/tag.c
index 35ddda273e..e7250f540c 100644
--- a/test/CodeCompletion/tag.c
+++ b/test/CodeCompletion/tag.c
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
enum X { x };
enum Y { y };
struct Z { };
@@ -9,6 +6,8 @@ void X();
void test() {
enum X { x };
+ enum
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:9:7 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: X : 0
// CHECK-CC1: Y : 2
- enum
+ // RUN: true
diff --git a/test/CodeCompletion/tag.cpp b/test/CodeCompletion/tag.cpp
index d8f6f2fa0a..201aec4dd3 100644
--- a/test/CodeCompletion/tag.cpp
+++ b/test/CodeCompletion/tag.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
class X { };
struct Y { };
@@ -17,6 +14,8 @@ namespace N {
class Y;
void test() {
+ class
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:17:10 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: Y : 2
// CHECK-CC1: Z : 2
// CHECK-CC1: A : 3
@@ -24,4 +23,4 @@ namespace N {
// CHECK-CC1: Y : 3
// CHECK-CC1: M : 6
// CHECK-CC1: N : 6
- class
+ // RUN: true
diff --git a/test/CodeCompletion/templates.cpp b/test/CodeCompletion/templates.cpp
index f7751413b9..22cca65bea 100644
--- a/test/CodeCompletion/templates.cpp
+++ b/test/CodeCompletion/templates.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace std {
template<typename T>
class allocator;
@@ -10,8 +7,11 @@ namespace std {
}
void f() {
+ std::
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: allocator<<#typename T#>>
// CHECK-CC1: vector<<#typename T#>{#, <#typename Alloc#>#}>
- std::
-
+ // RUN: true
+
+
diff --git a/test/CodeCompletion/truncation.c b/test/CodeCompletion/truncation.c
new file mode 100644
index 0000000000..b64b066586
--- /dev/null
+++ b/test/CodeCompletion/truncation.c
@@ -0,0 +1,12 @@
+#include "truncation.c.h"
+
+struct
+
+// RUN: clang-cc -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s &&
+// CHECK-CC1: X : 1
+// CHECK-NEXT-CC1: Y : 1
+// RUN: clang-cc -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s &&
+// CHECK-CC2: X : 1
+// CHECK-CC2: Xa : 1
+// CHECK-CC2: Y : 1
+// RUN: true
diff --git a/test/CodeCompletion/truncation.c.h b/test/CodeCompletion/truncation.c.h
new file mode 100644
index 0000000000..a5ebbacb34
--- /dev/null
+++ b/test/CodeCompletion/truncation.c.h
@@ -0,0 +1,5 @@
+struct X { };
+struct Y { };
+
+struct Xa { };
+
diff --git a/test/CodeCompletion/using-namespace.cpp b/test/CodeCompletion/using-namespace.cpp
index b30b0bcfac..95bff9b5ee 100644
--- a/test/CodeCompletion/using-namespace.cpp
+++ b/test/CodeCompletion/using-namespace.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace N4 {
namespace N3 { }
}
@@ -14,11 +11,11 @@ namespace N2 {
namespace I1 { }
void foo() {
+ using namespace
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:14:20 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: I1 : 2
// CHECK-CC1: I4 : 2
// CHECK-CC1: I5 : 2
// CHECK-CC1: N2 : 3
// CHECK-NEXT-CC1: N4 : 3
- using namespace
-
-
+ // RUN: true
diff --git a/test/CodeCompletion/using.cpp b/test/CodeCompletion/using.cpp
index 7bef353459..27b85fc766 100644
--- a/test/CodeCompletion/using.cpp
+++ b/test/CodeCompletion/using.cpp
@@ -1,6 +1,3 @@
-// RUN: clang-cc -fsyntax-only -code-completion-dump=1 %s -o - | FileCheck -check-prefix=CC1 %s &&
-// RUN: true
-
namespace N4 {
namespace N3 { }
}
@@ -16,12 +13,13 @@ namespace N2 {
void foo() {
int N3;
+ using
+ // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:10 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: I1 : 2
// CHECK-CC1: I4 : 2
// CHECK-CC1: I5 : 2
// CHECK-CC1: N2 : 3
// CHECK-CC1: N3 : 3
// CHECK-NEXT-CC1: N4 : 3
- using
-
+ // RUN: true