diff options
author | 2016-09-03 18:39:32 +0000 | |
---|---|---|
committer | 2016-09-03 18:39:32 +0000 | |
commit | fe1ccca2776129541f1c4f645e4d1de89a22a031 (patch) | |
tree | 8e4fd7a09a5a15a9498fd2d88dcddbd40e999c79 /lib/libcxx/src/stdexcept.cpp | |
parent | Fixed missing null check in switchctl.c (diff) | |
download | wireguard-openbsd-fe1ccca2776129541f1c4f645e4d1de89a22a031.tar.xz wireguard-openbsd-fe1ccca2776129541f1c4f645e4d1de89a22a031.zip |
Import libc++ 3.9.0
Diffstat (limited to 'lib/libcxx/src/stdexcept.cpp')
-rw-r--r-- | lib/libcxx/src/stdexcept.cpp | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/lib/libcxx/src/stdexcept.cpp b/lib/libcxx/src/stdexcept.cpp new file mode 100644 index 00000000000..0a08bfec27e --- /dev/null +++ b/lib/libcxx/src/stdexcept.cpp @@ -0,0 +1,102 @@ +//===------------------------ stdexcept.cpp -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "__refstring" +#include "stdexcept" +#include "new" +#include "string" +#include "system_error" + +/* For _LIBCPPABI_VERSION */ +#if defined(LIBCXX_BUILDING_LIBCXXABI) || defined(__APPLE__) || defined(LIBCXXRT) +#include <cxxabi.h> +#endif + +static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char *), ""); + +namespace std // purposefully not using versioning namespace +{ + +logic_error::logic_error(const string& msg) : __imp_(msg.c_str()) +{ +} + +logic_error::logic_error(const char* msg) : __imp_(msg) +{ +} + +logic_error::logic_error(const logic_error& le) _NOEXCEPT : __imp_(le.__imp_) +{ +} + +logic_error& +logic_error::operator=(const logic_error& le) _NOEXCEPT +{ + __imp_ = le.__imp_; + 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()) +{ +} + +runtime_error::runtime_error(const char* msg) : __imp_(msg) +{ +} + +runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT + : __imp_(le.__imp_) +{ +} + +runtime_error& +runtime_error::operator=(const runtime_error& le) _NOEXCEPT +{ + __imp_ = le.__imp_; + return *this; +} + +#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX) + +runtime_error::~runtime_error() _NOEXCEPT +{ +} + +const char* +runtime_error::what() const _NOEXCEPT +{ + return __imp_.c_str(); +} + +domain_error::~domain_error() _NOEXCEPT {} +invalid_argument::~invalid_argument() _NOEXCEPT {} +length_error::~length_error() _NOEXCEPT {} +out_of_range::~out_of_range() _NOEXCEPT {} + +range_error::~range_error() _NOEXCEPT {} +overflow_error::~overflow_error() _NOEXCEPT {} +underflow_error::~underflow_error() _NOEXCEPT {} + +#endif + +} // std |