Debian Codegraph @

clang/test/Interpreter/cxx20-modules.cppm

raw
1 // REQUIRES: host-supports-jit, x86_64-linux
2 //
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t
5 // RUN: split-file %s %t
6 //
7 // RUN: %clang -std=c++20 %t/mod.cppm --precompile \
8 // RUN: -o %t/mod.pcm --target=x86_64-linux-gnu
9 // RUN: %clang -fPIC %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
10 // RUN: %clang -nostdlib -fPIC -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
11 //
12 // RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH \
13 // RUN: clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=%t/mod.pcm \
14 // RUN: -Xcc=--target=x86_64-linux-gnu | FileCheck %t/import.cpp
15
16 //--- mod.cppm
17 export module M;
18 export const char* Hello() {
19 return "Hello Interpreter for Modules!";
20 }
21
22 //--- import.cpp
23
24 %lib libmod.so
25
26 import M;
27
28 extern "C" int printf(const char *, ...);
29 printf("%s\n", Hello());
30
31 // CHECK: Hello Interpreter for Modules!