[libcxx] r309474 - [libc++] Hoist extern template above first use

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 19:57:48 PDT 2017


Marshall, Eric, Hans,

Any objections to backporting this to 5.0? It fixes a potential visibility
issue for clients of the header.

On 7/28/17, 7:54 PM, "cfe-commits on behalf of Shoaib Meenai via cfe-commits" <cfe-commits-bounces at lists.llvm.org on behalf of cfe-commits at lists.llvm.org> wrote:

    Author: smeenai
    Date: Fri Jul 28 19:54:41 2017
    New Revision: 309474
    
    URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D309474-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=EcGbIxegCOTbSLMJelp_vOaeGiS_iQ1eciM_oeX41-E&s=5q7TS5mhaUsf-1jQBqX62RvjcqAiy2whh8RO7yFhPyA&e= 
    Log:
    [libc++] Hoist extern template above first use
    
    This function template is referenced inside class basic_string as a
    friend function. The extern template declaration needs to be above that
    friend declaration to actually take effect.
    
    This is important because this function was marked as exported in
    r307966, so without the extern template taking effect, it can leak into
    other DSOs as a visible symbol.
    
    Modified:
        libcxx/trunk/include/string
    
    Modified: libcxx/trunk/include/string
    URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_include_string-3Frev-3D309474-26r1-3D309473-26r2-3D309474-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=EcGbIxegCOTbSLMJelp_vOaeGiS_iQ1eciM_oeX41-E&s=zFJXc9CA6Sgyh25kGeAh4Qo36gpNQX_zo2qRlRFJoL8&e= 
    ==============================================================================
    --- libcxx/trunk/include/string (original)
    +++ libcxx/trunk/include/string Fri Jul 28 19:54:41 2017
    @@ -556,6 +556,8 @@ template<class _CharT, class _Traits, cl
     basic_string<_CharT, _Traits, _Allocator>
     operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
     
    +_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
    +
     template <bool>
     class _LIBCPP_TEMPLATE_VIS __basic_string_common
     {
    @@ -3999,7 +4001,6 @@ basic_string<_CharT, _Traits, _Allocator
     
     _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(_LIBCPP_FUNC_VIS 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]
    
    
    _______________________________________________
    cfe-commits mailing list
    cfe-commits at lists.llvm.org
    https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=EcGbIxegCOTbSLMJelp_vOaeGiS_iQ1eciM_oeX41-E&s=95GYNfQT_kBVjYvYRYnF3mje6PEyF4EDl4MCBQKCu88&e= 
    



More information about the cfe-commits mailing list