brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · c912a41 Raw
45 lines · cpp
1// Test that modules with different visibility mode can be shared.2// REQUIRES: aarch64-registered-target3 4// RUN: rm -rf %t && mkdir %t5// RUN: split-file %s %t6 7// RUN: %clang_cc1 -triple arm64e-apple-macos -x c++ -fvisibility=default -fmodules -emit-module -fmodule-name=foo %t/foo.modulemap -o %t/foo.default.pcm8// RUN: %clang_cc1 -triple arm64e-apple-macos -x c++ -fvisibility=hidden  -fmodules -emit-module -fmodule-name=foo %t/foo.modulemap -o %t/foo.hidden.pcm9 10// RUN: %clang_cc1 -triple arm64e-apple-macos -x c++ -fvisibility=default -fmodules -fmodule-file=%t/foo.default.pcm -I%t -emit-llvm %t/test.cpp -o - | FileCheck %s --check-prefixes=DEFAULT,BOTH11// RUN: %clang_cc1 -triple arm64e-apple-macos -x c++ -fvisibility=default -fmodules -fmodule-file=%t/foo.hidden.pcm  -I%t -emit-llvm %t/test.cpp -o - | FileCheck %s --check-prefixes=DEFAULT,BOTH12 13// RUN: %clang_cc1 -triple arm64e-apple-macos -x c++ -fvisibility=hidden -fmodules -fmodule-file=%t/foo.default.pcm -I%t -emit-llvm %t/test.cpp -o - | FileCheck %s --check-prefixes=HIDDEN,BOTH14// RUN: %clang_cc1 -triple arm64e-apple-macos -x c++ -fvisibility=hidden -fmodules -fmodule-file=%t/foo.hidden.pcm  -I%t -emit-llvm %t/test.cpp -o - | FileCheck %s --check-prefixes=HIDDEN,BOTH15 16// DEFAULT: define void @_Z2f4v()17// HIDDEN: define hidden void @_Z2f4v()18// DEFAULT: define void @_Z4testv()19// HIDDEN: define hidden void @_Z4testv()20// BOTH: declare void @_Z2f1v()21// BOTH: define internal void @_ZL2f2v()22// DEFAULT: define linkonce_odr void @_Z2f3v()23// HIDDEN: define linkonce_odr hidden void @_Z2f3v()24 25 26//--- foo.h27void f1();28static void f2() {}29inline void f3() {}30void f4() {}31 32//--- test.cpp33#include "foo.h"34 35void test() {36  f1();37  f2();38  f3();39  f4();40}41 42//--- foo.modulemap43module foo { header "foo.h" }44 45