<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">The point of the extern template was to prevent that operator from being defined in any other object files. The extern template wasn't taking effect because of its placement in the file, but I fixed that in r309474. Does your issue get
 resolved with that second change in place?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black"><ahatanaka@apple.com> on behalf of Akira Hatanaka <ahatanaka@apple.com><br>
<b>Date: </b>Tuesday, August 22, 2017 at 6:21 PM<br>
<b>To: </b>Shoaib Meenai <smeenai@fb.com><br>
<b>Cc: </b>"cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org><br>
<b>Subject: </b>Re: [libcxx] r307966 - [libc++] Mark string operator+ _LIBCPP_FUNC_VIS<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This change makes it impossible to change the visibility of operator+ with -fvisibility=hidden, which is not desirable on Darwin.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">For example:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">$ cat test.cpp<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif">#include <string><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif">using namespace std;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif">string foo1(string s) {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif">  return "abc" + s;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">$ clang++ test.cpp -fvisibility=hidden -c; nm -m -a test.o | grep <span style="font-size:8.5pt;font-family:"Menlo",sans-serif;background:white">__ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",sans-serif">0000000000000030 (__TEXT,__text) weak external __ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal">The symbol used to be “weak private external”, but it is “weak external” now.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Jul 13, 2017, at 2:35 PM, Shoaib Meenai via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Author: smeenai<br>
Date: Thu Jul 13 14:35:52 2017<br>
New Revision: 307966<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D307966-26view-3Drev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fSgXogPdeBdhqIn59AresTrI4a5SvxnrlrH4EXmRKw4&s=uHFcqiGZetyK3t7-YYvkubjoCERPfi_DGNp3ZwQn-_g&e=">
http://llvm.org/viewvc/llvm-project?rev=307966&view=rev</a><br>
Log:<br>
[libc++] Mark string operator+ _LIBCPP_FUNC_VIS<br>
<br>
It has an extern template instantiation declaration in the headers and a<br>
corresponding instantiation definition in the library, so we must mark<br>
it with _LIBCPP_FUNC_VIS to make it available outside the library.<br>
<br>
This doesn't cause any ABI changes as-is since we don't build libc++<br>
with hidden visibility (so the function is exported anyway). It's needed<br>
for building libc++ with hidden visibility, however.<br>
<br>
Clarify the Windows behavior for extern function templates while I'm<br>
here, since this exercises that behavior.<br>
<br>
Modified:<br>
   libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst<br>
   libcxx/trunk/include/string<br>
<br>
Modified: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_docs_DesignDocs_VisibilityMacros.rst-3Frev-3D307966-26r1-3D307965-26r2-3D307966-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fSgXogPdeBdhqIn59AresTrI4a5SvxnrlrH4EXmRKw4&s=g6z9tFqcc6oS9s7ahnZSfMluaIqZ7wif_ft33mP7H18&e=">
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst?rev=307966&r1=307965&r2=307966&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst (original)<br>
+++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst Thu Jul 13 14:35:52 2017<br>
@@ -98,7 +98,8 @@ Visibility Macros<br>
  explicit instantiations themselves are marked as exported. Note that this<br>
  applies *only* to extern *class* templates. Extern *function* templates obey<br>
  regular import/export semantics, and applying `dllexport` directly to the<br>
-  extern template declaration is the correct thing to do for them.<br>
+  extern template declaration (i.e. using `_LIBCPP_FUNC_VIS`) is the correct<br>
+  thing to do for them.<br>
<br>
**_LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS**<br>
  Mark the member functions, typeinfo, and vtable of an explicit instantiation<br>
<br>
Modified: libcxx/trunk/include/string<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_include_string-3Frev-3D307966-26r1-3D307965-26r2-3D307966-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fSgXogPdeBdhqIn59AresTrI4a5SvxnrlrH4EXmRKw4&s=eoxEd6j-lxbIB3Nhf0bJFjtVvnXJq2lKJpLY_lTM8aY&e=">
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=307966&r1=307965&r2=307966&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/string (original)<br>
+++ libcxx/trunk/include/string Thu Jul 13 14:35:52 2017<br>
@@ -4006,7 +4006,7 @@ basic_string<_CharT, _Traits, _Allocator<br>
<br>
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)<br>
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)<br>
-_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))<br>
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))<br>
<br>
#if _LIBCPP_STD_VER > 11 <br>
// Literal suffixes for basic_string [basic.string.literals]<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>