Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / cxx20-10-1-ex1.cpp
blobb9a5e8023d035f33cbbdf618b4977eee4c90705a
1 // The example in the standard is not in required build order.
2 // revised here
4 // RUN: rm -rf %t
5 // RUN: mkdir -p %t
6 // RUN: split-file %s %t
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex1-tu1.cpp \
9 // RUN: -o %t/A_Internals.pcm
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
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
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
20 // expected-no-diagnostics
22 //--- std10-1-ex1-tu1.cpp
24 module A:Internals;
25 int bar();
27 //--- std10-1-ex1-tu2.cpp
29 export module A:Foo;
31 import :Internals;
33 export int foo() { return 2 * (bar() + 1); }
35 //--- std10-1-ex1-tu3.cpp
37 export module A;
38 export import :Foo;
39 export int baz();
41 //--- std10-1-ex1-tu4.cpp
43 module A;
45 import :Internals;
47 int bar() { return baz() - 10; }
48 int baz() { return 30; }