Debian Codegraph @

clang/test/Modules/template-declare.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -dwarf-version=4 -debug-info-kind=constructor \
6 // RUN: -emit-module-interface -o %t/a.pcm
7 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -dwarf-version=4 -debug-info-kind=constructor \
8 // RUN: -emit-module-interface -o %t/b.pcm -fmodule-file=a=%t/a.pcm
9 // RUN: %clang_cc1 -std=c++20 %t/b.cpp -dwarf-version=4 -debug-info-kind=constructor \
10 // RUN: -emit-llvm -o - -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm | FileCheck %t/b.cpp
11
12 //--- a.cppm
13 export module a;
14 export template <class T>
15 class a {
16 private:
17 T *data;
18
19 public:
20 virtual T* getData();
21 };
22
23 extern template class a<char>;
24
25 //--- b.cppm
26 export module b;
27 import a;
28 export struct b {
29 a<char> v;
30 };
31
32 //--- b.cpp
33 module b;
34 extern "C" void func() {
35 b();
36 }
37
38 // It is fine enough to check that we won't crash.
39 // CHECK: define {{.*}}void @func()