llvm-capstone/clang/test/Modules/cxx20-named-conditionally-load.cppm
Chuanqi Xu 1782e8f9e8 [C++20] [Modules] Allow -fmodule-file=<module-name>=<BMI-Path> for implementation unit and document the behavior
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.
2023-02-08 16:45:00 +08:00

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;