-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++20] [Modules] Avoid crash if the inconsistency the size of lang o…
…ptions exceeds 1 Close #62359 The root reason for the crash is that we didn't test the case that the bits number of a language option exceeds 1.
- Loading branch information
1 parent
f88f8fd
commit aba32ab
Showing
3 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t | ||
// RUN: split-file %s %t | ||
// | ||
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Hello.cppm -o %t/Hello.pcm | ||
// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \ | ||
// RUN: 2>&1 | FileCheck %t/use.cpp | ||
// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \ | ||
// RUN: 2>&1 | FileCheck %t/use2.cpp | ||
// | ||
// RUN: %clang_cc1 -std=c++20 -fopenmp -emit-module-interface %t/Hello.cppm -o %t/Hello.pcm | ||
// RUN: %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only -verify | ||
// RUN: %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only -verify | ||
|
||
//--- Hello.cppm | ||
export module hello; | ||
export void hello() { | ||
|
||
} | ||
|
||
//--- use.cpp | ||
// expected-no-diagnostics | ||
import hello; | ||
int use() { | ||
for(int i=0;i<10;i++) | ||
hello(); | ||
return 0; | ||
} | ||
|
||
// CHECK: OpenMP{{.*}}differs in PCH file vs. current file | ||
|
||
//--- use2.cpp | ||
// expected-no-diagnostics | ||
import hello; | ||
int use2() { | ||
#pragma omp parallel for | ||
for(int i=0;i<10;i++) | ||
hello(); | ||
return 0; | ||
} | ||
|
||
// CHECK: OpenMP{{.*}}differs in PCH file vs. current file | ||
// CHECK: use of undeclared identifier 'pragma' |