1 // This test is for cases where we lookup a file by its 'real' path before we
2 // use its VFS-mapped path. If we accidentally use the real path in header
3 // search, we will not find a module for the headers. To test that we
4 // intentionally rebuild modules, since the precompiled module file refers to
5 // the dependency files by real path.
7 // RUN: rm -rf %t %t-cache %t.pch
8 // RUN: mkdir -p %t/SomeFramework.framework/Modules
9 // RUN: cat %S/Inputs/some_frame_module.map > %t/SomeFramework.framework/Modules/module.modulemap
10 // RUN: sed -e "s@INPUT_DIR@%{/S:regex_replacement}/Inputs@g" -e "s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsoverlay.yaml > %t.yaml
13 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
14 // RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Rmodule-include-translation \
15 // RUN: -Werror=non-modular-include-in-framework-module
18 // RUN: echo ' ' >> %t/SomeFramework.framework/Modules/module.modulemap
19 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
20 // RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Rmodule-include-translation \
21 // RUN: -Werror=non-modular-include-in-framework-module
24 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
25 // RUN: -ivfsoverlay %t.yaml -emit-pch %s -o %t.pch \
26 // RUN: -Werror=non-modular-include-in-framework-module \
27 // RUN: -fmodules-ignore-macro=WITH_PREFIX
28 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
29 // RUN: -ivfsoverlay %t.yaml -include-pch %t.pch -fsyntax-only %s \
30 // RUN: -Werror=non-modular-include-in-framework-module -DWITH_PREFIX \
31 // RUN: -fmodules-ignore-macro=WITH_PREFIX
34 // RUN: c-index-test -index-file %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
35 // RUN: -ivfsoverlay %t.yaml -fsyntax-only -Rmodule-include-translation \
36 // RUN: -Werror=non-modular-include-in-framework-module | FileCheck %s
37 // RUN: echo ' ' >> %t/SomeFramework.framework/Modules/module.modulemap
38 // RUN: c-index-test -index-file %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
39 // RUN: -ivfsoverlay %t.yaml -fsyntax-only -Rmodule-include-translation \
40 // RUN: -Werror=non-modular-include-in-framework-module | FileCheck %s
41 // CHECK: warning: treating
44 // With a VFS-mapped module map file
45 // RUN: mv %t/SomeFramework.framework/Modules/module.modulemap %t/hide_module.map
46 // RUN: echo "{ 'version': 0, 'roots': [ { " > %t2.yaml
47 // RUN: echo "'name': '%t/SomeFramework.framework/Modules/module.modulemap'," >> %t2.yaml
48 // RUN: echo "'type': 'file', 'external-contents': '%t/hide_module.map' } ] }" >> %t2.yaml
50 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
51 // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only %s -verify \
52 // RUN: -Rmodule-include-translation -Werror=non-modular-include-in-framework-module
53 // RUN: echo ' ' >> %t/hide_module.map
54 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
55 // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only %s -verify \
56 // RUN: -Rmodule-include-translation -Werror=non-modular-include-in-framework-module
58 // Within a module build
59 // RUN: echo '@import import_some_frame;' | \
60 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
61 // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only - \
62 // RUN: -Werror=non-modular-include-in-framework-module -x objective-c -I %t
63 // RUN: echo ' ' >> %t/hide_module.map
64 // RUN: echo '@import import_some_frame;' | \
65 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
66 // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only - \
67 // RUN: -Werror=non-modular-include-in-framework-module -x objective-c -I %t
70 #import <SomeFramework/public_header.h> // expected-remark{{treating}}
71 #import <SomeFramework/public_header2.h> // expected-remark{{treating}}
72 #import <SomeFramework/public_header3.h> // expected-remark{{treating}}
73 @import SomeFramework.public_header2;