Chuanqi Xu | aba32ab | 2023-04-27 14:19:32 +0800 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: mkdir -p %t |
| 3 | // RUN: split-file %s %t |
| 4 | // |
| 5 | // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Hello.cppm -o %t/Hello.pcm |
Chuanqi Xu | 99de065 | 2024-11-27 11:35:49 +0800 | [diff] [blame] | 6 | // RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \ |
Chuanqi Xu | aba32ab | 2023-04-27 14:19:32 +0800 | [diff] [blame] | 7 | // RUN: 2>&1 | FileCheck %t/use.cpp |
Chuanqi Xu | 99de065 | 2024-11-27 11:35:49 +0800 | [diff] [blame] | 8 | // RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \ |
Chuanqi Xu | aba32ab | 2023-04-27 14:19:32 +0800 | [diff] [blame] | 9 | // RUN: 2>&1 | FileCheck %t/use2.cpp |
| 10 | // |
| 11 | // RUN: %clang_cc1 -std=c++20 -fopenmp -emit-module-interface %t/Hello.cppm -o %t/Hello.pcm |
| 12 | // RUN: %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only -verify |
| 13 | // RUN: %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only -verify |
| 14 | |
Chuanqi Xu | da00c60 | 2024-03-08 10:12:51 +0800 | [diff] [blame] | 15 | // Test again with reduced BMI |
| 16 | // RUN: rm -rf %t |
| 17 | // RUN: mkdir -p %t |
| 18 | // RUN: split-file %s %t |
| 19 | // |
| 20 | // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/Hello.cppm -o %t/Hello.pcm |
Chuanqi Xu | 99de065 | 2024-11-27 11:35:49 +0800 | [diff] [blame] | 21 | // RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \ |
Chuanqi Xu | da00c60 | 2024-03-08 10:12:51 +0800 | [diff] [blame] | 22 | // RUN: 2>&1 | FileCheck %t/use.cpp |
Chuanqi Xu | 99de065 | 2024-11-27 11:35:49 +0800 | [diff] [blame] | 23 | // RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \ |
Chuanqi Xu | da00c60 | 2024-03-08 10:12:51 +0800 | [diff] [blame] | 24 | // RUN: 2>&1 | FileCheck %t/use2.cpp |
| 25 | // |
| 26 | // RUN: %clang_cc1 -std=c++20 -fopenmp -emit-reduced-module-interface %t/Hello.cppm -o %t/Hello.pcm |
| 27 | // RUN: %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only -verify |
| 28 | // RUN: %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only -verify |
| 29 | |
| 30 | |
Chuanqi Xu | aba32ab | 2023-04-27 14:19:32 +0800 | [diff] [blame] | 31 | //--- Hello.cppm |
| 32 | export module hello; |
| 33 | export void hello() { |
| 34 | |
| 35 | } |
| 36 | |
| 37 | //--- use.cpp |
| 38 | // expected-no-diagnostics |
| 39 | import hello; |
| 40 | int use() { |
| 41 | for(int i=0;i<10;i++) |
| 42 | hello(); |
| 43 | return 0; |
| 44 | } |
| 45 | |
Volodymyr Sapsai | fdf8e3e | 2024-08-08 11:23:47 -0300 | [diff] [blame] | 46 | // CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file |
Chuanqi Xu | aba32ab | 2023-04-27 14:19:32 +0800 | [diff] [blame] | 47 | |
| 48 | //--- use2.cpp |
| 49 | // expected-no-diagnostics |
| 50 | import hello; |
| 51 | int use2() { |
| 52 | #pragma omp parallel for |
| 53 | for(int i=0;i<10;i++) |
| 54 | hello(); |
| 55 | return 0; |
| 56 | } |
| 57 | |
Volodymyr Sapsai | fdf8e3e | 2024-08-08 11:23:47 -0300 | [diff] [blame] | 58 | // CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file |
Chuanqi Xu | 99de065 | 2024-11-27 11:35:49 +0800 | [diff] [blame] | 59 | // CHECK: use of undeclared identifier 'pragma' |