summaryrefslogtreecommitdiffstats
path: root/test/Index/Core
diff options
context:
space:
mode:
Diffstat (limited to 'test/Index/Core')
-rw-r--r--test/Index/Core/Inputs/module/ModDep.h3
-rw-r--r--test/Index/Core/Inputs/module/ModSystem.h4
-rw-r--r--test/Index/Core/Inputs/module/ModTop.h4
-rw-r--r--test/Index/Core/Inputs/module/ModTopSub1.h1
-rw-r--r--test/Index/Core/Inputs/module/ModTopSub2.h1
-rw-r--r--test/Index/Core/Inputs/module/module.modulemap12
-rw-r--r--test/Index/Core/Inputs/sys/system-head.h17
-rw-r--r--test/Index/Core/Inputs/transitive-include.h6
-rw-r--r--test/Index/Core/external-source-symbol-attr.m1
-rw-r--r--test/Index/Core/index-instantiated-source.cpp1
-rw-r--r--test/Index/Core/index-source.mm1
-rw-r--r--test/Index/Core/index-subkinds.m1
-rw-r--r--test/Index/Core/index-system.mm1
-rw-r--r--test/Index/Core/index-unit.mm135
14 files changed, 188 insertions, 0 deletions
diff --git a/test/Index/Core/Inputs/module/ModDep.h b/test/Index/Core/Inputs/module/ModDep.h
new file mode 100644
index 0000000000..e96ef5440f
--- /dev/null
+++ b/test/Index/Core/Inputs/module/ModDep.h
@@ -0,0 +1,3 @@
+#include "ModTop.h"
+
+void ModDep_func(ModTopStruct s);
diff --git a/test/Index/Core/Inputs/module/ModSystem.h b/test/Index/Core/Inputs/module/ModSystem.h
new file mode 100644
index 0000000000..0419f97804
--- /dev/null
+++ b/test/Index/Core/Inputs/module/ModSystem.h
@@ -0,0 +1,4 @@
+
+typedef struct {} ModSystemStruct;
+
+void ModSystem_func(void);
diff --git a/test/Index/Core/Inputs/module/ModTop.h b/test/Index/Core/Inputs/module/ModTop.h
new file mode 100644
index 0000000000..60c56868bb
--- /dev/null
+++ b/test/Index/Core/Inputs/module/ModTop.h
@@ -0,0 +1,4 @@
+
+typedef struct {} ModTopStruct;
+
+void ModTop_func(void);
diff --git a/test/Index/Core/Inputs/module/ModTopSub1.h b/test/Index/Core/Inputs/module/ModTopSub1.h
new file mode 100644
index 0000000000..e1e3cf3ec5
--- /dev/null
+++ b/test/Index/Core/Inputs/module/ModTopSub1.h
@@ -0,0 +1 @@
+void ModTopSub1_func(void);
diff --git a/test/Index/Core/Inputs/module/ModTopSub2.h b/test/Index/Core/Inputs/module/ModTopSub2.h
new file mode 100644
index 0000000000..39d37f12f0
--- /dev/null
+++ b/test/Index/Core/Inputs/module/ModTopSub2.h
@@ -0,0 +1 @@
+// This header has no symbols, intended to show up as file dependency.
diff --git a/test/Index/Core/Inputs/module/module.modulemap b/test/Index/Core/Inputs/module/module.modulemap
index a132562eaf..ee4bf12953 100644
--- a/test/Index/Core/Inputs/module/module.modulemap
+++ b/test/Index/Core/Inputs/module/module.modulemap
@@ -1 +1,13 @@
module ModA { header "ModA.h" export * }
+module ModDep { header "ModDep.h" export * }
+module ModSystem [system] { header "ModSystem.h" export * }
+module ModTop {
+ header "ModTop.h"
+ export *
+ module Sub1 {
+ header "ModTopSub1.h"
+ }
+ module Sub2 {
+ header "ModTopSub2.h"
+ }
+}
diff --git a/test/Index/Core/Inputs/sys/system-head.h b/test/Index/Core/Inputs/sys/system-head.h
index df0e39ed86..b5d4291886 100644
--- a/test/Index/Core/Inputs/sys/system-head.h
+++ b/test/Index/Core/Inputs/sys/system-head.h
@@ -1,3 +1,20 @@
+// UNIT: index-system.mm.o
+// UNIT: is-system: 0
+// UNIT: is-module: 0
+// UNIT: has-main: 1
+// UNIT: main-path: {{.*}}index-system.mm
+// UNIT: out-file: {{.*}}index-system.mm.o
+// UNIT: is-debug: 1
+
+// UNIT: DEPEND START
+// UNIT: File | user | {{.*}}index-system.mm
+// UNIT: File | system | {{.*}}system-head.h
+// UNIT: DEPEND END (2)
+
+// UNIT: INCLUDE START
+// UNIT: {{.*}}index-system.mm:4 -> {{.*}}system-head.h
+// UNIT: INCLUDE END (1)
+
// CHECK: [[@LINE+1]]:12 | class/ObjC | Base | [[Base_USR:.*]] | {{.*}} | Decl | rel: 0
@interface Base
@end
diff --git a/test/Index/Core/Inputs/transitive-include.h b/test/Index/Core/Inputs/transitive-include.h
new file mode 100644
index 0000000000..b6564d89bd
--- /dev/null
+++ b/test/Index/Core/Inputs/transitive-include.h
@@ -0,0 +1,6 @@
+#include "system-head.h"
+
+struct Point {
+ int x;
+ int y;
+};
diff --git a/test/Index/Core/external-source-symbol-attr.m b/test/Index/Core/external-source-symbol-attr.m
index cdc5296697..d5dc48dcc6 100644
--- a/test/Index/Core/external-source-symbol-attr.m
+++ b/test/Index/Core/external-source-symbol-attr.m
@@ -1,4 +1,5 @@
// RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
+// RUN: c-index-test core -print-source-unit -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
#define EXT_DECL(mod_name) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name)))
#define GEN_DECL(mod_name) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name, generated_declaration)))
diff --git a/test/Index/Core/index-instantiated-source.cpp b/test/Index/Core/index-instantiated-source.cpp
index 7a810fbdf3..2002d781b4 100644
--- a/test/Index/Core/index-instantiated-source.cpp
+++ b/test/Index/Core/index-instantiated-source.cpp
@@ -1,4 +1,5 @@
// RUN: c-index-test core -print-source-symbols -- %s -std=c++14 -target x86_64-apple-macosx10.7 | FileCheck %s
+// RUN: c-index-test core -print-source-unit -- %s -std=c++14 -target x86_64-apple-macosx10.7 | FileCheck %s
// References to declarations in instantiations should be canonicalized:
template<typename T>
diff --git a/test/Index/Core/index-source.mm b/test/Index/Core/index-source.mm
index 049a0bdaf6..9d969d8a3d 100644
--- a/test/Index/Core/index-source.mm
+++ b/test/Index/Core/index-source.mm
@@ -1,4 +1,5 @@
// RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
+// RUN: c-index-test core -print-source-unit -- %s -target x86_64-apple-macosx10.7 | FileCheck -check-prefixes=CHECK %s
@interface MyCls
@end
diff --git a/test/Index/Core/index-subkinds.m b/test/Index/Core/index-subkinds.m
index 5eea046721..4c391f0d7f 100644
--- a/test/Index/Core/index-subkinds.m
+++ b/test/Index/Core/index-subkinds.m
@@ -1,4 +1,5 @@
// RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
+// RUN: c-index-test core -print-source-unit -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
// CHECK: [[@LINE+1]]:12 | class/ObjC | XCTestCase | c:objc(cs)XCTestCase | _OBJC_CLASS_$_XCTestCase | Decl | rel: 0
@interface XCTestCase
diff --git a/test/Index/Core/index-system.mm b/test/Index/Core/index-system.mm
index 2ad31fae71..5f64a29811 100644
--- a/test/Index/Core/index-system.mm
+++ b/test/Index/Core/index-system.mm
@@ -1,3 +1,4 @@
// RUN: c-index-test core -print-source-symbols -- %s -isystem %S/Inputs/sys | FileCheck %S/Inputs/sys/system-head.h
+// RUN: c-index-test core -print-source-unit -- %s -isystem %S/Inputs/sys | FileCheck -check-prefixes=UNIT,CHECK %S/Inputs/sys/system-head.h
#include "system-head.h"
diff --git a/test/Index/Core/index-unit.mm b/test/Index/Core/index-unit.mm
new file mode 100644
index 0000000000..3815f30ef7
--- /dev/null
+++ b/test/Index/Core/index-unit.mm
@@ -0,0 +1,135 @@
+// RUN: rm -rf %t.mcp
+// RUN: c-index-test core -print-source-unit -- -arch x86_64 -mmacosx-version-min=10.7 -c %s -o %t.o -isystem %S/Inputs/sys -fmodules -fmodules-cache-path=%t.mcp -Xclang -fdisable-module-hash -I %S/Inputs/module -I %S/Inputs | FileCheck %s
+
+@import ModDep;
+@import ModSystem;
+
+
+
+// CHECK: ModTop.pcm
+
+// CHECK: is-system: 0
+// CHECK: is-module: 1
+// CHECK: module-name: ModTop
+// CHECK: has-main: 0
+// CHECK: main-path: {{$}}
+// CHECK: out-file: {{.*}}/ModTop.pcm
+
+// CHECK: DEPEND START
+// CHECK: File | user | {{.*}}/Inputs/module/ModTopSub2.h
+// CHECK: File | user | {{.*}}/Inputs/module/ModTopSub1.h
+// CHECK: File | user | {{.*}}/Inputs/module/ModTop.h
+// CHECK: DEPEND END (3)
+
+// CHECK: INCLUDE START
+// CHECK: INCLUDE END (0)
+
+// CHECK: {{.*}}/Inputs/module/ModTop.h
+// CHECK: 2:9 | struct/C | <no-name> | c:{{.*}} | <no-cgname> | Def | rel: 0
+// CHECK: 2:19 | type-alias/C | ModTopStruct | [[ModTopStruct_USR:.*]] | <no-cgname> | Def | rel: 0
+// CHECK: 4:6 | function/C | ModTop_func | {{.*}} | __Z11ModTop_funcv | Decl | rel: 0
+
+// CHECK: {{.*}}/Inputs/module/ModTopSub1.h
+// CHECK: 1:6 | function/C | ModTopSub1_func | {{.*}} | __Z15ModTopSub1_funcv | Decl | rel: 0
+
+
+
+// CHECK: ModDep.pcm
+
+// CHECK: is-system: 0
+// CHECK: is-module: 1
+// CHECK: module-name: ModDep
+// CHECK: has-main: 0
+// CHECK: main-path: {{$}}
+// CHECK: out-file: {{.*}}/ModDep.pcm
+
+// CHECK: DEPEND START
+// CHECK: File | user | {{.*}}/Inputs/module/ModDep.h
+// CHECK: Module | user | {{.*}}/ModTop.pcm
+// CHECK: DEPEND END (2)
+
+// CHECK: INCLUDE START
+// CHECK: INCLUDE END (0)
+
+// CHECK: {{.*}}/Inputs/module/ModDep.h
+// CHECK: 3:6 | function/C | ModDep_func | [[ModDep_func_USR:.*]] | __Z11ModDep_func12ModTopStruct | Decl | rel: 0
+// CHECK: 3:18 | type-alias/C | ModTopStruct | [[ModTopStruct_USR]] | <no-cgname> | Ref,RelCont | rel: 1
+// CHECK-NEXT: RelCont | ModDep_func | [[ModDep_func_USR]]
+
+
+
+// CHECK: ModSystem.pcm
+
+// CHECK: is-system: 1
+// CHECK: is-module: 1
+// CHECK: module-name: ModSystem
+// CHECK: has-main: 0
+// CHECK: main-path: {{$}}
+// CHECK: out-file: {{.*}}/ModSystem.pcm
+
+// CHECK: DEPEND START
+// CHECK: File | system | {{.*}}/Inputs/module/ModSystem.h
+// CHECK: DEPEND END (1)
+
+// CHECK: INCLUDE START
+// CHECK: INCLUDE END (0)
+
+// CHECK: {{.*}}/Inputs/module/ModSystem.h
+// CHECK: 2:9 | struct/C | <no-name> | {{.*}} | <no-cgname> | Def | rel: 0
+// CHECK: 2:19 | type-alias/C | ModSystemStruct | {{.*}} | <no-cgname> | Def | rel: 0
+// CHECK: 4:6 | function/C | ModSystem_func | {{.*}} | __Z14ModSystem_funcv | Decl | rel: 0
+
+
+
+// CHECK: index-unit.mm.o
+
+// CHECK: is-system: 0
+// CHECK: is-module: 0
+// CHECK: module-name: {{$}}
+// CHECK: has-main: 1
+// CHECK: main-path: {{.*}}/index-unit.mm
+// CHECK: out-file: {{.*}}/index-unit.mm.o
+
+// CHECK: DEPEND START
+// CHECK: File | user | {{.*}}/index-unit.mm
+// CHECK: File | user | {{.*}}/Inputs/module/module.modulemap
+// CHECK: File | user | {{.*}}/Inputs/transitive-include.h
+// CHECK: File | system | {{.*}}/Inputs/sys/system-head.h
+// CHECK: Module | user | {{.*}}/ModDep.pcm
+// CHECK: Module | system | {{.*}}/ModSystem.pcm
+// CHECK: DEPEND END (6)
+
+// CHECK: INCLUDE START
+// CHECK: {{.*}}index-unit.mm:[[@LINE+1]] -> {{.*}}/Inputs/transitive-include.h
+#include "transitive-include.h"
+// CHECK: {{.*}}/Inputs/transitive-include.h:1 -> {{.*}}/Inputs/sys/system-head.h
+// CHECK: INCLUDE END (2)
+
+// CHECK: {{.*}}/Inputs/transitive-include.h
+// CHECK: 3:8 | struct/C | Point | [[Point_USR:.*]] | <no-cgname> | Def | rel: 0
+// CHECK: 4:7 | field/C | x | {{.*}} | <no-cgname> | Def,RelChild | rel: 1
+// CHECK-NEXT: RelChild | Point | [[Point_USR]]
+// CHECK: 5:7 | field/C | y | {{.*}} | <no-cgname> | Def,RelChild | rel: 1
+// CHECK-NEXT: RelChild | Point | [[Point_USR]]
+
+// CHECK: {{.*}}/Inputs/sys/system-head.h
+// CHECK: 19:12 | class/ObjC | Base | [[Base_USR:.*]] | _OBJC_CLASS_$_Base | Decl | rel: 0
+// CHECK: 23:11 | protocol/ObjC | Prot1 | [[Prot1_USR:.*]] | <no-cgname> | Decl | rel: 0
+// CHECK: 29:11 | protocol/ObjC | Prot2 | [[Prot2_USR:.*]] | <no-cgname> | Decl | rel: 0
+// CHECK: 29:17 | protocol/ObjC | Prot1 | [[Prot1_USR]] | <no-cgname> | Ref,RelBase,RelCont | rel: 1
+// CHECK-NEXT: RelBase,RelCont | Prot2 | [[Prot2_USR]]
+// CHECK: 39:12 | class/ObjC | Sub | [[Sub_USR:.*]] | _OBJC_CLASS_$_Sub | Decl | rel: 0
+// CHECK: 39:18 | class/ObjC | Base | [[Base_USR]] | _OBJC_CLASS_$_Base | Ref,RelBase,RelCont | rel: 1
+// CHECK-NEXT: RelBase,RelCont | Sub | [[Sub_USR]]
+// CHECK: 39:23 | protocol/ObjC | Prot2 | [[Prot2_USR]] | <no-cgname> | Ref,RelBase,RelCont | rel: 1
+// CHECK-NEXT: RelBase,RelCont | Sub | [[Sub_USR]]
+// CHECK: 39:30 | protocol/ObjC | Prot1 | [[Prot1_USR]] | <no-cgname> | Ref,RelBase,RelCont | rel: 1
+// CHECK-NEXT: RelBase,RelCont | Sub | [[Sub_USR]]
+// CHECK: 41:8 | instance-method/ObjC | getit | {{.*}} | -[Sub getit] | Decl,Dyn,RelChild | rel: 1
+// CHECK-NEXT: RelChild | Sub | [[Sub_USR]]
+// CHECK: 45:7 | class/C++ | Cls | [[Cls_USR:.*]] | <no-cgname> | Def | rel: 0
+// CHECK: 50:7 | class/C++ | SubCls1 | [[SubCls1_USR:.*]] | <no-cgname> | Def | rel: 0
+// CHECK: 50:24 | class/C++ | Cls | [[Cls_USR]] | <no-cgname> | Ref,RelBase,RelCont | rel: 1
+// CHECK-NEXT: RelBase,RelCont | SubCls1 | [[SubCls1_USR]]
+// CHECK: 52:12 | field/C++ | f | {{.*}} | <no-cgname> | Def,RelChild | rel: 1
+// CHECK-NEXT: RelChild | SubCls1 | [[SubCls1_USR]]