| 1 |
// Test that we won't write additional information into the Reduced BMI if the |
| 2 |
// module purview is empty. |
| 3 |
// |
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: mkdir -p %t |
| 6 |
// RUN: split-file %s %t |
| 7 |
// |
| 8 |
// RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-reduced-module-interface -o %t/M.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm \ |
| 10 |
// RUN: -fmodule-file=M=%t/M.pcm |
| 11 |
// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/A.pcm > %t/A.dump |
| 12 |
// RUN: cat %t/A.dump | FileCheck %t/A.cppm |
| 13 |
// |
| 14 |
// RUN: %clang_cc1 -std=c++20 %t/A1.cppm -emit-reduced-module-interface -o %t/A1.pcm \ |
| 15 |
// RUN: -fmodule-file=M=%t/M.pcm |
| 16 |
// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/A1.pcm > %t/A1.dump |
| 17 |
// RUN: cat %t/A1.dump | FileCheck %t/A1.cppm |
| 18 |
|
| 19 |
//--- foo.h |
| 20 |
namespace ns { |
| 21 |
template <class C> |
| 22 |
class A { |
| 23 |
|
| 24 |
}; |
| 25 |
|
| 26 |
extern template class A<short>; |
| 27 |
|
| 28 |
inline A<int> a() { return A<int>(); } |
| 29 |
template <class T> |
| 30 |
A<T> _av_ = A<T>(); |
| 31 |
|
| 32 |
auto _av_1 = _av_<int>; |
| 33 |
auto _av_2 = _av_<double>; |
| 34 |
|
| 35 |
template <> |
| 36 |
class A<void> { |
| 37 |
|
| 38 |
}; |
| 39 |
|
| 40 |
void func(A<int>, ...) { |
| 41 |
|
| 42 |
} |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
struct S { |
| 47 |
union { |
| 48 |
unsigned int V; |
| 49 |
struct { |
| 50 |
int v1; |
| 51 |
int v2; |
| 52 |
ns::A<int> a1; |
| 53 |
} WESQ; |
| 54 |
}; |
| 55 |
|
| 56 |
union { |
| 57 |
double d; |
| 58 |
struct { |
| 59 |
int v1; |
| 60 |
unsigned v2; |
| 61 |
ns::A<unsigned> a1; |
| 62 |
} Another; |
| 63 |
}; |
| 64 |
}; |
| 65 |
|
| 66 |
//--- M.cppm |
| 67 |
module; |
| 68 |
#include "foo.h" |
| 69 |
export module M; |
| 70 |
export namespace nv { |
| 71 |
using ns::A; |
| 72 |
using ns::a; |
| 73 |
using ns::_av_; |
| 74 |
|
| 75 |
using ns::func; |
| 76 |
} |
| 77 |
using ::S; |
| 78 |
|
| 79 |
//--- A.cppm |
| 80 |
module; |
| 81 |
#include "foo.h" |
| 82 |
export module A; |
| 83 |
import M; |
| 84 |
|
| 85 |
// CHECK-NOT: <DECL_CXX_RECORD |
| 86 |
// CHECK-NOT: <DECL_UPDATE_OFFSETS |
| 87 |
|
| 88 |
//--- A1.cppm |
| 89 |
module; |
| 90 |
import M; |
| 91 |
#include "foo.h" |
| 92 |
export module A; |
| 93 |
|
| 94 |
// CHECK-NOT: <DECL_CXX_RECORD |
| 95 |
// CHECK-NOT: <DECL_UPDATE_OFFSETS |
| 96 |
|