[libcxx-commits] [libcxx] r352646 - [libc++] Don't define exception destructors when using vcruntime

Thomas Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 30 11:07:30 PST 2019


Author: thomasanderson
Date: Wed Jan 30 11:07:30 2019
New Revision: 352646

URL: http://llvm.org/viewvc/llvm-project?rev=352646&view=rev
Log:
[libc++] Don't define exception destructors when using vcruntime

Exception destructors are provided by vcruntime.  Fixes link errors like:

    lld-link: error: duplicate symbol: "public: virtual __cdecl std::invalid_argument::~invalid_argument(void)" (??1invalid_argument at std@@UEAA at XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::length_error::~length_error(void)" (??1length_error at std@@UEAA at XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::out_of_range::~out_of_range(void)" (??1out_of_range at std@@UEAA at XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::overflow_error::~overflow_error(void)" (??1overflow_error at std@@UEAA at XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)

Differential Revision: https://reviews.llvm.org/D57425

Modified:
    libcxx/trunk/src/stdexcept.cpp

Modified: libcxx/trunk/src/stdexcept.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/stdexcept.cpp?rev=352646&r1=352645&r2=352646&view=diff
==============================================================================
--- libcxx/trunk/src/stdexcept.cpp (original)
+++ libcxx/trunk/src/stdexcept.cpp Wed Jan 30 11:07:30 2019
@@ -43,20 +43,6 @@ logic_error::operator=(const logic_error
     return *this;
 }
 
-#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
-
-logic_error::~logic_error() _NOEXCEPT
-{
-}
-
-const char*
-logic_error::what() const _NOEXCEPT
-{
-    return __imp_.c_str();
-}
-
-#endif
-
 runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str())
 {
 }
@@ -79,8 +65,10 @@ runtime_error::operator=(const runtime_e
 
 #if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
 
-runtime_error::~runtime_error() _NOEXCEPT
+const char*
+logic_error::what() const _NOEXCEPT
 {
+    return __imp_.c_str();
 }
 
 const char*
@@ -89,15 +77,20 @@ runtime_error::what() const _NOEXCEPT
     return __imp_.c_str();
 }
 
+#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
+
+logic_error::~logic_error() _NOEXCEPT {}
 domain_error::~domain_error() _NOEXCEPT {}
 invalid_argument::~invalid_argument() _NOEXCEPT {}
 length_error::~length_error() _NOEXCEPT {}
 out_of_range::~out_of_range() _NOEXCEPT {}
 
+runtime_error::~runtime_error() _NOEXCEPT {}
 range_error::~range_error() _NOEXCEPT {}
 overflow_error::~overflow_error() _NOEXCEPT {}
 underflow_error::~underflow_error() _NOEXCEPT {}
 
 #endif
+#endif
 
 }  // std




More information about the libcxx-commits mailing list