| 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 |
export module a; |
| 40 |
|
| 41 |
export extern "C++" { |
| 42 |
#include "a.h" |
| 43 |
} |
| 44 |
|
| 45 |
//--- a.cpp |
| 46 |
import a; |
| 47 |
#include "a.h" |
| 48 |
|
| 49 |
int test() { |
| 50 |
a::A aa; |
| 51 |
a::BI bb(43); |
| 52 |
return get(aa, bb); |
| 53 |
} |
| 54 |
|
| 55 |
// CHECK-NOT: DefinitionData |
| 56 |
// CHECK: FunctionDecl {{.*}} get 'int (A, BI)' {{.*}} |
| 57 |
// CHECK-NOT: CompoundStmt |
| 58 |
// CHECK: FunctionDecl {{.*}} test {{.*}} |