Mark more classes & structs as Q_MOVABLE_TYPE/Q_PRIMITIVE_TYPE

Summary:
Classes and structs used in Qt containers can get optimized handling if their
typeinfo is known. This patch adds the typeinfo to many types which are used
in Qt containers and where I understood the member types.

Test Plan:
No issues seen in two days usage.
Tests run as before.

Reviewers: #kdevelop, kfunk

Reviewed By: #kdevelop, kfunk

Subscribers: kfunk, mwolff, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D9159
parent 9b140d2b
......@@ -102,6 +102,8 @@ public:
KTextEditor::Cursor cursor;
};
Q_DECLARE_TYPEINFO(UrlInfo, Q_MOVABLE_TYPE);
QDataStream& operator<<(QDataStream& stream, const UrlInfo& info)
{
stream << info.url;
......
......@@ -99,4 +99,6 @@ private:
}
Q_DECLARE_TYPEINFO(KDevelop::FrameStackModel::ThreadItem, Q_MOVABLE_TYPE);
#endif
......@@ -93,4 +93,6 @@ private:
}
Q_DECLARE_TYPEINFO(KDevelop::IFrameStackModel::FrameItem, Q_MOVABLE_TYPE);
#endif
......@@ -107,4 +107,6 @@ private:
}
Q_DECLARE_TYPEINFO(KDevelop::ContextMenuExtension, Q_MOVABLE_TYPE);
#endif
......@@ -226,6 +226,8 @@ class KDEVPLATFORMINTERFACES_EXPORT ISourceFormatter
Q_DECLARE_INTERFACE(KDevelop::ISourceFormatter, "org.kdevelop.ISourceFormatter")
Q_DECLARE_TYPEINFO(KDevelop::SourceFormatterStyle::MimeHighlightPair, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(KDevelop::SourceFormatterStyle, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(KDevelop::SourceFormatterStyleItem, Q_MOVABLE_TYPE);
#endif // KDEVPLATFORM_ISOURCEFORMATTER_H
// kate: indent-mode cstyle; space-indent off; tab-width 4;
......@@ -460,6 +460,7 @@ inline uint qHash(const IndexedQualifiedIdentifier& id)
}
Q_DECLARE_TYPEINFO(KDevelop::IndexedTypeIdentifier, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(KDevelop::IndexedQualifiedIdentifier, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(KDevelop::IndexedIdentifier, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(KDevelop::IndexedQualifiedIdentifier)
......
......@@ -142,5 +142,6 @@ inline uint qHash(const IndexedTopDUContext& ctx)
}
Q_DECLARE_METATYPE(KDevelop::IndexedTopDUContext)
Q_DECLARE_TYPEINFO(KDevelop::IndexedTopDUContext, Q_MOVABLE_TYPE);
#endif // KDEVPLATFORM_INDEXEDTOPDUCONTEXT_H
......@@ -69,4 +69,6 @@ struct NavigationAction {
}
Q_DECLARE_TYPEINFO(KDevelop::NavigationAction, Q_MOVABLE_TYPE);
#endif
......@@ -371,6 +371,8 @@ inline uint qHash(const ReferencedTopDUContext& ctx) {
}
}
Q_DECLARE_TYPEINFO(KDevelop::ReferencedTopDUContext, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(KDevelop::ReferencedTopDUContext)
#endif // KDEVPLATFORM_TOPDUCONTEXT_H
......@@ -182,5 +182,6 @@ class TopDUContextDynamicData {
}
Q_DECLARE_TYPEINFO(KDevelop::TopDUContextDynamicData::ItemDataInfo, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(KDevelop::TopDUContextDynamicData::ArrayWithPosition, Q_MOVABLE_TYPE);
#endif
......@@ -54,6 +54,7 @@ public:
};
}
Q_DECLARE_TYPEINFO(KDevelop::DocumentRange, Q_MOVABLE_TYPE);
namespace QTest {
template<>
......
......@@ -29,9 +29,9 @@
/// @todo Listen to filesystem changes (together with the project manager)
/// and call fileModificationCache().clear(...) when a file has changed
namespace KDevelop {
using namespace KDevelop;
const int cacheModificationTimesForSeconds = 30;
const int KDevelop::cacheModificationTimesForSeconds = 30;
QMutex fileModificationTimeCacheMutex(QMutex::Recursive);
......@@ -40,6 +40,7 @@ struct FileModificationCache
QDateTime m_readTime;
QDateTime m_modificationTime;
};
Q_DECLARE_TYPEINFO(FileModificationCache, Q_MOVABLE_TYPE);
typedef QHash<KDevelop::IndexedString, FileModificationCache> FileModificationMap;
......@@ -141,6 +142,3 @@ QString ModificationRevision::toString() const
{
return QStringLiteral("%1 (rev %2)").arg(QDateTime::fromTime_t(modificationTime).time().toString()).arg(revision);
}
}
......@@ -215,6 +215,8 @@ class KDEVPLATFORMLANGUAGE_EXPORT CodeHighlighting : public QObject, public KDev
}
Q_DECLARE_TYPEINFO(KDevelop::HighlightedRange, Q_MOVABLE_TYPE);
#endif
// kate: space-indent on; indent-width 2; remove-trailing-spaces all; show-tabs on; tab-indents on; tab-width 2;
......@@ -89,6 +89,8 @@ private:
}
Q_DECLARE_TYPEINFO(KDevelop::BuildItem, Q_MOVABLE_TYPE);
#endif
//kate: space-indent on; indent-width 4; replace-tabs on; auto-insert-doxygen on; indent-mode cstyle;
......@@ -70,11 +70,10 @@ Boston, MA 02110-1301, USA.
#define EMPTY_DOCUMENT_URL i18n("Untitled")
namespace KDevelop
{
using namespace KDevelop;
class DocumentControllerPrivate
class KDevelop::DocumentControllerPrivate
{
public:
struct OpenFileResult
......@@ -556,6 +555,7 @@ public:
KRecentFilesAction* fileOpenRecent;
KTextEditor::Document* globalTextEditorInstance;
};
Q_DECLARE_TYPEINFO(KDevelop::DocumentControllerPrivate::HistoryEntry, Q_MOVABLE_TYPE);
DocumentController::DocumentController( QObject *parent )
: IDocumentController( parent )
......@@ -1229,6 +1229,4 @@ void DocumentController::vcsAnnotateCurrentDocument()
}
}
}
#include "moc_documentcontroller.cpp"
......@@ -47,4 +47,6 @@ private:
}
Q_DECLARE_TYPEINFO(ProjectFileChoice, Q_MOVABLE_TYPE);
#endif
......@@ -83,6 +83,7 @@ private:
}
Q_DECLARE_METATYPE( KDevelop::Session* )
Q_DECLARE_TYPEINFO(KDevelop::SessionInfo, Q_MOVABLE_TYPE);
#endif
......@@ -73,3 +73,4 @@ inline AutoFlushingQTextStream& qStdOut()
}
Q_DECLARE_TYPEINFO(KDevelop::KDevFormatLine, Q_MOVABLE_TYPE);
......@@ -40,6 +40,8 @@ struct Import
KDevelop::CursorInRevision location;
};
Q_DECLARE_TYPEINFO(Import, Q_MOVABLE_TYPE);
using Imports = QMultiHash<CXFile, Import>;
using IncludeFileContexts = QHash<CXFile, KDevelop::ReferencedTopDUContext>;
......
......@@ -46,6 +46,7 @@ struct KDEVCLANGPRIVATE_EXPORT ClangFixit
&& currentText == other.currentText;
}
};
Q_DECLARE_TYPEINFO(ClangFixit, Q_MOVABLE_TYPE);
namespace QTest {
template<>
......
......@@ -151,6 +151,8 @@ private:
}
Q_DECLARE_TYPEINFO(CommentTodoParser::Result, Q_MOVABLE_TYPE);
TodoExtractor::TodoExtractor(CXTranslationUnit unit, CXFile file)
: m_unit(unit)
, m_file(file)
......
......@@ -38,6 +38,7 @@ struct CustomBuildSystemTool
};
Q_DECLARE_METATYPE( CustomBuildSystemTool )
Q_DECLARE_TYPEINFO(CustomBuildSystemTool, Q_MOVABLE_TYPE);
struct CustomBuildSystemConfig
{
......@@ -57,4 +58,6 @@ struct CustomBuildSystemConfig
}
};
Q_DECLARE_TYPEINFO(CustomBuildSystemConfig, Q_MOVABLE_TYPE);
#endif
......@@ -62,6 +62,7 @@ public:
};
Q_DECLARE_METATYPE(ParserArguments);
Q_DECLARE_TYPEINFO(ParserArguments, Q_MOVABLE_TYPE);
struct ConfigEntry
{
......@@ -76,6 +77,7 @@ struct ConfigEntry
// FIXME: get rid of this but stay backwards compatible
void setDefines(const QHash<QString, QVariant>& defines);
};
Q_DECLARE_TYPEINFO(ConfigEntry, Q_MOVABLE_TYPE);
namespace Utils
{
......
......@@ -146,4 +146,6 @@ inline FileSymbol::~FileSymbol()
} // end of MI
} // end of KDevMI
Q_DECLARE_TYPEINFO(KDevMI::MI::Token, Q_PRIMITIVE_TYPE);
#endif
......@@ -63,6 +63,8 @@ private:
} // end of namespace KDevMI
Q_DECLARE_TYPEINFO(KDevMI::Model, Q_MOVABLE_TYPE);
using namespace KDevMI;
ModelsManager::ModelsManager(QObject* parent) : QObject(parent), m_models(new Models), m_controller(nullptr), m_config(KSharedConfig::openConfig()->group("Register models")) {}
......
......@@ -53,6 +53,9 @@ struct GrepJobSettings
QString searchPaths;
};
Q_DECLARE_TYPEINFO(GrepJobSettings, Q_MOVABLE_TYPE);
class GrepJob : public KJob, public KDevelop::IStatus
{
Q_OBJECT
......
......@@ -50,6 +50,9 @@ struct SupportedProperty {
QString classContains;
};
Q_DECLARE_TYPEINFO(SupportedProperty, Q_MOVABLE_TYPE);
// This class is responsible for creating the property widgets for editing QML properties
// with e.g. sliders. It knows which properties are supported, and creates a widget from
// a QML file for each supported property when requested. For the actual implementations
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment