3 // First, create two modules a and b, with a dependency b -> a, both within
4 // the same directory p1.
9 // RUN: grep "<AM>" %s > %t/p1/a.modulemap
10 // RUN: %clang_cc1 -x c++ -fmodules -emit-module -fmodule-map-file-home-is-cwd \
11 // RUN: -fmodules-embed-all-files -fmodules-local-submodule-visibility \
12 // RUN: -fmodule-name="a" -o a.pcm a.modulemap
14 // RUN: grep "<BM>" %s > %t/p1/b.modulemap
15 // RUN: %clang_cc1 -x c++ -fmodules -emit-module -fmodule-map-file-home-is-cwd \
16 // RUN: -fmodules-embed-all-files -fmodules-local-submodule-visibility \
17 // RUN: -fmodule-name="b" -o b.pcm b.modulemap
19 // Next, move the whole tree p1 -> p2.
22 // RUN: mv %t/p1 %t/p2
25 // Compile a new module c in the newly generated tree that depends on b; c.pcm
26 // has to be within a subdirectory so a.modulemap will be one step up (../) from
30 // RUN: grep "<CM>" %s > %t/p2/c/c.modulemap
31 // RUN: grep "<CH>" %s > %t/p2/c/c.h
32 // RUN: %clang_cc1 -x c++ -fmodules -emit-module -fmodule-map-file-home-is-cwd \
33 // RUN: -fmodules-embed-all-files -fmodules-local-submodule-visibility \
34 // RUN: -fmodule-name="c" -fmodule-file=b.pcm -o c/c.pcm c/c.modulemap
36 // Delete a.modulemap from its original location, and instead inject a different
37 // (unrelated) a.modulemap in the path p2/p2.
39 // RUN: rm %t/p2/a.modulemap
40 // RUN: mkdir -p %t/p2/p2
41 // RUN: touch %t/p2/p2/a.modulemap
43 // Now compile a file c.cpp that uses c.h and the module c; it is important
44 // to first load b.pcm and a.pcm before c.pcm on the command line to trigger
45 // the right order of module loading. This used to trigger clang to find the
46 // p2/p2/a.modulemap via the path c/../p2/a.modulemap, which is not the correct
47 // relative path from c.
49 // RUN: grep "<CC>" %s > %t/p2/c/c.cpp
50 // RUN: %clang_cc1 -I. -x c++ -fmodules \
51 // RUN: -fmodule-file=b.pcm -fmodule-file=a.pcm -fmodule-file=c/c.pcm \
52 // RUN: -o c/c.o -emit-obj c/c.cpp
62 header "c/c.h" // <CM>
67 inline void c() {} // <CH>
69 #include "c/c.h" // <CC>
70 void foo() { c(); } // <CC>