[libcxx-commits] [libcxx] r359243 - Remove incorrect explicit instantiation declarations for valarray

Richard Smith via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 25 14:31:58 PDT 2019


Author: rsmith
Date: Thu Apr 25 14:31:58 2019
New Revision: 359243

URL: http://llvm.org/viewvc/llvm-project?rev=359243&view=rev
Log:
Remove incorrect explicit instantiation declarations for valarray

libc++ ABI v1 provides three valarray symbols as part of the shared library:

valarray<size_t>::valarray(size_t)
valarray<size_t>::~valarray()
valarray<size_t>::resize(size_t, size_t)

The first two of these are intended to be removed in V2 of the ABI: they're
attributed _LIBCPP_HIDE_FROM_ABI_AFTER_V1, and  it appears that the intention
is that these symbols from the library are not used even when building using
the V1 ABI. However, there are explicit instantiation declarations for all
three symbols in the header, which are not correct as we do not intend to find
an instantiation of these functions that is provided elsewhere.

(A recent change to clang to properly diagnose explicit instantiation
declarations of internal linkage functions -- required by [temp.explicit]p13 --
had to be rolled back because it diagnosed these explicit instantiations.)

Remove the explicit instantiation declarations, and remove the explicit
instantiation definitions for V2 of the libc++ ABI onwards.

Modified:
    libcxx/trunk/include/valarray
    libcxx/trunk/lib/abi/x86_64-apple-darwin.v2.abilist
    libcxx/trunk/src/valarray.cpp

Modified: libcxx/trunk/include/valarray
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/valarray?rev=359243&r1=359242&r2=359243&view=diff
==============================================================================
--- libcxx/trunk/include/valarray (original)
+++ libcxx/trunk/include/valarray Thu Apr 25 14:31:58 2019
@@ -1059,8 +1059,6 @@ private:
     valarray& __assign_range(const value_type* __f, const value_type* __l);
 };
 
-_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
-_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
 
 template <class _Op, class _Tp>

Modified: libcxx/trunk/lib/abi/x86_64-apple-darwin.v2.abilist
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/x86_64-apple-darwin.v2.abilist?rev=359243&r1=359242&r2=359243&view=diff
==============================================================================
--- libcxx/trunk/lib/abi/x86_64-apple-darwin.v2.abilist (original)
+++ libcxx/trunk/lib/abi/x86_64-apple-darwin.v2.abilist Thu Apr 25 14:31:58 2019
@@ -1380,10 +1380,6 @@
 {'is_defined': True, 'name': '__ZNSt3__28time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE', 'size': 0, 'type': 'OBJECT'}
 {'is_defined': True, 'name': '__ZNSt3__28time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE', 'size': 0, 'type': 'OBJECT'}
 {'is_defined': True, 'name': '__ZNSt3__28valarrayImE6resizeEmm', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImEC1Em', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImEC2Em', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImED1Ev', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImED2Ev', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE17__stage2_int_loopEciPcRS2_RjcRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSD_PKc', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE17__stage2_int_prepERNS_8ios_baseERc', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE19__stage2_float_loopEcRbRcPcRS4_ccRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSE_RjS4_', 'type': 'FUNC'}

Modified: libcxx/trunk/src/valarray.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/valarray.cpp?rev=359243&r1=359242&r2=359243&view=diff
==============================================================================
--- libcxx/trunk/src/valarray.cpp (original)
+++ libcxx/trunk/src/valarray.cpp Thu Apr 25 14:31:58 2019
@@ -10,8 +10,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// These two symbols are part of the v1 ABI but not part of the >=v2 ABI.
+#if _LIBCPP_ABI_VERSION == 1
 template valarray<size_t>::valarray(size_t);
 template valarray<size_t>::~valarray();
+#endif
+
 template void valarray<size_t>::resize(size_t, size_t);
 
 void




More information about the libcxx-commits mailing list