{
}
+ /* The move constructor exists so that we can mark it "noexcept",
+ which is a good practice for any sort of exception object. */
+ explicit gdb_exception (gdb_exception &&other) noexcept = default;
+
/* The copy constructor exists so that we can mark it "noexcept",
which is a good practice for any sort of exception object. */
gdb_exception (const gdb_exception &other) noexcept
return *this;
}
+ gdb_exception &operator= (gdb_exception &&other) noexcept = default;
+
/* Return the contents of the exception message, as a C string. The
string remains owned by the exception object. */
const char *what () const noexcept
{
}
- explicit gdb_exception_error (const gdb_exception &ex) noexcept
- : gdb_exception (ex)
+ explicit gdb_exception_error (gdb_exception &&ex) noexcept
+ : gdb_exception (std::move (ex))
{
gdb_assert (ex.reason == RETURN_ERROR);
}
{
}
- explicit gdb_exception_quit (const gdb_exception &ex) noexcept
- : gdb_exception (ex)
+ explicit gdb_exception_quit (gdb_exception &&ex) noexcept
+ : gdb_exception (std::move (ex))
{
gdb_assert (ex.reason == RETURN_QUIT);
}
: public gdb_exception_quit,
public std::bad_alloc
{
- explicit gdb_quit_bad_alloc (const gdb_exception &ex) noexcept
- : gdb_exception_quit (ex),
+ explicit gdb_quit_bad_alloc (gdb_exception &&ex) noexcept
+ : gdb_exception_quit (std::move (ex)),
std::bad_alloc ()
{
}
/* Throw an exception (as described by "struct gdb_exception"),
landing in the inner most containing exception handler established
using TRY/CATCH. */
-extern void throw_exception (const gdb_exception &exception)
+extern void throw_exception (gdb_exception &&exception)
ATTRIBUTE_NORETURN;
/* Throw an exception by executing a LONG JUMP to the inner most
containing exception handler established using TRY_SJLJ. Necessary
in some cases where we need to throw GDB exceptions across
third-party library code (e.g., readline). */
-extern void throw_exception_sjlj (struct gdb_exception exception)
+extern void throw_exception_sjlj (const struct gdb_exception &exception)
ATTRIBUTE_NORETURN;
/* Convenience wrappers around throw_exception that throw GDB