1 // Check that the presence of non-affecting module map files does not affect the
2 // contents of PCM files.
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: split-file %s %t
7 //--- a/module.modulemap
10 //--- b/module.modulemap
13 //--- c/module.modulemap
14 module c { header "c.h" }
21 //--- explicit-mms-common-args.rsp
22 -fmodule-map-file=b/module.modulemap -fmodule-map-file=c/module.modulemap -fmodules -fmodules-cache-path=cache -fdisable-module-hash -fsyntax-only tu.m
23 //--- implicit-search-args.rsp
24 -I a -I b -I c -fimplicit-module-maps -fmodules -fmodules-cache-path=cache -fdisable-module-hash -fsyntax-only tu.m
25 //--- implicit-search-args.rsp-end
27 // Test with explicit module map files.
29 // RUN: %clang_cc1 -working-directory %t @%t/explicit-mms-common-args.rsp
30 // RUN: mv %t/cache %t/cache-explicit-no-a-prune
31 // RUN: %clang_cc1 -working-directory %t @%t/explicit-mms-common-args.rsp -fno-modules-prune-non-affecting-module-map-files
32 // RUN: mv %t/cache %t/cache-explicit-no-a-keep
34 // RUN: %clang_cc1 -working-directory %t -fmodule-map-file=a/module.modulemap @%t/explicit-mms-common-args.rsp
35 // RUN: mv %t/cache %t/cache-explicit-a-prune
36 // RUN: %clang_cc1 -working-directory %t -fmodule-map-file=a/module.modulemap @%t/explicit-mms-common-args.rsp -fno-modules-prune-non-affecting-module-map-files
37 // RUN: mv %t/cache %t/cache-explicit-a-keep
39 // RUN: diff %t/cache-explicit-no-a-prune/c.pcm %t/cache-explicit-a-prune/c.pcm
40 // RUN: not diff %t/cache-explicit-no-a-keep/c.pcm %t/cache-explicit-a-keep/c.pcm
42 // Test with implicit module map search.
44 // RUN: %clang_cc1 -working-directory %t @%t/implicit-search-args.rsp
45 // RUN: mv %t/cache %t/cache-implicit-no-a-prune
46 // RUN: %clang_cc1 -working-directory %t @%t/implicit-search-args.rsp -fno-modules-prune-non-affecting-module-map-files
47 // RUN: mv %t/cache %t/cache-implicit-no-a-keep
49 // FIXME: Instead of removing "a/module.modulemap" from the file system, we
50 // could drop the "-I a" search path argument in combination with the
51 // "-fmodules-skip-header-search-paths" flag. Unfortunately, that flag
52 // does not prevent serialization of the search path usage bit vector,
53 // making the files differ anyways.
54 // RUN: rm %t/a/module.modulemap
56 // RUN: %clang_cc1 -working-directory %t @%t/implicit-search-args.rsp
57 // RUN: mv %t/cache %t/cache-implicit-a-prune
58 // RUN: %clang_cc1 -working-directory %t @%t/implicit-search-args.rsp -fno-modules-prune-non-affecting-module-map-files
59 // RUN: mv %t/cache %t/cache-implicit-a-keep
61 // RUN: diff %t/cache-implicit-no-a-prune/c.pcm %t/cache-implicit-a-prune/c.pcm
62 // RUN: not diff %t/cache-implicit-no-a-keep/c.pcm %t/cache-implicit-a-keep/c.pcm