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

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 17:30:00 PDT 2017


Confirmed, this changes is harmless. The failure we're seeing seems to have
been introduced by Clang in r310983, sorry about the confusion.

On Thu, Aug 17, 2017 at 4:35 PM Shoaib Meenai <smeenai at fb.com> wrote:

> See Petr's follow-up. It doesn't look like this was the responsible change.
>
>
>
> *From: *Eric Fiselier <eric at efcs.ca>
> *Date: *Thursday, August 17, 2017 at 4:02 PM
> *To: *Petr Hosek <phosek at chromium.org>
> *Cc: *cfe-commits <cfe-commits at lists.llvm.org>, Marshall Clow <
> mclow.lists at gmail.com>, Hans Wennborg <hans at chromium.org>, Shoaib Meenai <
> smeenai at fb.com>
> *Subject: *Re: [libcxx] r309474 - [libc++] Hoist extern template above
> first use
>
>
>
> probably shouldn't merge this then.
>
>
>
> On Aug 17, 2017 4:54 PM, "Petr Hosek via cfe-commits" <
> cfe-commits at lists.llvm.org> wrote:
>
> This broke our build of WebKit with the following build failure:
>
>
>
> ../../buildtools/linux-x64/clang/bin/clang++ -MD -MF
> obj/apps/web_view/web_view_test.test_webview.o.d
> -DTOOLCHAIN_VERSION=4e89c701396412a50a901115ab4a2a09145f3777
> -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DCAIRO_HAS_FC_FONT=0
> -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_STATIC_IMPLEMENTATION
> -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -I../.. -Igen
> -I../../third_party/webkit/Source/WebKit/fuchsia
> -I../../third_party/boringssl/include -Igen/third_party/cairo
> -I../../third_party/curl/include -Iobj/third_party/curl
> -Iobj/third_party/curl/curl -I../../third_party/freetype2/include
> -I../../third_party/harfbuzz/src -I../../third_party/icu/source/common
> -I../../third_party/icu/source/i18n -I../../third_party/libjpeg-turbo
> -I../../third_party/libpng -I../../third_party/zlib
> -I../../third_party/libxml2/include -I../../third_party/sqlite -g
> --sysroot=/usr/local/google/home/phosek/fuchsia/out/build-magenta/build-magenta-pc-x86-64/sysroot
> --target=x86_64-fuchsia -no-canonical-prefixes
> -fdebug-prefix-map=/usr/local/google/home/phosek/fuchsia=. -Wall -Wextra
> -Wno-unused-parameter -Wno-enum-compare-switch -Wno-unused-lambda-capture
> -Wno-user-defined-warnings -fvisibility=hidden -g -Og -fsanitize=safe-stack
> -fstack-protector-strong -Werror -Wno-error=deprecated-declarations
> -fvisibility-inlines-hidden -std=c++14 -fno-exceptions -fno-rtti
> -Wthread-safety -c ../../apps/web_view/test_webview.cpp -o
> obj/apps/web_view/web_view_test.test_webview.o
>
> In file included from ../../apps/web_view/test_webview.cpp:1:
>
> In file included from
> ../../third_party/webkit/Source/WebKit/fuchsia/WebView.h:28:
>
> In file included from
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/functional:484:
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/type_traits:4323:23:
> error: implicit instantiation of undefined template
> 'std::__2::basic_string<char, std::__2::char_traits<char>,
> std::__2::allocator<char> >'
>
>
> _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
>
>                       ^
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/__config:468:15:
> note: expanded from macro '_VSTD'
>
> #define _VSTD std::_LIBCPP_NAMESPACE
>
>               ^
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/type_traits:4340:9:
> note: in instantiation of exception specification for
> '__invoke<std::__2::function<std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > (const
> std::__2::basic_string<char, std::__2::char_traits<char>,
> std::__2::allocator<char> > &)> &, const std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > &>' requested here
>
>         _VSTD::__invoke(_VSTD::declval<_Fp>(),
> _VSTD::declval<_Args>()...));
>
>         ^
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/__config:468:15:
> note: expanded from macro '_VSTD'
>
> #define _VSTD std::_LIBCPP_NAMESPACE
>
>               ^
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/functional:1601:33:
> note: in instantiation of template class 'std::__2::__invokable_r<void,
> std::__2::function<std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > (const
> std::__2::basic_string<char, std::__2::char_traits<char>,
> std::__2::allocator<char> > &)> &, const std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > &>' requested here
>
>                                 __invokable<_Fp&, _ArgTypes...>::value>
>
>                                 ^
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/functional:1626:9:
> note: in instantiation of default argument for
> '__callable<std::__2::function<std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > (const
> std::__2::basic_string<char, std::__2::char_traits<char>,
> std::__2::allocator<char> > &)> >' required here
>
>         __callable<_Fp>::value && !is_same<_Fp, function>::value
>
>         ^~~~~~~~~~~~~~~
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/functional:1628:5:
> note: in instantiation of default argument for
> 'function<std::__2::function<std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > (const
> std::__2::basic_string<char, std::__2::char_traits<char>,
> std::__2::allocator<char> > &)> >' required here
>
>     function(_Fp);
>
>     ^~~~~~~~~~~~~
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/functional:1588:28:
> note: while substituting deduced template arguments into function template
> 'function' [with _Fp = std::__2::function<std::__2::basic_string<char,
> std::__2::char_traits<char>, std::__2::allocator<char> > (const
> std::__2::basic_string<char, std::__2::char_traits<char>,
> std::__2::allocator<char> > &)>, $1 = (no value)]
>
> class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
>
>                            ^
>
> ../../third_party/webkit/Source/WebKit/fuchsia/WebView.h:48:7: note: while
> declaring the implicit copy constructor for 'WebView'
>
> class WebView {
>
>       ^
>
> ../../buildtools/linux-x64/clang/lib/x86_64-fuchsia/include/c++/v1/iosfwd:193:32:
> note: template is declared here
>
>     class _LIBCPP_TEMPLATE_VIS basic_string;
>
>                                ^
>
> 1 error generated.
>
>
>
> On Wed, Aug 9, 2017 at 4:50 PM Hans Wennborg via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
> Marshall: ping?
>
> On Thu, Aug 3, 2017 at 10:20 AM, Hans Wennborg <hans at chromium.org> wrote:
> > Sounds good to me, but Eric or Marshall need to sign off.
> >
> > On Thu, Aug 3, 2017 at 10:15 AM, Shoaib Meenai <smeenai at fb.com> wrote:
> >> Ping.
> >>
> >> On 7/28/17, 7:57 PM, "Shoaib Meenai" <smeenai at fb.com> wrote:
> >>
> >>     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=
> >>
> >>
> >>
> >>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=R8SHX_YlSY4U7zmB4h5gQuWQpibuszvycUCHsYjXGC8&s=8IKFSIPqi0P433Yd0yIAnrYivPntOldn15teS328Cd8&e=>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=R8SHX_YlSY4U7zmB4h5gQuWQpibuszvycUCHsYjXGC8&s=8IKFSIPqi0P433Yd0yIAnrYivPntOldn15teS328Cd8&e=>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170818/0835b3b1/attachment-0001.html>


More information about the cfe-commits mailing list