llvm/clang/test/Modules/dependency-gen.modulemap

// RUN: cd %S
// RUN: rm -rf %t
//
// 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
//
// 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
// 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
//
// 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
module "test" {
  export *
  header "Inputs/dependency-gen.h"
  use "test-base"
  use "test-base2"
}

// For implicit use of a module via the module cache, the input files
// referenced by the .pcm are also dependencies of this build.
//
// IMPLICIT-DAG: {{[/\\]}}dependency-gen.modulemap
// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-base.modulemap
// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-base2.modulemap
// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h
// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-included.h
// IMPLICIT-DAG: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen-included2.h

// For an explicit use of a module via -fmodule-file=, the other module maps
// and included headers are not dependencies of this target (they are instead
// dependencies of the explicitly-specified .pcm input).
//
// EXPLICIT: {{^}}explicit.pcm:
// EXPLICIT-NOT: dependency-gen-
// EXPLICIT: {{.*[/\\]}}dependency-gen.modulemap
// EXPLICIT-NOT: dependency-gen-
// EXPLICIT: base.pcm
// EXPLICIT-NOT: dependency-gen-
// EXPLICIT: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h
// EXPLICIT-NOT: dependency-gen-

// EXPLICIT-USE: main.o:
// EXPLICIT-USE-NOT: base.pcm
// EXPLICIT-USE: explicit.pcm
// EXPLICIT-USE-NOT: base.pcm