summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/codegen-flags/foo.h4
-rw-r--r--clang/test/Modules/Inputs/codegen-flags/foo.modulemap1
-rw-r--r--clang/test/Modules/Inputs/codegen-flags/use.cpp5
-rw-r--r--clang/test/Modules/codegen-flags.test25
-rw-r--r--clang/test/Modules/codegen.test2
5 files changed, 36 insertions, 1 deletions
diff --git a/clang/test/Modules/Inputs/codegen-flags/foo.h b/clang/test/Modules/Inputs/codegen-flags/foo.h
new file mode 100644
index 00000000000..7b9c1cd8e08
--- /dev/null
+++ b/clang/test/Modules/Inputs/codegen-flags/foo.h
@@ -0,0 +1,4 @@
+struct foo {
+};
+inline void f1() {
+}
diff --git a/clang/test/Modules/Inputs/codegen-flags/foo.modulemap b/clang/test/Modules/Inputs/codegen-flags/foo.modulemap
new file mode 100644
index 00000000000..2e095d2794c
--- /dev/null
+++ b/clang/test/Modules/Inputs/codegen-flags/foo.modulemap
@@ -0,0 +1 @@
+module foo { header "foo.h" }
diff --git a/clang/test/Modules/Inputs/codegen-flags/use.cpp b/clang/test/Modules/Inputs/codegen-flags/use.cpp
new file mode 100644
index 00000000000..378ff3124e7
--- /dev/null
+++ b/clang/test/Modules/Inputs/codegen-flags/use.cpp
@@ -0,0 +1,5 @@
+#include "foo.h"
+void use() {
+ f1();
+ foo f;
+}
diff --git a/clang/test/Modules/codegen-flags.test b/clang/test/Modules/codegen-flags.test
new file mode 100644
index 00000000000..4cc62e87358
--- /dev/null
+++ b/clang/test/Modules/codegen-flags.test
@@ -0,0 +1,25 @@
+RUN: rm -rf %t
+REQUIRES: x86-registered-target
+
+RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -x c++ -fmodules -emit-module -fmodule-name=foo %S/Inputs/codegen-flags/foo.modulemap -o %t/foo-cg.pcm
+RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-debuginfo -x c++ -fmodules -emit-module -fmodule-name=foo %S/Inputs/codegen-flags/foo.modulemap -o %t/foo-di.pcm
+
+RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - %t/foo-cg.pcm | FileCheck --check-prefix=CG %s
+RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - %t/foo-di.pcm | FileCheck --check-prefix=DI %s
+
+RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -fmodules -fmodule-file=%t/foo-cg.pcm %S/Inputs/codegen-flags/use.cpp | FileCheck --check-prefix=CG-USE %s
+RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -fmodules -fmodule-file=%t/foo-di.pcm %S/Inputs/codegen-flags/use.cpp | FileCheck --check-prefix=DI-USE %s
+
+CG: define weak_odr void @_Z2f1v
+CG: DICompileUnit
+CG-NOT: DICompositeType
+
+CG-USE: declare void @_Z2f1v
+CG-USE: DICompileUnit
+CG-USE: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
+
+DI-NOT: define
+DI: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
+
+DI-USE: define linkonce_odr void @_Z2f1v
+DI-USE: = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", {{.*}}, flags: DIFlagFwdDecl
diff --git a/clang/test/Modules/codegen.test b/clang/test/Modules/codegen.test
index ce252e89ebd..e8faa12fd94 100644
--- a/clang/test/Modules/codegen.test
+++ b/clang/test/Modules/codegen.test
@@ -1,7 +1,7 @@
RUN: rm -rf %t
REQUIRES: x86-registered-target
-RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -x c++ -fmodules -emit-module -fmodule-name=foo %S/Inputs/codegen/foo.modulemap -o %t/foo.pcm
+RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -fmodules-debuginfo -x c++ -fmodules -emit-module -fmodule-name=foo %S/Inputs/codegen/foo.modulemap -o %t/foo.pcm
RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - %t/foo.pcm | FileCheck --check-prefix=FOO --check-prefix=BOTH %s
RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -fmodules -fmodule-file=%t/foo.pcm %S/Inputs/codegen/use.cpp | FileCheck --check-prefix=BOTH --check-prefix=USE %s
OpenPOWER on IntegriCloud