brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · b6944b5 Raw
39 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/flyweight.cppm -emit-reduced-module-interface -o %t/flyweight.pcm6// RUN: %clang_cc1 -std=c++20 %t/account.cppm -emit-reduced-module-interface -o %t/account.pcm -fprebuilt-module-path=%t7// RUN: %clang_cc1 -std=c++20 %t/core.cppm -emit-reduced-module-interface -o %t/core.pcm -fprebuilt-module-path=%t8// RUN: %clang_cc1 -std=c++20 %t/core.cppm -fprebuilt-module-path=%t -emit-llvm -disable-llvm-passes -o - | FileCheck %t/core.cppm9 10//--- flyweight.cppm11module;12template <typename> struct flyweight_core {13  static bool init() { (void)__builtin_operator_new(2); return true; }14  static bool static_initializer;15};16template <typename T> bool flyweight_core<T>::static_initializer = init();17export module flyweight;18export template <class> void flyweight() {19  (void)flyweight_core<int>::static_initializer;20}21 22//--- account.cppm23export module account;24import flyweight;25export void account() {26  (void)::flyweight<int>;27}28 29//--- core.cppm30export module core;31import account;32 33extern "C" void core() {}34 35// Fine enough to check it won't crash.36// CHECK-NOT: init37// CHECK-NOT: static_initializer38// CHECK: define {{.*}}@core(39