Debian Codegraph @

clang/test/Modules/relocatable-modules.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 // RUN: cd %t
5
6 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header hu-01.h \
7 // RUN: -fmodule-name=hu-01 -o hu-01.pcm
8
9 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header hu-02.h \
10 // RUN: -Wno-experimental-header-units -fmodule-file=hu-01.pcm -o hu-02-abs.pcm
11
12 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header hu-02.h \
13 // RUN: -Wno-experimental-header-units -fmodule-file=hu-01.pcm -o hu-02-rel.pcm \
14 // RUN: -fmodule-file-home-is-cwd
15
16 // RUN: %clang -module-file-info hu-02-abs.pcm | FileCheck %s --check-prefix=IMPORT-ABS -DPREFIX=%t
17 // IMPORT-ABS: Imports module 'hu-01': [[PREFIX]]{{/|\\}}hu-01.pcm
18
19 // RUN: %clang -module-file-info hu-02-rel.pcm | FileCheck %s --check-prefix=IMPORT-REL
20 // IMPORT-REL: Imports module 'hu-01': hu-01.pcm
21
22 // RUN: llvm-bcanalyzer --dump --disable-histogram %t/hu-02-abs.pcm \
23 // RUN: | FileCheck %s --check-prefix=INPUT-ABS -DPREFIX=%t
24 // INPUT-ABS: <INPUT_FILE {{.*}}/> blob data = '[[PREFIX]]{{/|\\}}hu-02.h'
25
26 // RUN: llvm-bcanalyzer --dump --disable-histogram %t/hu-02-rel.pcm \
27 // RUN: | FileCheck %s --check-prefix=INPUT-REL
28 // INPUT-REL: <INPUT_FILE {{.*}}/> blob data = 'hu-02.h'
29
30 //--- hu-01.h
31 inline void f() {}
32
33 //--- hu-02.h
34 import "hu-01.h";
35
36 inline void g() {
37 f();
38 }
39
40 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a-abs.pcm
41
42 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a-rel.pcm \
43 // RUN: -fmodule-file-home-is-cwd
44
45 // RUN: llvm-bcanalyzer --dump --disable-histogram %t/a-abs.pcm \
46 // RUN: | FileCheck %s --check-prefix=M-INPUT-ABS -DPREFIX=%t
47 // M-INPUT-ABS: <INPUT_FILE {{.*}}/> blob data = '[[PREFIX]]{{/|\\}}a.cppm'
48
49 // RUN: llvm-bcanalyzer --dump --disable-histogram %t/a-rel.pcm \
50 // RUN: | FileCheck %s --check-prefix=M-INPUT-REL
51 // M-INPUT-REL: <INPUT_FILE {{.*}}/> blob data = 'a.cppm'
52
53 //--- a.cppm
54 export module a;