103 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/d.cppm \6// RUN: -emit-module-interface -o %t/d.pcm7// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/c.cppm \8// RUN: -emit-module-interface -o %t/c.pcm -fprebuilt-module-path=%t9// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.cppm \10// RUN: -emit-module-interface -o %t/b.pcm -fprebuilt-module-path=%t11// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.cppm \12// RUN: -emit-module-interface -o %t/a.pcm -fprebuilt-module-path=%t13// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.pcm \14// RUN: -emit-llvm -disable-llvm-passes -o - -fprebuilt-module-path=%t \15// RUN: | FileCheck %t/a.cppm16 17// Test again with reduced BMI.18// RUN: rm -rf %t19// RUN: mkdir %t20// RUN: split-file %s %t21//22// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/d.cppm \23// RUN: -emit-reduced-module-interface -o %t/d.pcm24// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/c.cppm \25// RUN: -emit-reduced-module-interface -o %t/c.pcm -fprebuilt-module-path=%t26// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.cppm \27// RUN: -emit-reduced-module-interface -o %t/b.pcm -fprebuilt-module-path=%t28// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.cppm \29// RUN: -emit-module-interface -o %t/a.pcm -fprebuilt-module-path=%t30// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.pcm \31// RUN: -emit-llvm -disable-llvm-passes -o - -fprebuilt-module-path=%t \32// RUN: | FileCheck %t/a.cppm33 34//--- d.cppm35export module d;36 37export template<typename>38struct integer {39 using type = int;40 41 static constexpr auto value() {42 return 0;43 }44 45 friend constexpr void f(integer const x) {46 x.value();47 }48};49 50export constexpr void ddd(auto const value) {51 f(value);52}53 54 55template<typename T>56constexpr auto dd = T();57 58export template<typename T>59constexpr auto d() {60 dd<T>;61}62 63//--- c.cppm64export module c;65 66import d;67 68template<typename T>69auto cc = T();70 71auto c() {72 cc<integer<int>>;73 integer<int>().value();74}75 76//--- b.cppm77export module b;78 79import d;80 81auto b() {82 integer<int>::type;83}84 85//--- a.cppm86export module a;87 88import b;89import c;90import d;91 92constexpr void aa() {93 d<integer<unsigned>>();94 ddd(integer<int>());95}96 97export extern "C" void a() {98 aa();99}100 101// Checks that we emit the IR successfully.102// CHECK: define{{.*}}@a(103