brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · d6e6fff Raw
58 lines · plain
1// Test case from https://github.com/llvm/llvm-project/issues/599992//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Module.cppm \8// RUN:     -emit-module-interface -o %t/Module.pcm9// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Object.cppm \10// RUN:     -fmodule-file=Module=%t/Module.pcm -emit-module-interface -o %t/Object.pcm11// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Object.pcm \12// RUN:     -fmodule-file=Module=%t/Module.pcm -emit-llvm -o - | FileCheck %t/Object.cppm13 14// Test again with reduced BMI.15// RUN: rm -rf %t16// RUN: mkdir -p %t17// RUN: split-file %s %t18//19// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Module.cppm \20// RUN:     -emit-reduced-module-interface -o %t/Module.pcm21// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Object.cppm \22// RUN:     -fmodule-file=Module=%t/Module.pcm -emit-module-interface -o %t/Object.pcm23// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Object.pcm \24// RUN:     -fmodule-file=Module=%t/Module.pcm -emit-llvm -o - | FileCheck %t/Object.cppm25 26 27//--- Module.cppm28export module Module;29 30export template <class ObjectType> bool ModuleRegister() { return true; };31 32export struct ModuleEntry {33  static const bool bRegistered;34};35 36const bool ModuleEntry::bRegistered = ModuleRegister<ModuleEntry>();37 38//--- Object.cppm39export module Object;40 41import Module;42 43export template <class ObjectType> bool ObjectRegister() { return true; }44export struct NObject {45  static const bool bRegistered;46};47export struct ObjectModuleEntry {48  static const bool bRegistered;49};50 51// This function is also required for crash52const bool NObject::bRegistered = ObjectRegister<NObject>();53// One another function, that helps clang crash54const bool ObjectModuleEntry::bRegistered = ModuleRegister<ObjectModuleEntry>();55 56// Check that the LLVM IR is generated correctly instead of crashing.57// CHECK: define{{.*}}@_ZGIW6Object58