summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/merge-class-definition-visibility/a.h1
-rw-r--r--clang/test/Modules/Inputs/merge-class-definition-visibility/b.h2
-rw-r--r--clang/test/Modules/Inputs/merge-class-definition-visibility/c.h1
-rw-r--r--clang/test/Modules/Inputs/merge-class-definition-visibility/d.h1
-rw-r--r--clang/test/Modules/Inputs/merge-class-definition-visibility/modmap7
-rw-r--r--clang/test/Modules/merge-class-definition-visibility.cpp15
6 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/a.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/a.h
new file mode 100644
index 00000000000..4c5cd949f23
--- /dev/null
+++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/a.h
@@ -0,0 +1 @@
+struct A {};
diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/b.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/b.h
new file mode 100644
index 00000000000..2b8f5f868ed
--- /dev/null
+++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/b.h
@@ -0,0 +1,2 @@
+// Include definition of A into the same module as c.h
+#include "a.h"
diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/c.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/c.h
new file mode 100644
index 00000000000..27f503c2c60
--- /dev/null
+++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/c.h
@@ -0,0 +1 @@
+struct A;
diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/d.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/d.h
new file mode 100644
index 00000000000..2243de1baf9
--- /dev/null
+++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/d.h
@@ -0,0 +1 @@
+#include "a.h"
diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/modmap b/clang/test/Modules/Inputs/merge-class-definition-visibility/modmap
new file mode 100644
index 00000000000..7d988fbba00
--- /dev/null
+++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/modmap
@@ -0,0 +1,7 @@
+module Def1 {
+ module B { header "b.h" }
+ module C { header "c.h" }
+}
+module Def2 {
+ header "d.h"
+}
diff --git a/clang/test/Modules/merge-class-definition-visibility.cpp b/clang/test/Modules/merge-class-definition-visibility.cpp
new file mode 100644
index 00000000000..e8602c0d548
--- /dev/null
+++ b/clang/test/Modules/merge-class-definition-visibility.cpp
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \
+// RUN: -I%S/Inputs/merge-class-definition-visibility \
+// RUN: -fmodules-cache-path=%t %s -verify
+// expected-no-diagnostics
+
+#include "c.h"
+template<typename T> struct X { T t; };
+typedef X<A> XA;
+
+#include "d.h"
+// Ensure that this triggers the import of the second definition from d.h,
+// which is necessary to make the definition of A visible in the template
+// instantiation.
+XA xa;
OpenPOWER on IntegriCloud