57 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/Type.cppm -emit-module-interface -o \6// RUN: %t/MyVec-Type.pcm -triple=x86_64-linux-gnu 7// RUN:%clang_cc1 -std=c++20 %t/Vec.cppm -emit-module-interface -o \8// RUN: %t/MyVec-Vec.pcm -fmodule-file=MyVec:Type=%t/MyVec-Type.pcm \9// RUN: -triple=x86_64-linux-gnu 10// RUN: %clang_cc1 -std=c++20 %t/Vec2.cppm -emit-module-interface -o \11// RUN: %t/MyVec-Vec2.pcm -fmodule-file=MyVec:Type=%t/MyVec-Type.pcm \12// RUN: -triple=x86_64-linux-gnu 13// RUN: %clang_cc1 -std=c++20 %t/Calculator.cppm -emit-module-interface -o \14// RUN: %t/MyVec-Calculator.pcm -fmodule-file=MyVec:Vec=%t/MyVec-Vec.pcm \15// RUN: -fmodule-file=MyVec:Vec2=%t/MyVec-Vec2.pcm \16// RUN: -fmodule-file=MyVec:Type=%t/MyVec-Type.pcm \17// RUN: -triple=x86_64-linux-gnu 18// RUN: %clang_cc1 -std=c++20 %t/MyVec-Calculator.pcm -emit-llvm \19// RUN: -fmodule-file=MyVec:Vec=%t/MyVec-Vec.pcm \20// RUN: -fmodule-file=MyVec:Vec2=%t/MyVec-Vec2.pcm \21// RUN: -fmodule-file=MyVec:Type=%t/MyVec-Type.pcm \22// RUN: -triple=x86_64-linux-gnu -o - \23// RUN: | FileCheck %t/Calculator.cppm24 25//--- Type.cppm26export module MyVec:Type;27 28template <class T> struct Size {29 auto total() const { return 1; }30};31 32//--- Vec.cppm33export module MyVec:Vec;34import :Type;35 36int size_ = Size<int>().total();37 38//--- Vec2.cppm39export module MyVec:Vec2;40import :Type;41 42struct Vec2 {43 Size<int> size_;44};45 46//--- Calculator.cppm47export module MyVec:Calculator;48 49import :Vec;50import :Vec2;51 52auto Calculate() { return Size<int>().total(); };53 54// Check the emitted module initializer to make sure we generate the module unit55// successfully.56// CHECK: @_ZW5MyVec9Calculatev57