1*67e74705SXin Li// RUN: cd %S 2*67e74705SXin Li// RUN: rm -rf %t 3*67e74705SXin Li// 4*67e74705SXin Li// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse %s -dependency-file - -MT implicit.pcm -o %t/implicit.pcm -fmodules-cache-path=%t -fmodule-map-file-home-is-cwd -fmodule-map-file=%S/Inputs/dependency-gen-base.modulemap | FileCheck %s --check-prefix=IMPLICIT 5*67e74705SXin Li// 6*67e74705SXin Li// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test-base -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse Inputs/dependency-gen-base.modulemap -o %t/base.pcm -fmodule-map-file-home-is-cwd -fmodule-map-file=%S/Inputs/dependency-gen-base.modulemap 7*67e74705SXin Li// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse -fmodule-file=%t/base.pcm %s -dependency-file - -MT explicit.pcm -o %t/explicit.pcm -fmodules-cache-path=%t -fmodule-map-file-home-is-cwd | FileCheck %s --check-prefix=EXPLICIT 8*67e74705SXin Li// 9*67e74705SXin Li// RUN: %clang_cc1 -I. -x c++ -fmodules -include Inputs/dependency-gen.h -x c++ /dev/null -fmodule-file=%t/explicit.pcm -MT main.o -fsyntax-only -dependency-file - | FileCheck %s --check-prefix=EXPLICIT-USE 10*67e74705SXin Limodule "test" { 11*67e74705SXin Li export * 12*67e74705SXin Li header "Inputs/dependency-gen.h" 13*67e74705SXin Li use "test-base" 14*67e74705SXin Li use "test-base2" 15*67e74705SXin Li} 16*67e74705SXin Li 17*67e74705SXin Li// For implicit use of a module via the module cache, the input files 18*67e74705SXin Li// referenced by the .pcm are also dependencies of this build. 19*67e74705SXin Li// 20*67e74705SXin Li// IMPLICIT-DAG: {{[/\\]}}dependency-gen.modulemap 21*67e74705SXin Li// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-base.modulemap 22*67e74705SXin Li// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-base2.modulemap 23*67e74705SXin Li// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h 24*67e74705SXin Li// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-included.h 25*67e74705SXin Li// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-included2.h 26*67e74705SXin Li 27*67e74705SXin Li// For an explicit use of a module via -fmodule-file=, the other module maps 28*67e74705SXin Li// and included headers are not dependencies of this target (they are instead 29*67e74705SXin Li// dependencies of the explicitly-specified .pcm input). 30*67e74705SXin Li// 31*67e74705SXin Li// EXPLICIT: {{^}}explicit.pcm: 32*67e74705SXin Li// EXPLICIT-NOT: dependency-gen- 33*67e74705SXin Li// EXPLICIT: {{.*[/\\]}}dependency-gen.modulemap 34*67e74705SXin Li// EXPLICIT-NOT: dependency-gen- 35*67e74705SXin Li// EXPLICIT: base.pcm 36*67e74705SXin Li// EXPLICIT-NOT: dependency-gen- 37*67e74705SXin Li// EXPLICIT: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h 38*67e74705SXin Li// EXPLICIT-NOT: dependency-gen- 39*67e74705SXin Li 40*67e74705SXin Li// EXPLICIT-USE: main.o: 41*67e74705SXin Li// EXPLICIT-USE-NOT: base.pcm 42*67e74705SXin Li// EXPLICIT-USE: explicit.pcm 43*67e74705SXin Li// EXPLICIT-USE-NOT: base.pcm 44