Skip to content

Commit d7e93e8

Browse files
committed
update test
1 parent 1e558da commit d7e93e8

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

clang/test/CodeGenCXX/attr-exclude_from_explicit_instantiation.exclude_from_dllexport.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct C {
1717
// marked as dllexport explicitly.
1818
EXCLUDE_FROM_EXPLICIT_INSTANTIATION __declspec(dllexport) void to_be_exported_explicitly() noexcept;
1919

20-
// This will be instantiated implicitly as an exported function unintentionally.
20+
// This will be instantiated implicitly but won't be exported.
2121
EXCLUDE_FROM_EXPLICIT_INSTANTIATION void not_to_be_exported() noexcept;
2222

2323
// This won't be instantiated.
@@ -32,11 +32,9 @@ template <class T> void C<T>::not_to_be_instantiated() noexcept {}
3232
// MSC: $"?to_be_exported@?$C@H@@QEAAXXZ" = comdat any
3333
// MSC: $"?to_be_exported_explicitly@?$C@H@@QEAAXXZ" = comdat any
3434
// MSC: $"?not_to_be_exported@?$C@H@@QEAAXXZ" = comdat any
35-
// MSC: $"?not_to_be_instantiated@?$C@H@@QEAAXXZ" = comdat any
3635
// GNU: $_ZN1CIiE14to_be_exportedEv = comdat any
3736
// GNU: $_ZN1CIiE25to_be_exported_explicitlyEv = comdat any
3837
// GNU: $_ZN1CIiE18not_to_be_exportedEv = comdat any
39-
// GNU: $_ZN1CIiE22not_to_be_instantiatedEv = comdat any
4038

4139
// MSC: define weak_odr dso_local dllexport{{.*}} void @"?to_be_exported@?$C@H@@QEAAXXZ"
4240
// GNU: define weak_odr dso_local dllexport{{.*}} void @_ZN1CIiE14to_be_exportedEv
@@ -57,8 +55,5 @@ void use() {
5755
// MSC: define weak_odr dso_local dllexport{{.*}} void @"?to_be_exported_explicitly@?$C@H@@QEAAXXZ"
5856
// GNU: define weak_odr dso_local dllexport{{.*}} void @_ZN1CIiE25to_be_exported_explicitlyEv
5957

60-
// MSC: define weak_odr dso_local dllexport void @"?not_to_be_exported@?$C@H@@QEAAXXZ"
61-
// GNU: define weak_odr dso_local dllexport void @_ZN1CIiE18not_to_be_exportedEv
62-
63-
// MSC: define weak_odr dso_local dllexport void @"?not_to_be_instantiated@?$C@H@@QEAAXXZ"
64-
// GNU: define weak_odr dso_local dllexport void @_ZN1CIiE22not_to_be_instantiatedEv
58+
// MSC: define linkonce_odr dso_local void @"?not_to_be_exported@?$C@H@@QEAAXXZ"
59+
// GNU: define linkonce_odr dso_local void @_ZN1CIiE18not_to_be_exportedEv

clang/test/CodeGenCXX/attr-exclude_from_explicit_instantiation.exclude_from_dllimport.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ struct C {
1313
// inherits dllimport from the class instantiation.
1414
void to_be_imported() noexcept;
1515

16-
// Per-member dllimport in explicitly dllimport-ed template instantiation is not allowed.
17-
//EXCLUDE_FROM_EXPLICIT_INSTANTIATION __declspec(dllimport) void to_be_imported_explicitly() noexcept;
16+
// This will be instantiated implicitly as an imported function because it is
17+
// marked as dllimport explicitly.
18+
EXCLUDE_FROM_EXPLICIT_INSTANTIATION __declspec(dllimport) void to_be_imported_explicitly() noexcept;
1819

19-
// This will be instantiated implicitly as an imported function unintentionally.
20+
// This will be instantiated implicitly but won't be imported.
2021
EXCLUDE_FROM_EXPLICIT_INSTANTIATION void not_to_be_imported() noexcept;
2122

2223
// This won't be instantiated.
@@ -27,6 +28,8 @@ template <class T> void C<T>::to_be_imported() noexcept {}
2728
template <class T> void C<T>::not_to_be_imported() noexcept {}
2829
template <class T> void C<T>::not_to_be_instantiated() noexcept {}
2930

31+
// MSC: $"?not_to_be_imported@?$C@H@@QEAAXXZ" = comdat any
32+
// GNU: $_ZN1CIiE18not_to_be_importedEv = comdat any
3033
extern template struct __declspec(dllimport) C<int>;
3134

3235
void use() {
@@ -36,7 +39,9 @@ void use() {
3639
// GNU: call void @_ZN1CIiE14to_be_importedEv
3740
c.to_be_imported();
3841

39-
//c.to_be_imported_explicitly();
42+
// MSC: call void @"?to_be_imported_explicitly@?$C@H@@QEAAXXZ"
43+
// GNU: call void @_ZN1CIiE25to_be_imported_explicitlyEv
44+
c.to_be_imported_explicitly(); // implicitly instantiated here
4045

4146
// MSC: call void @"?not_to_be_imported@?$C@H@@QEAAXXZ"
4247
// GNU: call void @_ZN1CIiE18not_to_be_importedEv
@@ -46,5 +51,8 @@ void use() {
4651
// MSC: declare dllimport void @"?to_be_imported@?$C@H@@QEAAXXZ"
4752
// GNU: declare dllimport void @_ZN1CIiE14to_be_importedEv
4853

49-
// MSC: declare dllimport void @"?not_to_be_imported@?$C@H@@QEAAXXZ"
50-
// GNU: declare dllimport void @_ZN1CIiE18not_to_be_importedEv
54+
// MSC: declare dllimport void @"?to_be_imported_explicitly@?$C@H@@QEAAXXZ"
55+
// GNU: declare dllimport void @_ZN1CIiE25to_be_imported_explicitlyEv
56+
57+
// MSC: define linkonce_odr dso_local void @"?not_to_be_imported@?$C@H@@QEAAXXZ"
58+
// GNU: define linkonce_odr dso_local void @_ZN1CIiE18not_to_be_importedEv

0 commit comments

Comments
 (0)