aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-14 10:51:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-17 12:22:27 +0000
commit853b637b02b07d502ddb5e84bcf60f6a8a58cf29 (patch)
tree1572e29be67998ef5be7bd77cf11f4b6ef723730 /sources/shiboken2/ApiExtractor/abstractmetalang.cpp
parent792be5e470107d6d2752fd78e3922427c313b67a (diff)
shiboken: Extend exception specification
Change boolean 'noexcept' flag into an enumeration that indicates whether a function throws, is 'noexcept' or the behavior is unknown. This makes it easier to implement an 'auto' mode for exception handling. Task-number: PYSIDE-62 Change-Id: I4e5405863e5af2a54f3528ba5eb5c51d3929703d Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index c6570059c..22c119c94 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -406,7 +406,6 @@ AbstractMetaFunction::AbstractMetaFunction()
m_reverse(false),
m_userAdded(false),
m_explicit(false),
- m_isNoExcept(false),
m_pointerOperator(false),
m_isCallOperator(false)
{
@@ -526,7 +525,7 @@ AbstractMetaFunction *AbstractMetaFunction::copy() const
if (type())
cpy->setType(type()->copy());
cpy->setConstant(isConstant());
- cpy->setNoExcept(isNoExcept());
+ cpy->setExceptionSpecification(m_exceptionSpecification);
for (AbstractMetaArgument *arg : m_arguments)
cpy->addArgument(arg->copy());
@@ -960,6 +959,16 @@ bool AbstractMetaFunction::isConversionOperator(const QString& funcName)
return opRegEx.match(funcName).hasMatch();
}
+ExceptionSpecification AbstractMetaFunction::exceptionSpecification() const
+{
+ return m_exceptionSpecification;
+}
+
+void AbstractMetaFunction::setExceptionSpecification(ExceptionSpecification e)
+{
+ m_exceptionSpecification = e;
+}
+
bool AbstractMetaFunction::isOperatorOverload(const QString& funcName)
{
if (isConversionOperator(funcName))
@@ -1133,7 +1142,18 @@ static inline void formatMetaFunctionBrief(QDebug &d, const AbstractMetaFunction
void AbstractMetaFunction::formatDebugVerbose(QDebug &d) const
{
- d << m_functionType << ' ' << m_type << ' ' << m_name << '(';
+ d << m_functionType << ' ' << m_type << ' ' << m_name;
+ switch (m_exceptionSpecification) {
+ case ExceptionSpecification::Unknown:
+ break;
+ case ExceptionSpecification::NoExcept:
+ d << " noexcept";
+ break;
+ case ExceptionSpecification::Throws:
+ d << " throw(...)";
+ break;
+ }
+ d << '(';
for (int i = 0, count = m_arguments.size(); i < count; ++i) {
if (i)
d << ", ";
@@ -1148,8 +1168,6 @@ void AbstractMetaFunction::formatDebugVerbose(QDebug &d) const
d << " [userAdded]";
if (m_explicit)
d << " [explicit]";
- if (m_isNoExcept)
- d << " [noexcept]";
if (m_pointerOperator)
d << " [operator->]";
if (m_isCallOperator)