xref: /aosp_15_r20/external/clang/test/Modules/embed-files.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: rm -rf %t
2*67e74705SXin Li // RUN: mkdir %t
3*67e74705SXin Li // RUN: echo 'module a { header "a.h" header "x.h" } module b { header "b.h" }' > %t/modulemap
4*67e74705SXin Li // RUN: echo 'extern int t;' > %t/t.h
5*67e74705SXin Li // RUN: echo '#include "t.h"' > %t/a.h
6*67e74705SXin Li // RUN: echo '#include "t.h"' > %t/b.h
7*67e74705SXin Li // RUN: echo '#include "t.h"' > %t/x.h
8*67e74705SXin Li 
9*67e74705SXin Li // RUN: %clang_cc1 -fmodules -I%t -fmodules-cache-path=%t -fmodule-map-file=%t/modulemap -fmodules-embed-all-files %s -verify
10*67e74705SXin Li //
11*67e74705SXin Li // RUN: %clang_cc1 -fmodules -I%t -fmodules-embed-all-files %t/modulemap -fmodule-name=a -x c++ -emit-module -o %t/a.pcm
12*67e74705SXin Li // RUN: %clang_cc1 -fmodules -I%t -fmodules-embed-all-files %t/modulemap -fmodule-name=b -x c++ -emit-module -o %t/b.pcm
13*67e74705SXin Li // RUN: rm %t/x.h
14*67e74705SXin Li // RUN: %clang_cc1 -fmodules -I%t -fmodule-map-file=%t/modulemap -fmodule-file=%t/a.pcm -fmodule-file=%t/b.pcm %s -verify
15*67e74705SXin Li #include "a.h"
16*67e74705SXin Li char t; // expected-error {{different type}}
17*67e74705SXin Li // [email protected]:1 {{here}}
18*67e74705SXin Li #include "t.h"
19*67e74705SXin Li #include "b.h"
20*67e74705SXin Li char t; // expected-error {{different type}}
21*67e74705SXin Li // [email protected]:1 {{here}}
22