aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-03 11:48:15 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-04 19:20:56 +0000
commit67e112826557421d3494e9d8e53fcd951f0a360f (patch)
treef89cef896042174fac6f68fafec4b903b526caab
parent929fd882f4c05adfeb74a3a3bf77321ab5c3f0af (diff)
Further improve debug output
Output accessibility and template parameters of functions. Add verbose output to TypeInfo. Fix a type in 77eefb7a42c4a96f69ac4f5af464ea3520ae4de7. Task-number: PYSIDE-323 Change-Id: Ia2eba89c35b1d2a9d41070784a9c49a88254a5c2 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--ApiExtractor/parser/codemodel.cpp79
-rw-r--r--ApiExtractor/parser/codemodel.h4
2 files changed, 71 insertions, 12 deletions
diff --git a/ApiExtractor/parser/codemodel.cpp b/ApiExtractor/parser/codemodel.cpp
index 87cb6bd..a1142fb 100644
--- a/ApiExtractor/parser/codemodel.cpp
+++ b/ApiExtractor/parser/codemodel.cpp
@@ -251,12 +251,65 @@ bool TypeInfo::operator==(const TypeInfo &other)
}
#ifndef QT_NO_DEBUG_STREAM
+template <class It>
+void formatSequence(QDebug &d, It i1, It i2, const char *separator=", ")
+{
+ for (It i = i1; i != i2; ++i) {
+ if (i != i1)
+ d << separator;
+ d << *i;
+ }
+}
+
+void TypeInfo::formatDebug(QDebug &d) const
+{
+ d << '"';
+ formatSequence(d, m_qualifiedName.begin(), m_qualifiedName.end(), "\", \"");
+ d << '"';
+ if (m_constant)
+ d << ", [const]";
+ if (m_volatile)
+ d << ", [volatile]";
+ if (m_indirections)
+ d << ", indirections=" << m_indirections;
+ switch (m_referenceType) {
+ case NoReference:
+ break;
+ case LValueReference:
+ d << ", [ref]";
+ break;
+ case RValueReference:
+ d << ", [rvalref]";
+ break;
+ }
+ if (m_functionPointer) {
+ d << ", function ptr(";
+ formatSequence(d, m_arguments.begin(), m_arguments.end());
+ d << ')';
+ }
+ if (!m_arrayElements.isEmpty()) {
+ d << ", array[" << m_arrayElements.size() << "][";
+ formatSequence(d, m_arrayElements.begin(), m_arrayElements.end());
+ d << ']';
+ }
+}
+
QDebug operator<<(QDebug d, const TypeInfo &t)
{
QDebugStateSaver s(d);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ const int verbosity = d.verbosity();
+#else
+ const int verbosity = 0;
+#endif
d.noquote();
d.nospace();
- d << "TypeInfo(" << t.toString() << ')';
+ d << "TypeInfo(";
+ if (verbosity > 2)
+ t.formatDebug(d);
+ else
+ d << t.toString();
+ d << ')';
return d;
}
#endif // !QT_NO_DEBUG_STREAM
@@ -363,16 +416,6 @@ void _CodeModelItem::setEndPosition(int line, int column)
#ifndef QT_NO_DEBUG_STREAM
template <class It>
-void formatSequence(QDebug &d, It i1, It i2, const char *separator=", ")
-{
- for (It i = i1; i != i2; ++i) {
- if (i != i1)
- d << separator;
- d << *i;
- }
-}
-
-template <class It>
static void formatPtrSequence(QDebug &d, It i1, It i2, const char *separator=", ")
{
for (It i = i1; i != i2; ++i) {
@@ -413,7 +456,7 @@ void _CodeModelItem::formatKind(QDebug &d, int k)
d << "NamespaceModelItem";
break;
case Kind_Variable:
- d << "ScopeModelItem";
+ d << "VariableModelItem";
break;
case Kind_Scope:
d << "ScopeModelItem";
@@ -1144,7 +1187,19 @@ void _MemberModelItem::setMutable(bool isMutable)
void _MemberModelItem::formatDebug(QDebug &d) const
{
_CodeModelItem::formatDebug(d);
+ switch (m_accessPolicy) {
+ case CodeModel::Public:
+ d << ", public";
+ break;
+ case CodeModel::Protected:
+ d << ", protected";
+ break;
+ case CodeModel::Private:
+ d << ", private";
+ break;
+ }
d << ", type=" << m_type;
+ formatScopeList(d, ", templateParameters", m_templateParameters);
}
#endif // !QT_NO_DEBUG_STREAM
diff --git a/ApiExtractor/parser/codemodel.h b/ApiExtractor/parser/codemodel.h
index 8350349..d32bdd1 100644
--- a/ApiExtractor/parser/codemodel.h
+++ b/ApiExtractor/parser/codemodel.h
@@ -184,6 +184,10 @@ public:
static TypeInfo combine(const TypeInfo &__lhs, const TypeInfo &__rhs);
static TypeInfo resolveType(TypeInfo const &__type, CodeModelItem __scope);
+#ifndef QT_NO_DEBUG_STREAM
+ void formatDebug(QDebug &d) const;
+#endif
+
private:
static TypeInfo resolveType(CodeModelItem item, TypeInfo const &__type, CodeModelItem __scope);