diff options
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetalang.cpp | 20 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/typedatabase.cpp | 7 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/typeparser.cpp | 44 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/typeparser.h | 6 |
4 files changed, 74 insertions, 3 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index db0558a99..07bd14e55 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -301,10 +301,26 @@ QDebug operator<<(QDebug d, const AbstractMetaType *at) d.noquote(); d.nospace(); d << "AbstractMetaType("; - if (at) + if (at) { d << at->name(); - else + if (d.verbosity() > 2) { + d << ", typeEntry=" << at->typeEntry() << ", signature=\"" + << at->cppSignature() << "\", pattern=" + << at->typeUsagePattern(); + if (at->indirections()) + d << ", indirections=" << at->indirections(); + if (at->referenceType()) + d << ", reftype=" << at->referenceType(); + if (at->isConstant()) + d << ", [const]"; + if (at->isArray()) { + d << ", array of \"" << at->arrayElementType()->cppSignature() + << "\", arrayElementCount=" << at->arrayElementCount(); + } + } + } else { d << '0'; + } d << ')'; return d; } diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp index 76f8d0f77..8cd9eeb89 100644 --- a/sources/shiboken2/ApiExtractor/typedatabase.cpp +++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp @@ -684,7 +684,12 @@ QDebug operator<<(QDebug d, const TypeEntry *te) d.nospace(); d << "TypeEntry("; if (te) { - d << '"' << te->qualifiedCppName() << "\", type=" << te->type(); + const QString name = te->name(); + const QString cppName = te->qualifiedCppName(); + d << '"' << name << '"'; + if (name != cppName) + d << "\", cppName=\"" << cppName << '"'; + d << ", type=" << te->type(); if (te->include().isValid()) d << ", include=" << te->include(); const IncludeList &extraIncludes = te->extraIncludes(); diff --git a/sources/shiboken2/ApiExtractor/typeparser.cpp b/sources/shiboken2/ApiExtractor/typeparser.cpp index 8165bfe44..09439a210 100644 --- a/sources/shiboken2/ApiExtractor/typeparser.cpp +++ b/sources/shiboken2/ApiExtractor/typeparser.cpp @@ -316,3 +316,47 @@ QString TypeParser::Info::toString() const } return s; } + +#ifndef QT_NO_DEBUG_STREAM + +static void formatTypeInfo(QDebug &d, const TypeParser::Info &i) +{ + if (i.is_busted) { + d << "busted"; + return; + } + + d << '"' << i.qualified_name << '"'; + if (!i.arrays.isEmpty()) { + d << ", arrays="; + for (const QString &a : i.arrays) + d << '[' << a << ']'; + } + if (!i.template_instantiations.isEmpty()) { + d << ", template_instantiations=["; + for (int t = 0, size = i.template_instantiations.size(); t < size; ++t) { + if (t) + d << ", "; + formatTypeInfo(d, i.template_instantiations.at(t)); + } + d << ']'; + } + if (i.referenceType != NoReference) + d << ", refType=" << i.referenceType; + if (i.is_constant) + d << ", [const]"; + if (i.indirections > 0) + d << ", indirections=" << i.indirections; +} + +QDebug operator<<(QDebug d, const TypeParser::Info &i) +{ + QDebugStateSaver saver(d); + d.noquote(); + d.nospace(); + d << "TypeParser::Info("; + formatTypeInfo(d, i); + d << ')'; + return d; +} +#endif // !QT_NO_DEBUG_STREAM diff --git a/sources/shiboken2/ApiExtractor/typeparser.h b/sources/shiboken2/ApiExtractor/typeparser.h index f42c42a5e..568223656 100644 --- a/sources/shiboken2/ApiExtractor/typeparser.h +++ b/sources/shiboken2/ApiExtractor/typeparser.h @@ -36,6 +36,8 @@ #include <QtCore/QStringList> #include <QtCore/QVector> +QT_FORWARD_DECLARE_CLASS(QDebug) + class TypeParser { public: @@ -57,4 +59,8 @@ public: static Info parse(const QString &str, QString *errorMessage = Q_NULLPTR); }; +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug d, const TypeParser::Info &); +#endif + #endif // TYPEPARSER_H |