97 lines · plain
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 %t5// RUN: mkdir -p %t6// RUN: split-file %s %t7//8// RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-reduced-module-interface -o %t/M.pcm9// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm \10// RUN: -fmodule-file=M=%t/M.pcm11// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/A.pcm > %t/A.dump12// RUN: cat %t/A.dump | FileCheck %t/A.cppm13//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.pcm16// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/A1.pcm > %t/A1.dump17// RUN: cat %t/A1.dump | FileCheck %t/A1.cppm18 19//--- foo.h20namespace ns {21template <class C>22class A {23 24};25 26extern template class A<short>;27 28inline A<int> a() { return A<int>(); }29template <class T>30A<T> _av_ = A<T>();31 32auto _av_1 = _av_<int>;33auto _av_2 = _av_<double>;34 35template <>36class A<void> {37 38};39 40void func(A<int>, ...) {41 42}43 44}45 46struct 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.cppm67module;68#include "foo.h"69export module M;70export namespace nv {71 using ns::A;72 using ns::a;73 using ns::_av_;74 75 using ns::func;76}77using ::S;78 79//--- A.cppm80module;81#include "foo.h"82export module A;83import M;84 85// CHECK-NOT: <DECL_CXX_RECORD86// CHECK-NOT: <DECL_UPDATE_OFFSETS87 88//--- A1.cppm89module;90import M;91#include "foo.h"92export module A;93 94// CHECK-NOT: <DECL_CXX_RECORD95// CHECK-NOT: <DECL_UPDATE_OFFSETS96 97