blob: 3847b71f7b7427c2dad73e7c2221fa3dfd322f8e [file] [log] [blame]
Richard Smithdd4ad3d2016-08-30 19:06:26 +00001// Check compiling a module interface to a .pcm file.
2//
Richard Smith81328ac2017-04-21 22:39:18 +00003// RUN: %clang -fmodules-ts -x c++-module --precompile %s -o %t.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE
Richard Smithdd4ad3d2016-08-30 19:06:26 +00004//
5// CHECK-PRECOMPILE: -cc1 {{.*}} -emit-module-interface
6// CHECK-PRECOMPILE-SAME: -o {{.*}}.pcm
Richard Smith34e485f2017-04-18 21:55:37 +00007// CHECK-PRECOMPILE-SAME: -x c++
Richard Smithdd4ad3d2016-08-30 19:06:26 +00008// CHECK-PRECOMPILE-SAME: modules-ts.cpp
9
10// Check compiling a .pcm file to a .o file.
11//
12// RUN: %clang -fmodules-ts %t.pcm -c -o %t.pcm.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-COMPILE
13//
14// CHECK-COMPILE: -cc1 {{.*}} -emit-obj
15// CHECK-COMPILE-SAME: -o {{.*}}.pcm.o
16// CHECK-COMPILE-SAME: -x pcm
17// CHECK-COMPILE-SAME: {{.*}}.pcm
18
19// Check use of a .pcm file in another compilation.
20//
Richard Smith81328ac2017-04-21 22:39:18 +000021// RUN: %clang -fmodules-ts -fmodule-file=%t.pcm -Dexport= %s -c -o %t.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE
Richard Smithdd4ad3d2016-08-30 19:06:26 +000022//
23// CHECK-USE: -cc1
24// CHECK-USE-SAME: -emit-obj
25// CHECK-USE-SAME: -fmodule-file={{.*}}.pcm
26// CHECK-USE-SAME: -o {{.*}}.o{{"?}} {{.*}}-x c++
27// CHECK-USE-SAME: modules-ts.cpp
28
29// Check combining precompile and compile steps works.
30//
Richard Smith81328ac2017-04-21 22:39:18 +000031// RUN: %clang -fmodules-ts -x c++-module %s -c -o %t.pcm.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE --check-prefix=CHECK-COMPILE
Richard Smithdd4ad3d2016-08-30 19:06:26 +000032
33// Check that .cppm is treated as a module implicitly.
34// RUN: cp %s %t.cppm
Richard Smith81328ac2017-04-21 22:39:18 +000035// RUN: %clang -fmodules-ts --precompile %t.cppm -o %t.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE
Richard Smithdd4ad3d2016-08-30 19:06:26 +000036
Richard Smith81328ac2017-04-21 22:39:18 +000037// Note, we use -Dexport= to make this a module implementation unit when building the implementation.
38export module foo;