1// RUN: rm -rf %t 2// RUN: split-file %s %t 3// RUN: sed -e "s;TEST_DIR;%/t;g" %t/sed-overlay.yaml > %t/overlay.yaml 4 5// These tests first build with an overlay such that the header is resolved 6// to %t/other/Mismatch.h. They then build again with the header resolved 7// to the one in their directory. 8// 9// This should cause a rebuild if the contents is different (and thus multiple 10// PCMs), but this currently isn't the case. We should at least not error, 11// since this does happen in real projects (with a different copy of the same 12// file). 13 14// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/hf-mcp -ivfsoverlay %t/overlay.yaml -F %t/header-frameworks -fsyntax-only -verify %t/use.m 15// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/hf-mcp -F %t/header-frameworks -fsyntax-only -verify %t/use.m 16// RUN: find %t/hf-mcp -name "Mismatch-*.pcm" | count 1 17 18// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/df-mcp -ivfsoverlay %t/overlay.yaml -F %t/dir-frameworks -fsyntax-only -verify %t/use.m 19// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/hf-mcp -F %t/dir-frameworks -fsyntax-only -verify %t/use.m 20// RUN: find %t/df-mcp -name "Mismatch-*.pcm" | count 1 21 22// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/nf-mcp -ivfsoverlay %t/overlay.yaml -F %t/norm-frameworks -fsyntax-only -verify %t/use.m 23// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/nf-mcp -F %t/norm-frameworks -fsyntax-only -verify %t/use.m 24// RUN: find %t/nf-mcp -name "Mismatch-*.pcm" | count 1 25 26// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/m-mcp -ivfsoverlay %t/overlay.yaml -I %t/mod -fsyntax-only -verify %t/use.m 27// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/m-mcp -I %t/mod -fsyntax-only -verify %t/use.m 28// RUN: find %t/m-mcp -name "Mismatch-*.pcm" | count 1 29 30//--- use.m 31// expected-no-diagnostics 32@import Mismatch; 33 34//--- header-frameworks/Mismatch.framework/Modules/module.modulemap 35framework module Mismatch { 36 umbrella header "Mismatch.h" 37} 38//--- header-frameworks/Mismatch.framework/Headers/Mismatch.h 39 40//--- dir-frameworks/Mismatch.framework/Modules/module.modulemap 41framework module Mismatch { 42 umbrella "someheaders" 43} 44//--- dir-frameworks/Mismatch.framework/someheaders/Mismatch.h 45 46//--- norm-frameworks/Mismatch.framework/Modules/module.modulemap 47framework module Mismatch { 48 header "Mismatch.h" 49} 50//--- norm-frameworks/Mismatch.framework/Headers/Mismatch.h 51 52//--- mod/module.modulemap 53module Mismatch { 54 umbrella header "Mismatch.h" 55} 56//--- mod/Mismatch.h 57 58//--- other/Mismatch.h 59 60//--- sed-overlay.yaml 61{ 62 'version': 0, 63 'roots': [ 64 { 'name': 'TEST_DIR', 'type': 'directory', 65 'contents': [ 66 { 'name': 'header-frameworks/Mismatch.framework/Headers/Mismatch.h', 67 'type': 'file', 68 'external-contents': 'TEST_DIR/other/Mismatch.h' 69 }, 70 { 'name': 'dir-frameworks/Mismatch.framework/someheaders', 71 'type': 'directory', 72 'external-contents': 'TEST_DIR/others' 73 }, 74 { 'name': 'norm-frameworks/Mismatch.framework/Headers/Mismatch.h', 75 'type': 'file', 76 'external-contents': 'TEST_DIR/other/Mismatch.h' 77 }, 78 { 'name': 'mod/Mismatch.h', 79 'type': 'file', 80 'external-contents': 'TEST_DIR/other/Mismatch.h' 81 } 82 ] 83 } 84 ] 85} 86 87