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 20namespace 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.cppm 67module; 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.cppm 80module; 81#include "foo.h" 82export module A; 83import M; 84 85// CHECK-NOT: <DECL_CXX_RECORD 86// CHECK-NOT: <DECL_UPDATE_OFFSETS 87 88//--- A1.cppm 89module; 90import M; 91#include "foo.h" 92export module A; 93 94// CHECK-NOT: <DECL_CXX_RECORD 95// CHECK-NOT: <DECL_UPDATE_OFFSETS 96 97