blob: e1db618c3622c8c1122363e511c7c34d25ac8902 [file] [log] [blame]
Richard Smith223d3f22014-12-06 03:21:08 +00001// RUN: cd %S
2// RUN: rm -rf %t
3// RUN: mkdir %t
Richard Smith9acb99e32014-12-10 03:09:48 +00004//
Richard Smith1f2bd352017-07-06 21:05:56 +00005// RUN: %clang_cc1 -fmodules -fno-implicit-modules -fmodule-name=relative-dep-gen -emit-module -x c++ Inputs/relative-dep-gen.modulemap -dependency-file %t/build.d -MT mod.pcm -o %t/mod.pcm
6// RUN: %clang_cc1 -fmodules -fno-implicit-modules -fmodule-map-file=Inputs/relative-dep-gen.modulemap -fmodule-file=%t/mod.pcm -dependency-file %t/use-explicit.d -MT use.o relative-dep-gen.cpp -fsyntax-only
7// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=Inputs/relative-dep-gen.modulemap -dependency-file %t/use-implicit.d relative-dep-gen.cpp -MT use.o -fsyntax-only
Richard Smith223d3f22014-12-06 03:21:08 +00008//
9// RUN: FileCheck --check-prefix=CHECK-BUILD %s < %t/build.d
Richard Smith1f2bd352017-07-06 21:05:56 +000010// RUN: FileCheck --check-prefix=CHECK-USE --check-prefix=CHECK-EXPLICIT %s < %t/use-explicit.d
11// RUN: FileCheck --check-prefix=CHECK-USE --check-prefix=CHECK-IMPLICIT %s < %t/use-implicit.d
Richard Smith9acb99e32014-12-10 03:09:48 +000012//
Richard Smith1f2bd352017-07-06 21:05:56 +000013// RUN: %clang_cc1 -fmodules -fno-implicit-modules -fmodule-name=relative-dep-gen -emit-module -x c++ Inputs/relative-dep-gen-cwd.modulemap -dependency-file %t/build-cwd.d -MT mod.pcm -o %t/mod-cwd.pcm -fmodule-map-file-home-is-cwd
14// RUN: %clang_cc1 -fmodules -fno-implicit-modules -fmodule-map-file=Inputs/relative-dep-gen-cwd.modulemap -fmodule-file=%t/mod-cwd.pcm -dependency-file %t/use-explicit-cwd.d -MT use.o relative-dep-gen.cpp -fsyntax-only -fmodule-map-file-home-is-cwd
15// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=Inputs/relative-dep-gen-cwd.modulemap -dependency-file %t/use-implicit-cwd.d relative-dep-gen.cpp -MT use.o -fsyntax-only -fmodule-map-file-home-is-cwd
Richard Smith9acb99e32014-12-10 03:09:48 +000016//
17// RUN: FileCheck --check-prefix=CHECK-BUILD %s < %t/build-cwd.d
18// RUN: FileCheck --check-prefix=CHECK-USE %s < %t/use-explicit-cwd.d
19// RUN: FileCheck --check-prefix=CHECK-USE %s < %t/use-implicit-cwd.d
Richard Smithf7b41372015-08-13 23:47:44 +000020//
21// Check that the .d file is still correct after relocating the module.
22// RUN: mkdir %t/Inputs
23// RUN: cp %S/Inputs/relative-dep-gen-1.h %t/Inputs
24// RUN: cp %s %t
25// RUN: cd %t
Richard Smith1f2bd352017-07-06 21:05:56 +000026// RUN: %clang_cc1 -fmodules -fno-implicit-modules -fmodule-file=%t/mod-cwd.pcm -dependency-file %t/use-explicit-no-map-cwd.d -MT use.o relative-dep-gen.cpp -fsyntax-only -fmodule-map-file-home-is-cwd
Richard Smithf7b41372015-08-13 23:47:44 +000027// RUN: cat %t/use-explicit-no-map-cwd.d
28// RUN: FileCheck --check-prefix=CHECK-USE %s < %t/use-explicit-no-map-cwd.d
Richard Smith223d3f22014-12-06 03:21:08 +000029
30#include "Inputs/relative-dep-gen-1.h"
31
Richard Smith2a6edb32015-08-09 04:46:57 +000032// CHECK-BUILD: mod.pcm:
David Bolvanskyc96cb252018-09-13 14:27:32 +000033// CHECK-BUILD: {{[ \t]}}Inputs{{[/\\]}}relative-dep-gen{{(-cwd)?}}.modulemap
34// CHECK-BUILD: {{[ \t]}}Inputs{{[/\\]}}relative-dep-gen-1.h
35// CHECK-BUILD: {{[ \t]}}Inputs{{[/\\]}}relative-dep-gen-2.h
Richard Smith2a6edb32015-08-09 04:46:57 +000036// CHECK-USE: use.o:
Richard Smithf7b41372015-08-13 23:47:44 +000037// CHECK-USE-DAG: {{[ \t]}}relative-dep-gen.cpp
Richard Smith1f2bd352017-07-06 21:05:56 +000038// CHECK-EXPLICIT-DAG: mod.pcm
39// CHECK-IMPLICIT-DAG: {{[ \t]}}Inputs{{[/\\]}}relative-dep-gen-1.h