xref: /llvm-project/clang/test/Modules/duplicated-module-file-eq-module-name.cppm (revision da00c60dae0040185dc45039c4397f6e746548e9)
1// Tests that we will pick the last `-fmodule-file=<module-name>=<path>` flag
2// for <module-name>.
3
4// RUN: rm -rf %t
5// RUN: split-file %s %t
6// RUN: cd %t
7//
8// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
9// RUN: %clang_cc1 -std=c++20 %t/u.cpp -fmodule-file=a=%t/unexist.pcm \
10// RUN:      -fmodule-file=a=%t/a.pcm -verify -fsyntax-only
11//
12// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm
13// RUN: %clang_cc1 -std=c++20 %t/u.cpp -fmodule-file=a=%t/unexist.pcm \
14// RUN:      -fmodule-file=a=%t/a.pcm -verify -fsyntax-only
15
16//--- a.cppm
17export module a;
18export int a();
19
20//--- u.cpp
21// expected-no-diagnostics
22import a;
23int u() {
24    return a();
25}
26