brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 75f7598 Raw
106 lines · plain
1// REQUIRES: !system-windows, !system-cygwin2 3// RUN: rm -rf %t4// RUN: split-file %s %t5// RUN: cd %t6//7// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -emit-module-interface \8// RUN:     %t/Mod.cppm -o %t/Mod.pcm9//10// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/Mod.pcm \11// RUN:     -emit-llvm -o - | FileCheck %t/Mod.cppm12// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -fmodule-file=Mod=%t/Mod.pcm \13// RUN:     %t/Use.cpp  -emit-llvm -o - | FileCheck %t/Use.cpp14//15// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -emit-module-interface \16// RUN:     %t/Mod.cppm -o %t/Mod.pcm -DKEY_FUNCTION_INLINE17//18// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/Mod.pcm \19// RUN:     -emit-llvm -o - | FileCheck %t/Mod.cppm -check-prefix=CHECK-INLINE20// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -fmodule-file=Mod=%t/Mod.pcm \21// RUN:     %t/Use.cpp  -emit-llvm -o - | FileCheck %t/Use.cpp -check-prefix=CHECK-INLINE22//23// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -emit-module-interface \24// RUN:     %t/M-A.cppm -o %t/M-A.pcm25// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -fmodule-file=M:A=%t/M-A.pcm \26// RUN:     %t/M-B.cppm  -emit-llvm -o - | FileCheck %t/M-B.cppm27// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 \28// RUN:     %t/M-A.pcm  -emit-llvm -o - | FileCheck %t/M-A.cppm29 30//--- Mod.cppm31export module Mod;32 33export class Base {34public:35    virtual ~Base();36};37#ifdef KEY_FUNCTION_INLINE38inline39#endif40Base::~Base() {}41 42// CHECK: @_ZTVW3Mod4Base = unnamed_addr constant43// CHECK: @_ZTIW3Mod4Base = constant44// CHECK: @_ZTSW3Mod4Base = constant45 46// With the new Itanium C++ ABI, the linkage of vtables in modules don't need to be linkonce ODR.47// CHECK-INLINE: @_ZTVW3Mod4Base = {{.*}}unnamed_addr constant48// CHECK-INLINE: @_ZTIW3Mod4Base = {{.*}}constant49// CHECK-INLINE: @_ZTSW3Mod4Base = {{.*}}constant50 51module :private;52int private_use() {53    Base base;54    return 43;55}56 57//--- Use.cpp58import Mod;59int use() {60    Base* base = new Base();61    return 43;62}63 64// CHECK-NOT: @_ZTIW3Mod4Base65// CHECK-NOT: @_ZTSW3Mod4Base66// CHECK: @_ZTVW3Mod4Base = external67 68// CHECK-INLINE-NOT: @_ZTIW3Mod4Base69// CHECK-INLINE-NOT: @_ZTSW3Mod4Base70// CHECK-INLINE: @_ZTVW3Mod4Base = external71 72// Check the case that the declaration of the key function comes from another73// module unit but the definition of the key function comes from the current74// module unit.75 76//--- M-A.cppm77export module M:A;78export class C {79public:80    virtual ~C();81};82 83int a_use() {84    C c;85    return 43;86}87 88// CHECK: @_ZTVW1M1C = unnamed_addr constant89// CHECK: @_ZTIW1M1C = constant90// CHECK: @_ZTSW1M1C = constant91 92//--- M-B.cppm93export module M:B;94import :A;95 96C::~C() {}97 98int b_use() {99    C c;100    return 43;101}102 103// CHECK: @_ZTVW1M1C = external104// CHECK-NOT: @_ZTIW1M1C105// CHECK-NOT: @_ZTSW1M1C106