llvm-capstone/clang/test/Modules/duplicated-module-file-eq-module-name.cppm
Chuanqi Xu e9a7876c2c [C++20] [Modules] Chose BMI from for module m with the last
-fmodule-file=<module-name>= option

Currently if we have multiple `-fmodule-file=<module-name>=<BMI-path>`
flags for the same `<module-name>`, we will pick the BMI-path from the
first flag. And this is inconsistent with what users generally expect.
e.g, we might expect the latter flags can override the former ones.

This patch changes the behavior to match user's expectation.
2023-10-27 16:52:21 +08:00

22 lines
493 B
C++

// Tests that we will pick the last `-fmodule-file=<module-name>=<path>` flag
// for <module-name>.
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: cd %t
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/u.cpp -fmodule-file=a=%t/unexist.pcm \
// RUN: -fmodule-file=a=%t/a.pcm -verify -fsyntax-only
//--- a.cppm
export module a;
export int a();
//--- u.cpp
// expected-no-diagnostics
import a;
int u() {
return a();
}