This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix extern template visibility for Windows
ClosedPublic

Authored by smeenai on Sep 16 2016, 12:11 PM.

Details

Summary

On Windows, marking an extern template class declaration as exported
actually forces an instantiation, which is not the desired behavior.
Instead, the actual explicit instantiations need to be exported.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai updated this revision to Diff 71685.Sep 16 2016, 12:11 PM
smeenai retitled this revision from to [libc++] Fix extern template visibility for Windows.
smeenai updated this object.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.
compnerd added inline comments.Sep 19 2016, 11:10 AM
include/__config
559 ↗(On Diff #71685)

Does it make sense for _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS to ever be marked as __declspec(dllimport)? The macro is applied on instantiations in the implementation, not the header, so this shouldn't be visible to users.

smeenai added inline comments.Sep 19 2016, 11:20 AM
include/__config
559 ↗(On Diff #71685)

It doesn't, which is why I always made it expand to either __declspec(dllexport) or empty.

compnerd accepted this revision.Sep 19 2016, 11:30 AM
compnerd edited edge metadata.
compnerd added inline comments.
include/__config
559 ↗(On Diff #71685)

Ugh, I can't match the lines. I misread the two lines and saw the class template instantiation as being defined.

This revision is now accepted and ready to land.Sep 19 2016, 11:30 AM
This revision was automatically updated to reflect the committed changes.