1// Tests for imported module search. 2// 3// RUN: rm -rf %t 4// RUN: mkdir %t 5// RUN: split-file %s %t 6// 7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/x.cppm -o %t/x.pcm 8// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=x=%t/x.pcm %t/y.cppm -o %t/y.pcm 9// 10// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/x.pcm -verify %t/use.cpp \ 11// RUN: -DMODULE_NAME=x 12// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=y=%t/y.pcm -verify %t/use.cpp \ 13// RUN: -DMODULE_NAME=y -fmodule-file=x=%t/x.pcm 14// 15// RUN: mv %t/x.pcm %t/a.pcm 16// 17// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \ 18// RUN: -DMODULE_NAME=x 19// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=y=%t/y.pcm -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \ 20// RUN: -DMODULE_NAME=y 21// 22// 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 23// 24// 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 \ 25// RUN: -DMODULE_NAME=z 26// 27 28//--- x.cppm 29export module x; 30int a, b; 31 32//--- y.cppm 33export module y; 34import x; 35int c; 36 37//--- z.cppm 38export module z; 39import y; 40int d; 41 42//--- use.cpp 43import MODULE_NAME; 44 45// expected-no-diagnostics 46