if (KeyFunction->getCanonicalDecl() != MD->getCanonicalDecl())
return;
} else {
+ // If we have no key funcion and this is a explicit instantiation declaration,
+ // we will produce a vtable at the explicit instantiation. We don't need one
+ // here.
+ if (RDKind == clang::TSK_ExplicitInstantiationDeclaration)
+ return;
+
// If this is an explicit instantiation of a method, we don't need a vtable.
// Since we have no key function, we will emit the vtable when we see
// a use, and just defining a function is not an use.
- if ((RDKind == TSK_ImplicitInstantiation ||
- RDKind == TSK_ExplicitInstantiationDeclaration) &&
+ if (RDKind == TSK_ImplicitInstantiation &&
MDKind == TSK_ExplicitInstantiationDefinition)
return;
}
// CHECK: @_ZTI1FIlE = weak_odr constant
// F<int> is an explicit template instantiation declaration without a
-// key function, so its vtable should have weak_odr linkage.
-// CHECK: @_ZTV1FIiE = weak_odr constant
-// CHECK: @_ZTS1FIiE = weak_odr constant
-// CHECK: @_ZTI1FIiE = weak_odr constant
+// key function, so its vtable should have external linkage.
+// CHECK: @_ZTV1FIiE = external constant
// E<int> is an explicit template instantiation declaration. It has a
// key function that is not instantiated, so we should only reference