diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /test/CodeCompletion | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'test/CodeCompletion')
| -rw-r--r-- | test/CodeCompletion/Inputs/ModuleA/module.modulemap | 4 | ||||
| -rw-r--r-- | test/CodeCompletion/Inputs/ModuleA/moduleA.h | 1 | ||||
| -rw-r--r-- | test/CodeCompletion/Inputs/import_moduleA.h | 2 | ||||
| -rw-r--r-- | test/CodeCompletion/Inputs/reserved.h | 4 | ||||
| -rw-r--r-- | test/CodeCompletion/bracket-decl.c | 9 | ||||
| -rw-r--r-- | test/CodeCompletion/ctor-initializer.cpp | 41 | ||||
| -rw-r--r-- | test/CodeCompletion/documentation.m | 25 | ||||
| -rw-r--r-- | test/CodeCompletion/ordinary-name.c | 3 | ||||
| -rw-r--r-- | test/CodeCompletion/pch-and-module.m | 37 |
9 files changed, 124 insertions, 2 deletions
diff --git a/test/CodeCompletion/Inputs/ModuleA/module.modulemap b/test/CodeCompletion/Inputs/ModuleA/module.modulemap new file mode 100644 index 000000000000..b0fe1faaee6a --- /dev/null +++ b/test/CodeCompletion/Inputs/ModuleA/module.modulemap @@ -0,0 +1,4 @@ +module ModuleA { + header "moduleA.h" + export * +} diff --git a/test/CodeCompletion/Inputs/ModuleA/moduleA.h b/test/CodeCompletion/Inputs/ModuleA/moduleA.h new file mode 100644 index 000000000000..f90f56dad825 --- /dev/null +++ b/test/CodeCompletion/Inputs/ModuleA/moduleA.h @@ -0,0 +1 @@ +static int const FROM_MODULE_A = 0; diff --git a/test/CodeCompletion/Inputs/import_moduleA.h b/test/CodeCompletion/Inputs/import_moduleA.h new file mode 100644 index 000000000000..e2663f4e61b5 --- /dev/null +++ b/test/CodeCompletion/Inputs/import_moduleA.h @@ -0,0 +1,2 @@ +#include "ModuleA/moduleA.h" +static int const FROM_HEADER = 1; diff --git a/test/CodeCompletion/Inputs/reserved.h b/test/CodeCompletion/Inputs/reserved.h index fafe4ac440e0..7b353a58fca4 100644 --- a/test/CodeCompletion/Inputs/reserved.h +++ b/test/CodeCompletion/Inputs/reserved.h @@ -1,2 +1,4 @@ -typedef int _INTEGER_TYPE; +typedef int __INTEGER_TYPE; typedef float FLOATING_TYPE; + +typedef int _MyPrivateType; diff --git a/test/CodeCompletion/bracket-decl.c b/test/CodeCompletion/bracket-decl.c new file mode 100644 index 000000000000..cf80b424d13b --- /dev/null +++ b/test/CodeCompletion/bracket-decl.c @@ -0,0 +1,9 @@ +#define PATHSIZE 256 + +static const int len = 1234; + +void foo() { + char arr[ +// RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:6:12 %s -o - | FileCheck %s +// CHECK: COMPLETION: len +// CHECK: COMPLETION: PATHSIZE diff --git a/test/CodeCompletion/ctor-initializer.cpp b/test/CodeCompletion/ctor-initializer.cpp new file mode 100644 index 000000000000..00af64dd4fa4 --- /dev/null +++ b/test/CodeCompletion/ctor-initializer.cpp @@ -0,0 +1,41 @@ +struct Base1 { + Base1() : {} + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1: COMPLETION: Pattern : member1(<#args#>) + // CHECK-CC1: COMPLETION: Pattern : member2(<#args#> + + Base1(int) : member1(123), {} + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s + // CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#args#>) + // CHECK-CC2: COMPLETION: Pattern : member2(<#args#> + + int member1; + float member2; +}; + +struct Derived : public Base1 { + Derived(); + Derived(int); + Derived(float); + int deriv1; +}; + +Derived::Derived() : {} +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: COMPLETION: Pattern : Base1(<#args#>) +// CHECK-CC3: COMPLETION: Pattern : deriv1(<#args#>) + +Derived::Derived(int) try : { +} catch (...) { +} +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:28:29 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: COMPLETION: Pattern : Base1(<#args#>) +// CHECK-CC4: COMPLETION: Pattern : deriv1(<#args#>) + +Derived::Derived(float) try : Base1(), +{ +} catch (...) { +} +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:35:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s +// CHECK-CC5-NOT: COMPLETION: Pattern : Base1(<#args#>) +// CHECK-CC5: COMPLETION: Pattern : deriv1(<#args#>) diff --git a/test/CodeCompletion/documentation.m b/test/CodeCompletion/documentation.m new file mode 100644 index 000000000000..47add5b6ca0d --- /dev/null +++ b/test/CodeCompletion/documentation.m @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@interface Base +@end + +@interface Test : Base +/// Instance! +@property id instanceProp; +/// Class! +@property (class) id classProp; +@end + +void test(Test *obj) { + [obj instanceProp]; + [Test classProp]; +} + +// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:15:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: instanceProp : [#id#]instanceProp : Instance! +// CHECK-CC1: setInstanceProp: : [#void#]setInstanceProp:<#(id)#> : Instance! + +// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:16:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: classProp : [#id#]classProp : Class! +// CHECK-CC2: setClassProp: : [#void#]setClassProp:<#(id)#> : Class! diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c index dda7bb018a0f..1352b70730d8 100644 --- a/test/CodeCompletion/ordinary-name.c +++ b/test/CodeCompletion/ordinary-name.c @@ -5,8 +5,9 @@ typedef struct t _TYPEDEF; void foo() { int y; // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1-NOT: __INTEGER_TYPE // CHECK-CC1: _Imaginary - // CHECK-CC1-NOT: _INTEGER_TYPE; + // CHECK-CC1: _MyPrivateType // CHECK-CC1: _TYPEDEF // CHECK-CC1: FLOATING_TYPE // CHECK-CC1: foo diff --git a/test/CodeCompletion/pch-and-module.m b/test/CodeCompletion/pch-and-module.m new file mode 100644 index 000000000000..8361448c3a7e --- /dev/null +++ b/test/CodeCompletion/pch-and-module.m @@ -0,0 +1,37 @@ +#import "import_moduleA.h" +static const int FROM_IMPL = 2; + +void test0(void) { + int x = +} +// The lines above this point are sensitive to line/column changes. + +// ===--- None +// RUN: c-index-test -code-completion-at=%s:5:11 %s -I %S/Inputs | FileCheck %s + +// ===--- Modules +// RUN: rm -rf %t && mkdir %t +// RUN: c-index-test -code-completion-at=%s:5:11 %s -I %S/Inputs -fmodules -fmodules-cache-path=%t/mcp | FileCheck %s + +// ===--- PCH +// RUN: rm -rf %t && mkdir %t +// RUN: c-index-test -write-pch %t/import_moduleA.pch -x objective-c-header %S/Inputs/import_moduleA.h -I %S/Inputs +// RUN: c-index-test -code-completion-at=%s:5:11 %s -include-pch %t/import_moduleA.pch -I %S/Inputs | FileCheck %s + +// ===--- PCH + Modules +// RUN: rm -rf %t && mkdir %t +// RUN: c-index-test -write-pch %t/import_moduleA.pch -x objective-c-header %S/Inputs/import_moduleA.h -fmodules -fmodules-cache-path=%t/mcp -I %S/Inputs +// RUN: c-index-test -code-completion-at=%s:5:11 %s -include-pch %t/import_moduleA.pch -I %S/Inputs -fmodules -fmodules-cache-path=%t/mcp | FileCheck %s + +// ===--- Preamble +// RUN: rm -rf %t && mkdir %t +// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:5:11 %s -I %S/Inputs | FileCheck %s + +// ===--- Preamble + Modules +// RUN: rm -rf %t +// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:5:11 %s -I %S/Inputs -fmodules -fmodules-cache-path=%t/mcp | FileCheck %s + + +// CHECK: FROM_HEADER +// CHECK: FROM_IMPL +// CHECK: FROM_MODULE_A |
