Debian Codegraph @

clang/test/Modules/skip-body.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 -emit-reduced-module-interface -o %t/a.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/a.cpp -fmodule-file=a=%t/a.pcm -ast-dump | FileCheck %s
7
8 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
9 // RUN: %clang_cc1 -std=c++20 %t/a.cpp -fmodule-file=a=%t/a.pcm -ast-dump | FileCheck %s
10
11 //--- a.h
12 namespace a {
13 class A {
14 public:
15 int aaaa;
16
17 int get() {
18 return aaaa;
19 }
20 };
21
22
23 template <class T>
24 class B {
25 public:
26 B(T t): t(t) {}
27 T t;
28 };
29
30 using BI = B<int>;
31
32 inline int get(A a, BI b) {
33 return a.get() + b.t;
34 }
35
36 }
37
38 //--- a.cppm
39 module;
40 #include "a.h"
41
42 export module a;
43
44 namespace a {
45 export using ::a::A;
46 export using ::a::get;
47 export using ::a::BI;
48 }
49
50 //--- a.cpp
51 import a;
52 #include "a.h"
53
54 int test() {
55 a::A aa;
56 a::BI bb(43);
57 return get(aa, bb);
58 }
59
60 // CHECK-NOT: DefinitionData
61 // CHECK: FunctionDecl {{.*}} get 'int (A, BI)' {{.*}}
62 // CHECK-NOT: CompoundStmt
63 // CHECK: FunctionDecl {{.*}} test {{.*}}