aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-21 13:32:06 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-21 14:12:41 +0000
commita049a84ec038d6f87bed5164360c97920e62fe5a (patch)
tree5581b6ead810e34391a7b3a244ced149daa1113f
parentbc557a80b41cca2d0391b14f6c18dfcb875f3e4b (diff)
Improve debug output of type database
Also output includes and templates. Task-number: PYSIDE-323 Change-Id: I01ad264cb3b33327446a5f52647c3d00e86c5c72 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--ApiExtractor/include.cpp17
-rw-r--r--ApiExtractor/include.h3
-rw-r--r--ApiExtractor/typedatabase.cpp29
3 files changed, 46 insertions, 3 deletions
diff --git a/ApiExtractor/include.cpp b/ApiExtractor/include.cpp
index bf5f03b..deae2d2 100644
--- a/ApiExtractor/include.cpp
+++ b/ApiExtractor/include.cpp
@@ -27,6 +27,8 @@
****************************************************************************/
#include "include.h"
+#include <QDebug>
+#include <QDir>
#include <QTextStream>
#include <QHash>
@@ -52,3 +54,18 @@ QTextStream& operator<<(QTextStream& out, const Include& include)
return out;
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const Include &i)
+{
+ QDebugStateSaver saver(d);
+ d.noquote();
+ d.nospace();
+ d << "Include(";
+ if (i.isValid())
+ d << "type=" << i.type() << ", file=\"" << QDir::toNativeSeparators(i.name()) << '"';
+ else
+ d << "invalid";
+ d << ')';
+ return d;
+}
+#endif // !QT_NO_DEBUG_STREAM
diff --git a/ApiExtractor/include.h b/ApiExtractor/include.h
index 6c7cd4f..e4ff5b3 100644
--- a/ApiExtractor/include.h
+++ b/ApiExtractor/include.h
@@ -83,6 +83,9 @@ public:
uint qHash(const Include& inc);
QTextStream& operator<<(QTextStream& out, const Include& include);
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const Include &i);
+#endif
typedef QList<Include> IncludeList;
diff --git a/ApiExtractor/typedatabase.cpp b/ApiExtractor/typedatabase.cpp
index fc75953..7aea42a 100644
--- a/ApiExtractor/typedatabase.cpp
+++ b/ApiExtractor/typedatabase.cpp
@@ -572,6 +572,7 @@ bool TypeDatabase::checkApiVersion(const QString& package, const QByteArray& ver
void TypeDatabase::formatDebug(QDebug &d) const
{
typedef TypeEntryHash::ConstIterator Eit;
+ typedef TemplateEntryHash::ConstIterator TplIt;
d << "TypeDatabase("
<< "entries=";
for (Eit it = m_entries.cbegin(), end = m_entries.cend(); it != end; ++it) {
@@ -583,6 +584,16 @@ void TypeDatabase::formatDebug(QDebug &d) const
}
d << "]\n";
}
+ if (!m_templates.isEmpty()) {
+ d << "templates=[";
+ const TplIt begin = m_templates.cbegin();
+ for (TplIt it = begin, end = m_templates.cend(); it != end; ++it) {
+ if (it != begin)
+ d << ", ";
+ d << it.value();
+ }
+ d << "]\n";
+ }
d <<"\nglobalUserFunctions=" << m_globalUserFunctions << ')';
}
@@ -592,10 +603,22 @@ QDebug operator<<(QDebug d, const TypeEntry *te)
d.noquote();
d.nospace();
d << "TypeEntry(";
- if (te)
- d << te->qualifiedCppName() << ", type=" << te->type();
- else
+ if (te) {
+ d << '"' << te->qualifiedCppName() << "\", type=" << te->type();
+ if (te->include().isValid())
+ d << ", include=" << te->include();
+ const IncludeList &extraIncludes = te->extraIncludes();
+ if (const int count = extraIncludes.size()) {
+ d << ", extraIncludes[" << count << "]=";
+ for (int i = 0; i < count; ++i) {
+ if (i)
+ d << ", ";
+ d << extraIncludes.at(i);
+ }
+ }
+ } else {
d << '0';
+ }
d << ')';
return d;
}