1 // RUN: rm -rf %t 2 // RUN: mkdir %t 3 4 // Check compiling a module interface to a .pcm file. 5 // 6 // RUN: %clang -std=c++2a -x c++-module --precompile %s -o %t/module.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE 7 // RUN: %clang -std=gnu++2a -x c++-module --precompile %s -o %t/module-gnu.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE 8 // 9 // CHECK-PRECOMPILE: -cc1 {{.*}} -emit-module-interface 10 // CHECK-PRECOMPILE-SAME: -o {{.*}}.pcm 11 // CHECK-PRECOMPILE-SAME: -x c++ 12 // CHECK-PRECOMPILE-SAME: modules.cpp 13 14 // Check compiling a .pcm file to a .o file. 15 // 16 // RUN: %clang -std=c++2a %t/module.pcm -S -o %t/module.pcm.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-COMPILE 17 // 18 // CHECK-COMPILE: -cc1 {{.*}} {{-emit-obj|-S}} 19 // CHECK-COMPILE-SAME: -o {{.*}}module{{2*}}.pcm.o 20 // CHECK-COMPILE-SAME: -x pcm 21 // CHECK-COMPILE-SAME: {{.*}}.pcm 22 23 // Check use of a .pcm file in another compilation. 24 // 25 // RUN: %clang -std=c++2a -fmodule-file=%t/module.pcm -Dexport= %s -S -o %t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE 26 // RUN: %clang -std=c++20 -fmodule-file=%t/module.pcm -Dexport= %s -S -o %t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE 27 // RUN: %clang -std=gnu++20 -fmodule-file=%t/module-gnu.pcm -Dexport= %s -S -o %t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE 28 // 29 // CHECK-USE: -cc1 {{.*}} {{-emit-obj|-S}} 30 // CHECK-USE-SAME: -fmodule-file={{.*}}.pcm 31 // CHECK-USE-SAME: -o {{.*}}.{{o|s}}{{"?}} {{.*}}-x c++ 32 // CHECK-USE-SAME: modules.cpp 33 34 // Check combining precompile and compile steps works. 35 // 36 // RUN: %clang -std=c++2a -x c++-module %s -S -o %t/module2.pcm.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE --check-prefix=CHECK-COMPILE 37 38 // Check that .cppm is treated as a module implicitly. 39 // 40 // RUN: cp %s %t/module.cppm 41 // RUN: %clang -std=c++2a --precompile %t/module.cppm -o %t/module.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE 42 43 export module foo; 44