llvm-project/clang/test/Modules/emit-module-interface-pcm-input.cpp
Naveen Seth Hanig 7ce0f5a9cc
[clang][modules] Validate input file format for GenerateModuleInterfaceAction (#132692) (#137711)
Fixes #132692.

`clang -cc1` crashes when generating a module interface with
`emit-module-interface` or `emit-reduced-module-interface` using an
input file which is already a precompiled module (`.pcm`) file.
This commit adds validation for the input file format and Clang will now
emit an error message instead of crashing.
2025-04-29 11:22:34 +08:00

14 lines
449 B
C++

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: cd %t
// Related to issue #132692
// Verify that clang_cc1 doesn't crash when trying to generate a module
// interface from an alreay precompiled module (`.pcm`).
// RUN: %clang_cc1 -std=c++20 -emit-module-interface a.cppm -o a.pcm
// RUN: not %clang_cc1 -std=c++20 -emit-module-interface a.pcm
// RUN: not %clang_cc1 -std=c++20 -emit-reduced-module-interface a.pcm
//--- a.cppm
export module A;