brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.7 KiB · 318250a Raw
198 lines · cpp
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: cd %t4 5// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.cpp \6// RUN:    -emit-module-interface -o N.pcm7// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.pcm -emit-llvm \8// RUN:  -o - | FileCheck %s --check-prefix=CHECK-N9 10// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.cpp \11// RUN:    -emit-module-interface -o O.pcm12// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.pcm -emit-llvm \13// RUN:  -o - | FileCheck %s --check-prefix=CHECK-O14 15// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.cpp \16// RUN:    -emit-module-interface -o M-Part.pcm17// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.pcm \18// RUN:    -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-P19 20// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.cpp \21// RUN:    -fprebuilt-module-path=%t -emit-module-interface -o M.pcm22// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.pcm -emit-llvm \23// RUN:    -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-M24 25// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 useM.cpp \26// RUN:   -fprebuilt-module-path=%t -emit-llvm -o - \27// RUN:   | FileCheck %s --check-prefix=CHECK-USE28 29// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-impl.cpp \30// RUN:   -fprebuilt-module-path=%t -emit-llvm -o - \31// RUN:   | FileCheck %s --check-prefix=CHECK-IMPL32 33// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.cpp -emit-llvm \34// RUN:   -o - | FileCheck %s --check-prefix=CHECK-N35 36// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.cpp -emit-llvm \37// RUN:   -o - | FileCheck %s --check-prefix=CHECK-O38 39// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.cpp -emit-llvm \40// RUN:   -o - | FileCheck %s --check-prefix=CHECK-P41 42// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.cpp \43// RUN:   -fprebuilt-module-path=%t -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-M44 45//--- N-h.h46 47struct Oink {48  Oink(){};49};50 51Oink Hog;52 53//--- N.cpp54 55module;56#include "N-h.h"57 58export module N;59 60export struct Quack {61  Quack(){};62};63 64export Quack Duck;65 66// CHECK-N: define internal void @__cxx_global_var_init67// CHECK-N: call {{.*}} @_ZN4OinkC1Ev68// CHECK-N: define internal void @__cxx_global_var_init69// CHECK-N: call {{.*}} @_ZNW1N5QuackC1Ev70// CHECK-N: define void @_ZGIW1N71// CHECK-N: store i8 1, ptr @_ZGIW1N__in_chrg72// CHECK-N: call void @__cxx_global_var_init73// CHECK-N: call void @__cxx_global_var_init74 75//--- O-h.h76 77struct Meow {78  Meow(){};79};80 81Meow Cat;82 83//--- O.cpp84 85module;86#include "O-h.h"87 88export module O;89 90export struct Bark {91  Bark(){};92};93 94export Bark Dog;95 96// CHECK-O: define internal void @__cxx_global_var_init97// CHECK-O: call {{.*}} @_ZN4MeowC2Ev98// CHECK-O: define internal void @__cxx_global_var_init99// CHECK-O: call {{.*}} @_ZNW1O4BarkC1Ev100// CHECK-O: define void @_ZGIW1O101// CHECK-O: store i8 1, ptr @_ZGIW1O__in_chrg102// CHECK-O: call void @__cxx_global_var_init103// CHECK-O: call void @__cxx_global_var_init104 105//--- P-h.h106 107struct Croak {108  Croak(){};109};110 111Croak Frog;112 113//--- M-Part.cpp114 115module;116#include "P-h.h"117 118module M:Part;119 120struct Squawk {121  Squawk(){};122};123 124Squawk parrot;125 126// CHECK-P: define internal void @__cxx_global_var_init127// CHECK-P: call {{.*}} @_ZN5CroakC1Ev128// CHECK-P: define internal void @__cxx_global_var_init129// CHECK-P: call {{.*}} @_ZNW1M6SquawkC1Ev130// CHECK-P: define void @_ZGIW1MWP4Part131// CHECK-P: store i8 1, ptr @_ZGIW1MWP4Part__in_chrg132// CHECK-P: call void @__cxx_global_var_init133// CHECK-P: call void @__cxx_global_var_init134 135//--- M-h.h136 137struct Moo {138  Moo(){};139};140 141Moo Cow;142 143//--- M.cpp144 145module;146#include "M-h.h"147 148export module M;149import N;150export import O;151import :Part;152 153export struct Baa {154  int x;155  Baa(){};156  Baa(int x) : x(x) {}157  int getX() { return x; }158};159 160export Baa Sheep(10);161 162// CHECK-M: define internal void @__cxx_global_var_init163// CHECK-M: call {{.*}} @_ZN3MooC1Ev164// CHECK-M: define internal void @__cxx_global_var_init165// CHECK-M: call {{.*}} @_ZNW1M3BaaC1Ei166// CHECK-M: declare void @_ZGIW1O()167// CHECK-M: declare void @_ZGIW1N()168// CHECK-M: declare void @_ZGIW1MWP4Part()169// CHECK-M: define void @_ZGIW1M170// CHECK-M: store i8 1, ptr @_ZGIW1M__in_chrg171// CHECK-M: call void @_ZGIW1O()172// CHECK-M: call void @_ZGIW1N()173// CHECK-M: call void @_ZGIW1MWP4Part()174// CHECK-M: call void @__cxx_global_var_init175// CHECK-M: call void @__cxx_global_var_init176 177//--- useM.cpp178 179import M;180 181int main() {182  return Sheep.getX();183}184 185// CHECK-USE: declare void @_ZGIW1M186// CHECK-USE: define internal void @_GLOBAL__sub_I_useM.cpp187// CHECK-USE: call void @_ZGIW1M()188 189//--- M-impl.cpp190 191module M;192 193int foo(int i) { return i + 1; }194 195// CHECK-IMPL: declare void @_ZGIW1M196// CHECK-IMPL: define internal void @_GLOBAL__sub_I_M_impl.cpp197// CHECK-IMPL: call void @_ZGIW1M()198