Files
clang-p2996/clang/test/CXX/module/basic/basic.search/module-import.cppm
Chuanqi Xu e22fa1d4c6 [C++20] [Modules] Emit a warning if the we load the modules by implicit generated path
A step to address https://github.com/llvm/llvm-project/issues/62707.

It is not user friendly enough to drop the implicitly generated path
directly. Let's emit the warning first and drop it in the next version.
2023-05-17 17:53:36 +08:00

46 lines
1.3 KiB
C++

// Tests for imported module search.
//
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/x.cppm -o %t/x.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=x=%t/x.pcm %t/y.cppm -o %t/y.pcm
//
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/x.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=x
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=y=%t/y.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=y -fmodule-file=x=%t/x.pcm
//
// RUN: mv %t/x.pcm %t/a.pcm
//
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=x
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=y=%t/y.pcm -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=y
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=y=%t/y.pcm -fmodule-file=x=%t/a.pcm %t/z.cppm -o %t/z.pcm
//
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=z=%t/z.pcm -fmodule-file=y=%t/y.pcm -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=z
//
//--- x.cppm
export module x;
int a, b;
//--- y.cppm
export module y;
import x;
int c;
//--- z.cppm
export module z;
import y;
int d;
//--- use.cpp
import MODULE_NAME;
// expected-no-diagnostics