brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 72f5f14 Raw
71 lines · plain
1// RUN: rm -rf %t2//3// First, create two modules a and b, with a dependency b -> a, both within4// the same directory p1.5//6// RUN: mkdir -p %t/p17// RUN: cd %t/p18//9// RUN: grep "<AM>" %s > %t/p1/a.modulemap10// 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.modulemap13//14// RUN: grep "<BM>" %s > %t/p1/b.modulemap15// 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.modulemap18//19// Next, move the whole tree p1 -> p2.20//21// RUN: cd %t22// RUN: mv %t/p1 %t/p223// RUN: cd %t/p224//25// Compile a new module c in the newly generated tree that depends on b; c.pcm26// has to be within a subdirectory so a.modulemap will be one step up (../) from27// c.pcm.28//29// RUN: mkdir %t/p2/c30// RUN: grep "<CM>" %s > %t/p2/c/c.modulemap31// RUN: grep "<CH>" %s > %t/p2/c/c.h32// 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.modulemap35//36// Delete a.modulemap from its original location, and instead inject a different37// (unrelated) a.modulemap in the path p2/p2.38//39// RUN: rm %t/p2/a.modulemap40// RUN: mkdir -p %t/p2/p241// RUN: touch %t/p2/p2/a.modulemap42//43// Now compile a file c.cpp that uses c.h and the module c; it is important44// to first load b.pcm and a.pcm before c.pcm on the command line to trigger45// the right order of module loading. This used to trigger clang to find the46// p2/p2/a.modulemap via the path c/../p2/a.modulemap, which is not the correct47// relative path from c.48//49// RUN: grep "<CC>" %s > %t/p2/c/c.cpp50// 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.cpp53 54module "a" {                // <AM>55}                           // <AM>56 57module "b" {                // <BM>58  use "a"                   // <BM>59}                           // <BM>60 61module "c" {                // <CM>62  header "c/c.h"            // <CM>63  use "a"                   // <CM>64  use "b"                   // <CM>65}                           // <CM>66 67inline void c() {}          // <CH>68 69#include "c/c.h"            // <CC>70void foo() { c(); }         // <CC>71