blob: 7d9d3eec26cca7a3520a6bfbd0403c0d801290a2 [file] [log] [blame]
Chuanqi Xuaba32ab2023-04-27 14:19:32 +08001// 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 Xu99de0652024-11-27 11:35:49 +08006// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
Chuanqi Xuaba32ab2023-04-27 14:19:32 +08007// RUN: 2>&1 | FileCheck %t/use.cpp
Chuanqi Xu99de0652024-11-27 11:35:49 +08008// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
Chuanqi Xuaba32ab2023-04-27 14:19:32 +08009// 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 Xuda00c602024-03-08 10:12:51 +080015// 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 Xu99de0652024-11-27 11:35:49 +080021// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
Chuanqi Xuda00c602024-03-08 10:12:51 +080022// RUN: 2>&1 | FileCheck %t/use.cpp
Chuanqi Xu99de0652024-11-27 11:35:49 +080023// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
Chuanqi Xuda00c602024-03-08 10:12:51 +080024// 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 Xuaba32ab2023-04-27 14:19:32 +080031//--- Hello.cppm
32export module hello;
33export void hello() {
34
35}
36
37//--- use.cpp
38// expected-no-diagnostics
39import hello;
40int use() {
41 for(int i=0;i<10;i++)
42 hello();
43 return 0;
44}
45
Volodymyr Sapsaifdf8e3e2024-08-08 11:23:47 -030046// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file
Chuanqi Xuaba32ab2023-04-27 14:19:32 +080047
48//--- use2.cpp
49// expected-no-diagnostics
50import hello;
51int use2() {
52#pragma omp parallel for
53 for(int i=0;i<10;i++)
54 hello();
55 return 0;
56}
57
Volodymyr Sapsaifdf8e3e2024-08-08 11:23:47 -030058// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file
Chuanqi Xu99de0652024-11-27 11:35:49 +080059// CHECK: use of undeclared identifier 'pragma'