Q(Unhandled)Exception: declare dtor out-of-line

De-duplicates vtables and enables RTTI on this hierarchy.

This is esp. important for exception classes, as RTTI is used
to select the catch clause to handle the exception in-flight.

The issue is made a bit complicated by the fact that the
exception specification changed from C++98 to 11 and that C++98
clients require the empty throw() specification while we don't
want to introduce warnings for C++11 users.

Let's hope no compiler includes throw specs into the mangled
names.

Task-number: QTBUG-45582
Change-Id: If086c8c38fccdc2c9c7e2aa7a492192cc1f86a6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2015-05-26 22:16:25 +02:00
parent b1a0cf72f8
commit 2fa7b3b317
2 changed files with 20 additions and 0 deletions

View File

@ -107,6 +107,11 @@ QT_BEGIN_NAMESPACE
\internal \internal
*/ */
QException::~QException()
{
// must stay empty until ### Qt 6
}
void QException::raise() const void QException::raise() const
{ {
QException e = *this; QException e = *this;
@ -118,6 +123,11 @@ QException *QException::clone() const
return new QException(*this); return new QException(*this);
} }
QUnhandledException::~QUnhandledException()
{
// must stay empty until ### Qt 6
}
void QUnhandledException::raise() const void QUnhandledException::raise() const
{ {
QUnhandledException e = *this; QUnhandledException e = *this;

View File

@ -53,6 +53,11 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QException : public std::exception class Q_CORE_EXPORT QException : public std::exception
{ {
public: public:
~QException()
#ifndef Q_COMPILER_NOEXCEPT
throw()
#endif
;
virtual void raise() const; virtual void raise() const;
virtual QException *clone() const; virtual QException *clone() const;
}; };
@ -60,6 +65,11 @@ public:
class Q_CORE_EXPORT QUnhandledException : public QException class Q_CORE_EXPORT QUnhandledException : public QException
{ {
public: public:
~QUnhandledException()
#ifndef Q_COMPILER_NOEXCEPT
throw()
#endif
;
void raise() const Q_DECL_OVERRIDE; void raise() const Q_DECL_OVERRIDE;
QUnhandledException *clone() const Q_DECL_OVERRIDE; QUnhandledException *clone() const Q_DECL_OVERRIDE;
}; };