mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-14 01:46:41 +00:00

Close https://github.com/llvm/llvm-project/issues/57293. Previsouly we can't use `-fmodule-file=<module-name>=<BMI-Path>` for implementation units, it is a bug. Also the behavior of the above option is not tested nor documented for C++20 Modules. This patch addresses the 2 problems.
38 lines
866 B
C++
38 lines
866 B
C++
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
// RUN: split-file %s %t
|
|
//
|
|
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
|
|
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
|
|
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
|
|
//
|
|
// RUN: %clang_cc1 -std=c++20 %t/M-Part.cppm -emit-module-interface -o %t/M-Part.pcm
|
|
// RUN: %clang_cc1 -std=c++20 %t/M.cppm -fmodule-file=M:Part=%t/M-Part.pcm -fsyntax-only -verify
|
|
|
|
//--- a.cppm
|
|
export module a;
|
|
export int foo() { return 43; }
|
|
|
|
//--- b.cppm
|
|
// expected-no-diagnostics
|
|
export module b;
|
|
import a;
|
|
export int b() {
|
|
return foo();
|
|
}
|
|
|
|
//--- use.cpp
|
|
// expected-no-diagnostics
|
|
import a;
|
|
int Use() {
|
|
return foo();
|
|
}
|
|
|
|
//--- M-Part.cppm
|
|
export module M:Part;
|
|
|
|
//--- M.cppm
|
|
// expected-no-diagnostics
|
|
export module M;
|
|
import :Part;
|