236
|
1 // The example in the standard is not in required build order.
|
|
2 // revised here
|
|
3
|
|
4 // RUN: rm -rf %t
|
|
5 // RUN: mkdir -p %t
|
|
6 // RUN: split-file %s %t
|
|
7
|
|
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex1-tu1.cpp \
|
|
9 // RUN: -o %t/A_Internals.pcm
|
|
10
|
|
11 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex1-tu2.cpp \
|
|
12 // RUN: -fmodule-file=%t/A_Internals.pcm -o %t/A_Foo.pcm
|
|
13
|
|
14 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex1-tu3.cpp \
|
|
15 // RUN: -fmodule-file=%t/A_Foo.pcm -o %t/A.pcm
|
|
16
|
|
17 // RUN: %clang_cc1 -std=c++20 -emit-obj %t/std10-1-ex1-tu4.cpp \
|
|
18 // RUN: -fmodule-file=%t/A.pcm -o %t/ex1.o
|
|
19
|
|
20 // expected-no-diagnostics
|
|
21
|
|
22 //--- std10-1-ex1-tu1.cpp
|
|
23
|
|
24 module A:Internals;
|
|
25 int bar();
|
|
26
|
|
27 //--- std10-1-ex1-tu2.cpp
|
|
28
|
|
29 export module A:Foo;
|
|
30
|
|
31 import :Internals;
|
|
32
|
|
33 export int foo() { return 2 * (bar() + 1); }
|
|
34
|
|
35 //--- std10-1-ex1-tu3.cpp
|
|
36
|
|
37 export module A;
|
|
38 export import :Foo;
|
|
39 export int baz();
|
|
40
|
|
41 //--- std10-1-ex1-tu4.cpp
|
|
42
|
|
43 module A;
|
|
44
|
|
45 import :Internals;
|
|
46
|
|
47 int bar() { return baz() - 10; }
|
|
48 int baz() { return 30; }
|