1// RUN: cd %S
2// RUN: rm -rf %t
3//
4// 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//
6// 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// 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
8module "test" {
9  export *
10  header "Inputs/dependency-gen.h"
11  use "test-base"
12  use "test-base2"
13}
14
15// For implicit use of a module via the module cache, the input files
16// referenced by the .pcm are also dependencies of this build.
17//
18// IMPLICIT-DAG: {{[/\\]}}dependency-gen.modulemap
19// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-base.modulemap
20// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-base2.modulemap
21// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h
22// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-included.h
23// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-included2.h
24
25// For an explicit use of a module via -fmodule-file=, the other module maps
26// and included headers are not dependencies of this target (they are instead
27// dependencies of the explicitly-specified .pcm input).
28//
29// EXPLICIT: {{^}}explicit.pcm:
30// EXPLICIT-NOT: dependency-gen-
31// EXPLICIT: {{.*[/\\]}}dependency-gen.modulemap
32// EXPLICIT-NOT: dependency-gen-
33// EXPLICIT: base.pcm
34// EXPLICIT-NOT: dependency-gen-
35// EXPLICIT: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h
36// EXPLICIT-NOT: dependency-gen-
37