Debian Codegraph @

libcxx/src/support/runtime/stdexcept_default.ipp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "../../include/refstring.h"
10
11 /* For _LIBCPPABI_VERSION */
12 #if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
13 # include <cxxabi.h>
14 #endif
15
16 static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "");
17
18 namespace std // purposefully not using versioning namespace
19 {
20
21 logic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {}
22
23 logic_error::logic_error(const char* msg) : __imp_(msg) {}
24
25 logic_error::logic_error(const logic_error& le) noexcept : __imp_(le.__imp_) {}
26
27 logic_error& logic_error::operator=(const logic_error& le) noexcept {
28 __imp_ = le.__imp_;
29 return *this;
30 }
31
32 runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {}
33
34 runtime_error::runtime_error(const char* msg) : __imp_(msg) {}
35
36 runtime_error::runtime_error(const runtime_error& re) noexcept : __imp_(re.__imp_) {}
37
38 runtime_error& runtime_error::operator=(const runtime_error& re) noexcept {
39 __imp_ = re.__imp_;
40 return *this;
41 }
42
43 #if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
44
45 const char* logic_error::what() const noexcept { return __imp_.c_str(); }
46
47 const char* runtime_error::what() const noexcept { return __imp_.c_str(); }
48
49 logic_error::~logic_error() noexcept {}
50 domain_error::~domain_error() noexcept {}
51 invalid_argument::~invalid_argument() noexcept {}
52 length_error::~length_error() noexcept {}
53 out_of_range::~out_of_range() noexcept {}
54
55 runtime_error::~runtime_error() noexcept {}
56 range_error::~range_error() noexcept {}
57 overflow_error::~overflow_error() noexcept {}
58 underflow_error::~underflow_error() noexcept {}
59
60 #endif
61
62 } // namespace std