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