summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/A.framework/Headers/A.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/AnotherModule.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/AnotherModuleExcluded.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/B.framework/Headers/B.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/C.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/ExcludedFromAnotherModule.framework/Headers/ExcludedFromAnotherModule.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromAnotherModule.framework/Headers/FromAnotherModule.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleFail.framework/Headers/FromImportedModuleFail.h2
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK2.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Modules/module.modulemap4
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Headers/Header.h2
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Modules/module.modulemap5
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h0
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Headers/FromNonModularSubframework.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Modules/module.modulemap3
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Headers/FromSubframework.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Modules/module.modulemap7
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/FromUmbrella.framework/Headers/FromUmbrella.h2
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/Excluded.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/IncludeExcluded.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Modules/module.modulemap4
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/NotFramework.h2
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/NotInModule.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/module.modulemap12
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/umbrella/bar/bar.h1
-rw-r--r--clang/test/Modules/Inputs/require-modular-includes/umbrella/foo.h1
-rw-r--r--clang/test/Modules/require-modular-includes.m95
29 files changed, 155 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/require-modular-includes/A.framework/Headers/A.h b/clang/test/Modules/Inputs/require-modular-includes/A.framework/Headers/A.h
new file mode 100644
index 00000000000..fad91bdbfd0
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/A.framework/Headers/A.h
@@ -0,0 +1 @@
+#include "B/B.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/AnotherModule.h b/clang/test/Modules/Inputs/require-modular-includes/AnotherModule.h
new file mode 100644
index 00000000000..96913aa22ac
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/AnotherModule.h
@@ -0,0 +1 @@
+// AnotherModule.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/AnotherModuleExcluded.h b/clang/test/Modules/Inputs/require-modular-includes/AnotherModuleExcluded.h
new file mode 100644
index 00000000000..b539dd9ba9c
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/AnotherModuleExcluded.h
@@ -0,0 +1 @@
+// AnotherModuleExcluded.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/B.framework/Headers/B.h b/clang/test/Modules/Inputs/require-modular-includes/B.framework/Headers/B.h
new file mode 100644
index 00000000000..77d6ff1e5f4
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/B.framework/Headers/B.h
@@ -0,0 +1 @@
+#include "C.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/C.h b/clang/test/Modules/Inputs/require-modular-includes/C.h
new file mode 100644
index 00000000000..a0121d46b41
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/C.h
@@ -0,0 +1 @@
+// C.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/ExcludedFromAnotherModule.framework/Headers/ExcludedFromAnotherModule.h b/clang/test/Modules/Inputs/require-modular-includes/ExcludedFromAnotherModule.framework/Headers/ExcludedFromAnotherModule.h
new file mode 100644
index 00000000000..0c0ce7bb560
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/ExcludedFromAnotherModule.framework/Headers/ExcludedFromAnotherModule.h
@@ -0,0 +1 @@
+#include "AnotherModuleExcluded.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromAnotherModule.framework/Headers/FromAnotherModule.h b/clang/test/Modules/Inputs/require-modular-includes/FromAnotherModule.framework/Headers/FromAnotherModule.h
new file mode 100644
index 00000000000..1fe5c08acee
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromAnotherModule.framework/Headers/FromAnotherModule.h
@@ -0,0 +1 @@
+#include "AnotherModule.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleFail.framework/Headers/FromImportedModuleFail.h b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleFail.framework/Headers/FromImportedModuleFail.h
new file mode 100644
index 00000000000..a80bcc6945b
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleFail.framework/Headers/FromImportedModuleFail.h
@@ -0,0 +1,2 @@
+// FromImportedModuleFail.h
+#include "NotInModule.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK.h b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK.h
new file mode 100644
index 00000000000..3b2056c4549
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK.h
@@ -0,0 +1 @@
+#include "FromImportedModuleOK2.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK2.h b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK2.h
new file mode 100644
index 00000000000..775fd6e4d82
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK2.h
@@ -0,0 +1 @@
+// FromImportedModuleOK2.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..26381110d20
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromImportedModuleOK.framework/Modules/module.modulemap
@@ -0,0 +1,4 @@
+framework module FromImportedModuleOK {
+ header "FromImportedModuleOK.h"
+ header "FromImportedModuleOK2.h"
+}
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Headers/Header.h b/clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Headers/Header.h
new file mode 100644
index 00000000000..613cd9d6816
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Headers/Header.h
@@ -0,0 +1,2 @@
+// Header.h
+#include "NotInModule.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..c07efec72b8
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromImportedSubModule.framework/Modules/module.modulemap
@@ -0,0 +1,5 @@
+framework module FromImportedSubModule {
+ module Sub {
+ header "Header.h"
+ }
+}
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h b/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Headers/FromNonModularSubframework.h b/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Headers/FromNonModularSubframework.h
new file mode 100644
index 00000000000..4680be4a37a
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Headers/FromNonModularSubframework.h
@@ -0,0 +1 @@
+#include "Subframework/Subframework.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..c308ea429bd
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromNonModularSubframework.framework/Modules/module.modulemap
@@ -0,0 +1,3 @@
+framework module FromNonModularSubframework {
+ header "FromNonModularSubframework.h"
+}
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h b/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h
new file mode 100644
index 00000000000..c08fac0b55f
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h
@@ -0,0 +1 @@
+// Subframework.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Headers/FromSubframework.h b/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Headers/FromSubframework.h
new file mode 100644
index 00000000000..4680be4a37a
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Headers/FromSubframework.h
@@ -0,0 +1 @@
+#include "Subframework/Subframework.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..250f05ace0d
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromSubframework.framework/Modules/module.modulemap
@@ -0,0 +1,7 @@
+framework module FromSubframework {
+ umbrella header "FromSubframework.h"
+
+ framework module Subframework {
+ umbrella header "Subframework.h"
+ }
+}
diff --git a/clang/test/Modules/Inputs/require-modular-includes/FromUmbrella.framework/Headers/FromUmbrella.h b/clang/test/Modules/Inputs/require-modular-includes/FromUmbrella.framework/Headers/FromUmbrella.h
new file mode 100644
index 00000000000..f6f891f53f3
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/FromUmbrella.framework/Headers/FromUmbrella.h
@@ -0,0 +1,2 @@
+#include "umbrella/foo.h"
+#include "umbrella/bar/bar.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/Excluded.h b/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/Excluded.h
new file mode 100644
index 00000000000..f330e6c0ecd
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/Excluded.h
@@ -0,0 +1 @@
+// Excluded.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/IncludeExcluded.h b/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/IncludeExcluded.h
new file mode 100644
index 00000000000..f2ffdc327ed
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Headers/IncludeExcluded.h
@@ -0,0 +1 @@
+#include "Excluded.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..a1753539bd1
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/IncludeExcluded.framework/Modules/module.modulemap
@@ -0,0 +1,4 @@
+framework module IncludeExcluded {
+ header "IncludeExcluded.h"
+ exclude header "Excluded.h"
+}
diff --git a/clang/test/Modules/Inputs/require-modular-includes/NotFramework.h b/clang/test/Modules/Inputs/require-modular-includes/NotFramework.h
new file mode 100644
index 00000000000..3afd8fc64a0
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/NotFramework.h
@@ -0,0 +1,2 @@
+// NotFramework.h
+#import "NotInModule.h"
diff --git a/clang/test/Modules/Inputs/require-modular-includes/NotInModule.h b/clang/test/Modules/Inputs/require-modular-includes/NotInModule.h
new file mode 100644
index 00000000000..c2a626cab92
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/NotInModule.h
@@ -0,0 +1 @@
+// NotInModule.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/module.modulemap b/clang/test/Modules/Inputs/require-modular-includes/module.modulemap
new file mode 100644
index 00000000000..0ac4d5b7030
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/module.modulemap
@@ -0,0 +1,12 @@
+module AnotherModule {
+ header "AnotherModule.h"
+ exclude header "AnotherModuleExcluded.h"
+}
+module Umbrella {
+ umbrella "umbrella"
+}
+module NotFramework {
+ header "NotFramework.h"
+}
+
+framework module * { }
diff --git a/clang/test/Modules/Inputs/require-modular-includes/umbrella/bar/bar.h b/clang/test/Modules/Inputs/require-modular-includes/umbrella/bar/bar.h
new file mode 100644
index 00000000000..410aba26390
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/umbrella/bar/bar.h
@@ -0,0 +1 @@
+// bar.h
diff --git a/clang/test/Modules/Inputs/require-modular-includes/umbrella/foo.h b/clang/test/Modules/Inputs/require-modular-includes/umbrella/foo.h
new file mode 100644
index 00000000000..249664863bd
--- /dev/null
+++ b/clang/test/Modules/Inputs/require-modular-includes/umbrella/foo.h
@@ -0,0 +1 @@
+// foo.h
diff --git a/clang/test/Modules/require-modular-includes.m b/clang/test/Modules/require-modular-includes.m
new file mode 100644
index 00000000000..55674319ff4
--- /dev/null
+++ b/clang/test/Modules/require-modular-includes.m
@@ -0,0 +1,95 @@
+// RUN: rm -rf %t
+// REQUIRES: shell
+
+// Including a header from the imported module
+// RUN: echo '@import FromImportedModuleOK;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// Including a non-modular header
+// RUN: echo '@import FromImportedModuleFail;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
+
+// Including a header from a subframework
+// RUN: echo '@import FromSubframework;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// Including a header from a subframework (fail)
+// RUN: echo '@import FromNonModularSubframework;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
+
+// Including a non-modular header from a submodule
+// RUN: echo '@import FromImportedSubModule;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
+
+// Including a non-modular header (directly) with -fmodule-name set
+// RUN: echo '#include "NotInModule.h"' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \
+// RUN: -Werror -fmodule-name=A -fsyntax-only -x objective-c -
+
+// Including a non-modular header (directly) with -Wnon-modular-include
+// RUN: echo '#include "NotInModule.h"' | \
+// RUN: %clang_cc1 -Wnon-modular-include -fmodules \
+// RUN: -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \
+// RUN: -fmodule-name=A -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
+
+// Including an excluded header
+// RUN: echo '@import IncludeExcluded;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// Including a header from another module
+// RUN: echo '@import FromAnotherModule;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// Including an excluded header from another module
+// RUN: echo '@import ExcludedFromAnotherModule;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// Including a header from an umbrella directory
+// RUN: echo '@import FromUmbrella;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// A includes B includes non-modular C
+// RUN: echo '@import A;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
+// RUN: -I %S/Inputs/require-modular-includes \
+// RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
+
+// Non-framework module (pass)
+// RUN: echo '@import NotFramework;' | \
+// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
+// RUN: -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \
+// RUN: -Werror -fsyntax-only -x objective-c -
+
+// Non-framework module (fail)
+// RUN: echo '@import NotFramework;' | \
+// RUN: not %clang_cc1 -Werror=non-modular-include -fmodules \
+// RUN: -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \
+// RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
+
+// CHECK: include of non-modular header
OpenPOWER on IntegriCloud