Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 3b3f2f6

Browse files
committed
[Sema] Use MS ABI behavior for dllexport in Itanium
Similar to r284288, make the Itanium ABI follow MS ABI dllexport semantics in the case of an explicit instantiation declaration followed by a dllexport explicit instantiation definition. Differential Revision: https://reviews.llvm.org/D26471 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286419 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9936364 commit 3b3f2f6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/Sema/SemaTemplate.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -7674,7 +7674,8 @@ Sema::ActOnExplicitInstantiation(Scope *S,
76747674
Def->setTemplateSpecializationKind(TSK);
76757675

76767676
if (!getDLLAttr(Def) && getDLLAttr(Specialization) &&
7677-
Context.getTargetInfo().getCXXABI().isMicrosoft()) {
7677+
(Context.getTargetInfo().getCXXABI().isMicrosoft() ||
7678+
Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())) {
76787679
// In the MS ABI, an explicit instantiation definition can add a dll
76797680
// attribute to a template with a previous instantiation declaration.
76807681
// MinGW doesn't allow this.

test/CodeGenCXX/windows-itanium-dllexport.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,19 @@ struct __declspec(dllexport) s {
77
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_
88
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv
99

10+
template <class T>
11+
class c {
12+
void f() {}
13+
};
14+
15+
template class __declspec(dllexport) c<int>;
16+
17+
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiEaSERKS0_
18+
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv
19+
20+
extern template class c<char>;
21+
template class __declspec(dllexport) c<char>;
22+
23+
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcEaSERKS0_
24+
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv
25+

0 commit comments

Comments
 (0)