xref: /llvm-project/clang/test/Modules/embed-files.cpp (revision 07915f6cb050500195021d05b70817db08ecdd59)
164daf7b1SRichard Smith // RUN: rm -rf %t
264daf7b1SRichard Smith // RUN: mkdir %t
38a3e39abSRichard Smith // RUN: echo 'module a { header "a.h" header "x.h" } module b { header "b.h" }' > %t/modulemap
464daf7b1SRichard Smith // RUN: echo 'extern int t;' > %t/t.h
564daf7b1SRichard Smith // RUN: echo '#include "t.h"' > %t/a.h
664daf7b1SRichard Smith // RUN: echo '#include "t.h"' > %t/b.h
78a3e39abSRichard Smith // RUN: echo '#include "t.h"' > %t/x.h
864daf7b1SRichard Smith 
964daf7b1SRichard Smith // RUN: %clang_cc1 -fmodules -I%t -fmodules-cache-path=%t -fmodule-map-file=%t/modulemap -fmodules-embed-all-files %s -verify
108a3e39abSRichard Smith //
118a3e39abSRichard Smith // RUN: %clang_cc1 -fmodules -I%t -fmodules-embed-all-files %t/modulemap -fmodule-name=a -x c++ -emit-module -o %t/a.pcm
128a3e39abSRichard Smith // RUN: %clang_cc1 -fmodules -I%t -fmodules-embed-all-files %t/modulemap -fmodule-name=b -x c++ -emit-module -o %t/b.pcm
13*07915f6cSReid Kleckner // FIXME: This test is flaky on Windows because attempting to delete a file
14*07915f6cSReid Kleckner // after writing it just doesn't seem to work well, at least not in the lit
15*07915f6cSReid Kleckner // shell.
16*07915f6cSReid Kleckner // REQUIRES: shell
178a3e39abSRichard Smith // RUN: rm %t/x.h
188a3e39abSRichard Smith // RUN: %clang_cc1 -fmodules -I%t -fmodule-map-file=%t/modulemap -fmodule-file=%t/a.pcm -fmodule-file=%t/b.pcm %s -verify
1964daf7b1SRichard Smith #include "a.h"
2064daf7b1SRichard Smith char t; // expected-error {{different type}}
2164daf7b1SRichard Smith // expected-note@t.h:1 {{here}}
2264daf7b1SRichard Smith #include "t.h"
2364daf7b1SRichard Smith #include "b.h"
2464daf7b1SRichard Smith char t; // expected-error {{different type}}
2564daf7b1SRichard Smith // expected-note@t.h:1 {{here}}
26*07915f6cSReid Kleckner 
27