xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/require-modular-includes.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: rm -rf %t
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc// Including a header from the imported module
4*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromImportedModuleOK;' | \
5*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
6*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
7*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc// Including a non-modular header
10*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromImportedModuleFail;' | \
11*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
12*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
13*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
14*0a6a1f1dSLionel Sambuc// RUN:     -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
15*0a6a1f1dSLionel Sambuc
16*0a6a1f1dSLionel Sambuc// Including a header from a subframework
17*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromSubframework;' | \
18*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
19*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
20*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
21*0a6a1f1dSLionel Sambuc
22*0a6a1f1dSLionel Sambuc// Including a header from a subframework (fail)
23*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromNonModularSubframework;' | \
24*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
25*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
26*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
27*0a6a1f1dSLionel Sambuc// RUN:     -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc// Including a non-modular header from a submodule
30*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromImportedSubModule;' | \
31*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
32*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
33*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
34*0a6a1f1dSLionel Sambuc// RUN:     -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
35*0a6a1f1dSLionel Sambuc
36*0a6a1f1dSLionel Sambuc// Including a non-modular header (directly) with -fmodule-name set
37*0a6a1f1dSLionel Sambuc// RUN: echo '#include "NotInModule.h"' | \
38*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
39*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \
40*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fmodule-name=A -fsyntax-only -x objective-c -
41*0a6a1f1dSLionel Sambuc
42*0a6a1f1dSLionel Sambuc// Including an excluded header
43*0a6a1f1dSLionel Sambuc// RUN: echo '@import IncludeExcluded;' | \
44*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
45*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
46*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
47*0a6a1f1dSLionel Sambuc
48*0a6a1f1dSLionel Sambuc// Including a header from another module
49*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromAnotherModule;' | \
50*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
51*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
52*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
53*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
54*0a6a1f1dSLionel Sambuc
55*0a6a1f1dSLionel Sambuc// Including an excluded header from another module
56*0a6a1f1dSLionel Sambuc// RUN: echo '@import ExcludedFromAnotherModule;' | \
57*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
58*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
59*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
60*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
61*0a6a1f1dSLionel Sambuc
62*0a6a1f1dSLionel Sambuc// Including a header from an umbrella directory
63*0a6a1f1dSLionel Sambuc// RUN: echo '@import FromUmbrella;' | \
64*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
65*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
66*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
67*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
68*0a6a1f1dSLionel Sambuc
69*0a6a1f1dSLionel Sambuc// A includes B includes non-modular C
70*0a6a1f1dSLionel Sambuc// RUN: echo '@import A;' | \
71*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
72*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \
73*0a6a1f1dSLionel Sambuc// RUN:     -I %S/Inputs/require-modular-includes \
74*0a6a1f1dSLionel Sambuc// RUN:     -fsyntax-only -x objective-c - 2>&1 | FileCheck %s
75*0a6a1f1dSLionel Sambuc
76*0a6a1f1dSLionel Sambuc// Non-framework module (pass)
77*0a6a1f1dSLionel Sambuc// RUN: echo '@import NotFramework;' | \
78*0a6a1f1dSLionel Sambuc// RUN:   %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \
79*0a6a1f1dSLionel Sambuc// RUN:     -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \
80*0a6a1f1dSLionel Sambuc// RUN:     -Werror -fsyntax-only -x objective-c -
81*0a6a1f1dSLionel Sambuc
82*0a6a1f1dSLionel Sambuc// CHECK: include of non-modular header
83