diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-26 14:50:36 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-26 14:12:37 +0000 |
commit | 9e79fb9938781d78c71a2509e2648c79c91272c6 (patch) | |
tree | cbdc828c98bb17862b6bcf20afa1be2f077bafd1 /sources/shiboken2/ApiExtractor | |
parent | a6d12454983f8b1f2f8e7087de4b11ccd9126178 (diff) |
shiboken: Fix order of type indexes
Sort the classes, enumerations and global functions
alphabetically.
Task-number: PYSIDE-757
Change-Id: I65fd7058fa5dff6f5724915b142d68bd18dba4c7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index ee1b690b7..80a72277a 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -724,6 +724,15 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom) std::puts(""); } +static bool metaEnumLessThan(const AbstractMetaEnum *e1, const AbstractMetaEnum *e2) +{ return e1->fullName() < e2->fullName(); } + +static bool metaClassLessThan(const AbstractMetaClass *c1, const AbstractMetaClass *c2) +{ return c1->fullName() < c2->fullName(); } + +static bool metaFunctionLessThan(const AbstractMetaFunction *f1, const AbstractMetaFunction *f2) +{ return f1->name() < f2->name(); } + bool AbstractMetaBuilder::build(const QByteArrayList &arguments, LanguageLevel level, unsigned clangFlags) @@ -734,6 +743,14 @@ bool AbstractMetaBuilder::build(const QByteArrayList &arguments, if (ReportHandler::isDebug(ReportHandler::MediumDebug)) qCDebug(lcShiboken) << dom.data(); d->traverseDom(dom); + + // Ensure that indexes are in alphabetical order, roughly + std::sort(d->m_globalEnums.begin(), d->m_globalEnums.end(), metaEnumLessThan); + std::sort(d->m_metaClasses.begin(), d->m_metaClasses.end(), metaClassLessThan); + std::sort(d->m_templates.begin(), d->m_templates.end(), metaClassLessThan); + std::sort(d->m_smartPointers.begin(), d->m_smartPointers.end(), metaClassLessThan); + std::sort(d->m_globalFunctions.begin(), d->m_globalFunctions.end(), metaFunctionLessThan); + return true; } |