aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-04-06 13:50:37 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-04-07 20:32:18 +0200
commitc1bbe9503679ea23db8e874a0d2e2a53d1df5ffd (patch)
tree754ff279af1a336e1193feb882d340f76703d682
parent89180881559f89dc1c932794348b3e9f36986638 (diff)
shiboken6: Add a debug operator for the class context
Pick-to: 6.2 Change-Id: I3e5a7b413da3f8dd84a35e2029f23d2d2dae910c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/shiboken6/generator/generator.cpp17
-rw-r--r--sources/shiboken6/generator/generator.h4
2 files changed, 21 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/generator.cpp b/sources/shiboken6/generator/generator.cpp
index 59b25a688..e02a73a18 100644
--- a/sources/shiboken6/generator/generator.cpp
+++ b/sources/shiboken6/generator/generator.cpp
@@ -162,6 +162,23 @@ QDebug operator<<(QDebug debug, const DefaultValue &v)
debug << "DefaultValue(" << v.type() << ", \"" << v.value() << "\")";
return debug;
}
+
+QDebug operator<<(QDebug debug, const GeneratorContext &c)
+{
+ QDebugStateSaver saver(debug);
+ debug.noquote();
+ debug.nospace();
+ debug << "GeneratorContext(\"" << c.metaClass()->name() << "\" ";
+ if (c.useWrapper())
+ debug << "[wrapper]";
+ else if (c.forSmartPointer())
+ debug << "[smart pointer] \"" << c.preciseType().cppSignature() << '"';
+ else
+ debug << "[class]";
+ debug << ')';
+ return debug;
+}
+
#endif // !QT_NO_DEBUG_STREAM
QString GeneratorContext::smartPointerWrapperName() const
diff --git a/sources/shiboken6/generator/generator.h b/sources/shiboken6/generator/generator.h
index 864f0b7ea..02f48c74f 100644
--- a/sources/shiboken6/generator/generator.h
+++ b/sources/shiboken6/generator/generator.h
@@ -175,6 +175,10 @@ private:
Type m_type = Class;
};
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const GeneratorContext &c);
+#endif
+
/**
* Base class for all generators. The default implementations does nothing,
* you must subclass this to create your own generators.