Clang Project

clang_source_code/test/Driver/modules-ts.cpp
1// Check compiling a module interface to a .pcm file.
2//
3// RUN: %clang -fmodules-ts -x c++-module --precompile %s -o %t.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE
4//
5// CHECK-PRECOMPILE: -cc1 {{.*}} -emit-module-interface
6// CHECK-PRECOMPILE-SAME: -o {{.*}}.pcm
7// CHECK-PRECOMPILE-SAME: -x c++
8// 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//
21// RUN: %clang -fmodules-ts -fmodule-file=%t.pcm -Dexport= %s -c -o %t.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE
22//
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//
31// 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
32
33// Check that .cppm is treated as a module implicitly.
34// RUN: cp %s %t.cppm
35// RUN: %clang -fmodules-ts --precompile %t.cppm -o %t.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE
36
37// Note, we use -Dexport= to make this a module implementation unit when building the implementation.
38export module foo;
39