]> granicus.if.org Git - clang/commitdiff
[modules] Additional tests.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 26 Jan 2017 23:07:59 +0000 (23:07 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 26 Jan 2017 23:07:59 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293223 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
test/Modules/Inputs/anon-redecl/a.h [new file with mode: 0644]
test/Modules/Inputs/anon-redecl/b.h [new file with mode: 0644]
test/Modules/Inputs/anon-redecl/c1.h [new file with mode: 0644]
test/Modules/Inputs/anon-redecl/c2.h [new file with mode: 0644]
test/Modules/Inputs/anon-redecl/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/hidden-names/hidden.h [new file with mode: 0644]
test/Modules/Inputs/hidden-names/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/hidden-names/visible.h [new file with mode: 0644]
test/Modules/Inputs/merge-function-defs/a.h [new file with mode: 0644]
test/Modules/Inputs/merge-function-defs/b.h [new file with mode: 0644]
test/Modules/Inputs/merge-function-defs/map [new file with mode: 0644]
test/Modules/anon-redecl.cpp [new file with mode: 0644]
test/Modules/hidden-names.cpp [new file with mode: 0644]
test/Modules/merge-function-defs.cpp [new file with mode: 0644]

diff --git a/test/Modules/Inputs/anon-redecl/a.h b/test/Modules/Inputs/anon-redecl/a.h
new file mode 100644 (file)
index 0000000..1b23e72
--- /dev/null
@@ -0,0 +1,2 @@
+struct X { union { int n; }; };
+inline int a(X x) { return x.n; }
diff --git a/test/Modules/Inputs/anon-redecl/b.h b/test/Modules/Inputs/anon-redecl/b.h
new file mode 100644 (file)
index 0000000..23ea804
--- /dev/null
@@ -0,0 +1,2 @@
+struct X { union { int n; }; };
+inline int b(X x) { return x.n; }
diff --git a/test/Modules/Inputs/anon-redecl/c1.h b/test/Modules/Inputs/anon-redecl/c1.h
new file mode 100644 (file)
index 0000000..600af31
--- /dev/null
@@ -0,0 +1,2 @@
+#include "a.h"
+#include "b.h"
diff --git a/test/Modules/Inputs/anon-redecl/c2.h b/test/Modules/Inputs/anon-redecl/c2.h
new file mode 100644 (file)
index 0000000..2e99b27
--- /dev/null
@@ -0,0 +1,2 @@
+struct X { union { int n; }; };
+inline int c(X x) { return x.n; }
diff --git a/test/Modules/Inputs/anon-redecl/module.modulemap b/test/Modules/Inputs/anon-redecl/module.modulemap
new file mode 100644 (file)
index 0000000..4967845
--- /dev/null
@@ -0,0 +1,6 @@
+module a { header "a.h" }
+module b { header "b.h" }
+module c {
+  module c1 { header "c1.h" }
+  module c2 { header "c2.h" }
+}
diff --git a/test/Modules/Inputs/hidden-names/hidden.h b/test/Modules/Inputs/hidden-names/hidden.h
new file mode 100644 (file)
index 0000000..e5c2f55
--- /dev/null
@@ -0,0 +1,3 @@
+namespace NS {
+  struct X {};
+}
diff --git a/test/Modules/Inputs/hidden-names/module.modulemap b/test/Modules/Inputs/hidden-names/module.modulemap
new file mode 100644 (file)
index 0000000..1471f58
--- /dev/null
@@ -0,0 +1,4 @@
+module hidden {
+  header "visible.h"
+  explicit module sub { header "hidden.h" }
+}
diff --git a/test/Modules/Inputs/hidden-names/visible.h b/test/Modules/Inputs/hidden-names/visible.h
new file mode 100644 (file)
index 0000000..3dfc9c7
--- /dev/null
@@ -0,0 +1,2 @@
+// hidden-names/visible.h
+namespace NS {}
diff --git a/test/Modules/Inputs/merge-function-defs/a.h b/test/Modules/Inputs/merge-function-defs/a.h
new file mode 100644 (file)
index 0000000..7fc0e52
--- /dev/null
@@ -0,0 +1,4 @@
+struct X {
+  virtual void f();
+};
+inline void X::f() {}
diff --git a/test/Modules/Inputs/merge-function-defs/b.h b/test/Modules/Inputs/merge-function-defs/b.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/Modules/Inputs/merge-function-defs/map b/test/Modules/Inputs/merge-function-defs/map
new file mode 100644 (file)
index 0000000..f84c7dd
--- /dev/null
@@ -0,0 +1,4 @@
+module m {
+  module a { header "a.h" }
+  module b { header "b.h" }
+}
diff --git a/test/Modules/anon-redecl.cpp b/test/Modules/anon-redecl.cpp
new file mode 100644 (file)
index 0000000..c3c5c9e
--- /dev/null
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-local-submodule-visibility \
+// RUN:            -fmodule-map-file=%S/Inputs/anon-redecl/module.modulemap \
+// RUN:            -I%S/Inputs/anon-redecl \
+// RUN:            -verify -std=c++11 %s
+
+#include "a.h"
+#include "b.h"
+#include "c1.h"
+#include "c2.h"
+
+// expected-no-diagnostics
+int x = a({});
+int y = b({});
+int z = c({});
diff --git a/test/Modules/hidden-names.cpp b/test/Modules/hidden-names.cpp
new file mode 100644 (file)
index 0000000..ba945a1
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/hidden-names %s -verify
+// expected-no-diagnostics
+
+#include "visible.h"
+
+using namespace NS;
+
+namespace {
+  struct X { void f(); };
+}
+
+void X::f() {}
diff --git a/test/Modules/merge-function-defs.cpp b/test/Modules/merge-function-defs.cpp
new file mode 100644 (file)
index 0000000..2f08f52
--- /dev/null
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -I%S/Inputs/merge-function-defs -fmodules -fmodule-map-file=%S/Inputs/merge-function-defs/map -fmodules-cache-path=%t %s -emit-llvm-only
+
+#include "b.h"
+
+struct X {
+  virtual void f();
+};
+inline void X::f() {}
+
+X x;