Exceptions store the message as reference counted string for

compatibility to libstdc++. Move the implementation into a header for
easier sharing with libc++abi. Merge a number of improvements from that
version. Provide a POD definition for <stdexcept>'s public use to avoid
cast dances. Discussed with Marshall Clow.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@207695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger
2014-04-30 19:54:11 +00:00
parent 5f64a2b3c3
commit 55622073f4
3 changed files with 163 additions and 112 deletions

View File

@@ -50,6 +50,14 @@ public:
#pragma GCC system_header
#endif
#ifndef _LIBCPP___REFSTRING
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_HIDDEN __libcpp_refstring {
const char *__imp_;
};
_LIBCPP_END_NAMESPACE_STD
#endif
namespace std // purposefully not using versioning namespace
{
@@ -57,7 +65,7 @@ class _LIBCPP_EXCEPTION_ABI logic_error
: public exception
{
private:
void* __imp_;
_VSTD::__libcpp_refstring __imp_;
public:
explicit logic_error(const string&);
explicit logic_error(const char*);
@@ -74,7 +82,7 @@ class _LIBCPP_EXCEPTION_ABI runtime_error
: public exception
{
private:
void* __imp_;
_VSTD::__libcpp_refstring __imp_;
public:
explicit runtime_error(const string&);
explicit runtime_error(const char*);