From abeffc9fd6b0cd8f6f25f854e97cd73310c8a7e5 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 12 Nov 2023 21:29:03 -0800 Subject: [PATCH] [test] Test #pragma GCC visibility interaction with explicit instantiations --- clang/test/CodeGenCXX/visibility.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/clang/test/CodeGenCXX/visibility.cpp b/clang/test/CodeGenCXX/visibility.cpp index 903db66a137afb..b017bc8b52d5a5 100644 --- a/clang/test/CodeGenCXX/visibility.cpp +++ b/clang/test/CodeGenCXX/visibility.cpp @@ -1007,8 +1007,8 @@ namespace test51 { // a default symbol. struct HIDDEN foo {}; - DEFAULT foo da, db, dc, dd; - HIDDEN foo ha, hb, hc, hd; + DEFAULT foo da, db, dc, dd, de, df; + HIDDEN foo ha, hb, hc, hd, he, hf; template void DEFAULT zed() { } @@ -1036,14 +1036,26 @@ namespace test51 { // CHECK-LABEL: define weak_odr hidden void @_ZN6test513zedIXadL_ZNS_2hcEEEEEvv( // CHECK-HIDDEN-LABEL: define weak_odr hidden void @_ZN6test513zedIXadL_ZNS_2hcEEEEEvv( +#pragma GCC visibility push(hidden) + template void zed<&dd>(); + template void zed<&hd>(); + template void DEFAULT zed<&he>(); +#pragma GCC visibility pop + // CHECK-LABEL: define weak_odr hidden void @_ZN6test513zedIXadL_ZNS_2ddEEEEEvv( + // CHECK-LABEL: define weak_odr hidden void @_ZN6test513zedIXadL_ZNS_2hdEEEEEvv( + // CHECK-LABEL: define weak_odr void @_ZN6test513zedIXadL_ZNS_2heEEEEEvv( + // CHECK-HIDDEN-LABEL: define weak_odr hidden void @_ZN6test513zedIXadL_ZNS_2ddEEEEEvv( + // CHECK-HIDDEN-LABEL: define weak_odr hidden void @_ZN6test513zedIXadL_ZNS_2hdEEEEEvv( + // CHECK-HIDDEN-LABEL: define weak_odr void @_ZN6test513zedIXadL_ZNS_2heEEEEEvv( + void use() { - zed<&dd>(); - zed<&hd>(); + zed<&df>(); + zed<&hf>(); } - // CHECK-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2ddEEEEEvv( - // CHECK-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2hdEEEEEvv( - // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2ddEEEEEvv( - // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2hdEEEEEvv( + // CHECK-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2dfEEEEEvv( + // CHECK-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2hfEEEEEvv( + // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2dfEEEEEvv( + // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void @_ZN6test513zedIXadL_ZNS_2hfEEEEEvv( } namespace test52 {