1// REQUIRES: !system-windows 2 3// RUN: rm -rf %t 4// RUN: split-file %s %t 5// RUN: cd %t 6// 7// RUN: %clang_cc1 -std=c++20 %t/layer1.cppm -triple %itanium_abi_triple \ 8// RUN: -emit-module-interface -o %t/foo-layer1.pcm 9// RUN: %clang_cc1 -std=c++20 %t/layer2.cppm -triple %itanium_abi_triple \ 10// RUN: -emit-module-interface -fmodule-file=foo:layer1=%t/foo-layer1.pcm \ 11// RUN: -o %t/foo-layer2.pcm 12// RUN: %clang_cc1 -std=c++20 %t/foo-layer1.pcm -emit-llvm -o - | FileCheck %t/layer1.cppm 13// RUN: %clang_cc1 -std=c++20 %t/foo-layer2.pcm -emit-llvm -o - \ 14// RUN: -fmodule-file=foo:layer1=%t/foo-layer1.pcm | FileCheck %t/layer2.cppm 15// 16// Check the case about emitting object files from sources directly. 17// RUN: %clang_cc1 -std=c++20 %t/layer1.cppm -triple %itanium_abi_triple \ 18// RUN: -emit-llvm -o - | FileCheck %t/layer1.cppm 19// RUN: %clang_cc1 -std=c++20 %t/layer2.cppm -triple %itanium_abi_triple -emit-llvm \ 20// RUN: -fmodule-file=foo:layer1=%t/foo-layer1.pcm -o - | FileCheck %t/layer2.cppm 21 22//--- layer1.cppm 23export module foo:layer1; 24struct Fruit { 25 virtual ~Fruit() = default; 26 virtual void eval(); 27}; 28 29// CHECK-DAG: @_ZTVW3foo5Fruit = unnamed_addr constant 30// CHECK-DAG: @_ZTSW3foo5Fruit = constant 31// CHECK-DAG: @_ZTIW3foo5Fruit = constant 32 33// Testing that: 34// (1) The use of virtual functions won't produce the vtable. 35// (2) The definition of key functions won't produce the vtable. 36// 37//--- layer2.cppm 38export module foo:layer2; 39import :layer1; 40export void layer2_fun() { 41 Fruit *b = new Fruit(); 42 b->eval(); 43} 44void Fruit::eval() {} 45// CHECK: @_ZTVW3foo5Fruit = external unnamed_addr constant 46// CHECK-NOT: @_ZTSW3foo5Fruit 47// CHECK-NOT: @_ZTIW3foo5Fruit 48