diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-01-12 09:12:16 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-13 16:57:33 +0000 |
commit | 77946eb78c9ad97d7f6834dba7537d483636fd7e (patch) | |
tree | 27cde0a6680c62d1b121c07c1dd9fdc000c83c3d | |
parent | 85f5bc5859b011cec1b6df56ac2fa09f1f06a26f (diff) |
shiboken6: Fix debug operators for code snips
Declare the operator and output conversion rules of argument
modifications.
Output code snip fragments and template names.
Task-number: PYSIDE-1766
Change-Id: I56de33a2a56eee2fa357c5dda89cc391c99b76f9
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit f01e3e2bcc78222144c0279a8bfac274f8054d2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/shiboken6/ApiExtractor/modifications.cpp | 33 | ||||
-rw-r--r-- | sources/shiboken6/ApiExtractor/modifications.h | 3 |
2 files changed, 27 insertions, 9 deletions
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp index 8c6f31187..a1c8eabbc 100644 --- a/sources/shiboken6/ApiExtractor/modifications.cpp +++ b/sources/shiboken6/ApiExtractor/modifications.cpp @@ -428,17 +428,29 @@ QDebug operator<<(QDebug d, const CodeSnip &s) QDebugStateSaver saver(d); d.noquote(); d.nospace(); - d << "CodeSnip(language=" << s.language << ", position=" << s.position << ", \""; - for (const auto &f : s.codeList) { - const QString &code = f.code(); - const auto lines = QStringView{code}.split(QLatin1Char('\n')); - for (int i = 0, size = lines.size(); i < size; ++i) { - if (i) - d << "\\n"; - d << lines.at(i).trimmed(); + const auto size = s.codeList.size(); + d << "CodeSnip(language=" << s.language << ", position=" << s.position + << ", fragments[" << size << "]="; + for (qsizetype i = 0; i < size; ++i) { + const auto &f = s.codeList.at(i); + if (i) + d << ", "; + d << '#' << i << ' '; + if (f.instance().isNull()) { + d << '"'; + const QString &code = f.code(); + const auto lines = QStringView{code}.split(QLatin1Char('\n')); + for (int i = 0, size = lines.size(); i < size; ++i) { + if (i) + d << "\\n"; + d << lines.at(i).trimmed(); + } + d << '"'; + } else { + d << "template=\"" << f.instance()->name() << '"'; } } - d << "\")"; + d << ')'; return d; } @@ -906,6 +918,9 @@ QDebug operator<<(QDebug d, const ArgumentModification &a) d << ", native ownership=" << a.nativeOwnership(); if (!a.renamedToName().isEmpty()) d << ", renamed_to=\"" << a.renamedToName() << '"'; + const auto &rules = a.conversionRules(); + if (!rules.isEmpty()) + d << ", conversionRules[" << rules.size() << "]=" << rules; d << ", owner=" << a.owner() << ')'; return d; } diff --git a/sources/shiboken6/ApiExtractor/modifications.h b/sources/shiboken6/ApiExtractor/modifications.h index c8c8579df..3435c9737 100644 --- a/sources/shiboken6/ApiExtractor/modifications.h +++ b/sources/shiboken6/ApiExtractor/modifications.h @@ -118,6 +118,8 @@ public: QString code() const; + TemplateInstancePtr instance() const { return m_instance; } + private: QString m_code; QSharedPointer<TemplateInstance> m_instance; @@ -373,6 +375,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(FunctionModification::Modifiers) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const ReferenceCount &); +QDebug operator<<(QDebug d, const CodeSnip &s); QDebug operator<<(QDebug d, const ArgumentOwner &a); QDebug operator<<(QDebug d, const ArgumentModification &a); QDebug operator<<(QDebug d, const FunctionModification &fm); |