[libcxx] r306632 - [libc++] Hoist explicit instantiation above implicit. NFC
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 28 19:52:46 PDT 2017
Author: smeenai
Date: Wed Jun 28 19:52:46 2017
New Revision: 306632
URL: http://llvm.org/viewvc/llvm-project?rev=306632&view=rev
Log:
[libc++] Hoist explicit instantiation above implicit. NFC
The string literal operators have implicit instantiations of
basic_string<char> and basic_string<wchar>, which prevent the dllimport
on the subsequent explicit instantiation declarations from having an
effect. Hoisting the explicit instantiations above the implicit ones
fixes the issue.
I think it's pretty unfortunate that the ordering has such an effect,
and I'd fixed the same issue for dllexport in r288682. dllimport is more
complicated from a codegen perspective, however, and clang's behavior of
ignoring the dllimport when there's a previous implicit instantiation is
consistent with cl, so changing the order is our only recourse.
Modified:
libcxx/trunk/include/string
Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=306632&r1=306631&r2=306632&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed Jun 28 19:52:46 2017
@@ -4004,6 +4004,10 @@ basic_string<_CharT, _Traits, _Allocator
#endif // _LIBCPP_DEBUG_LEVEL >= 2
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
+
#if _LIBCPP_STD_VER > 11
// Literal suffixes for basic_string [basic.string.literals]
inline namespace literals
@@ -4037,10 +4041,6 @@ inline namespace literals
}
#endif
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
-_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
-
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
More information about the cfe-commits
mailing list