diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-20 12:30:47 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-21 10:03:20 +0000 |
commit | b461e45a8e3b6f80f9e6a3b4505867ece6799355 (patch) | |
tree | 39989795d1d6d8474a444648258cddb3fe839d08 /sources/shiboken2/generator | |
parent | 5e4e428210742d252fe73e46e4c3393375173e0c (diff) |
DocParser: Add helper function to create list of documentable functions
Move code from shouldSkip() helper of the doc generator
into the doc parser and use that for the qdoc/doxygen parsers.
The additional checks (most importantly the check for
declaringClass != ownerClass excluding the virtual functions
added by AbstractMetaClass::fixFunctions() to derived classes)
avoid running unneeded XPATH queries.
Task-number: PYSIDE-363
Change-Id: Ib1141a348c96b269a50c63dd94fe93931c12d1ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r-- | sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index f33cebfae..76dac2683 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -47,37 +47,36 @@ static Indentor INDENT; static bool shouldSkip(const AbstractMetaFunction* func) { - bool skipable = func->isConstructor() - || func->isModifiedRemoved() - || func->declaringClass() != func->ownerClass() - || func->isCastOperator() - || func->name() == QLatin1String("operator="); - - // Search a const clone - if (!skipable && !func->isConstant()) { - const AbstractMetaArgumentList funcArgs = func->arguments(); - const AbstractMetaFunctionList &ownerFunctions = func->ownerClass()->functions(); - for (AbstractMetaFunction *f : ownerFunctions) { - if (f != func - && f->isConstant() - && f->name() == func->name() - && f->arguments().count() == funcArgs.count()) { - // Compare each argument - bool cloneFound = true; - - const AbstractMetaArgumentList fargs = f->arguments(); - for (int i = 0, max = funcArgs.count(); i < max; ++i) { - if (funcArgs.at(i)->type()->typeEntry() != fargs.at(i)->type()->typeEntry()) { - cloneFound = false; - break; - } + // Constructors go to separate section + if (DocParser::skipForQuery(func) || func->isConstructor()) + return true; + + // Search a const clone (QImage::bits() vs QImage::bits() const) + if (func->isConstant()) + return false; + + const AbstractMetaArgumentList funcArgs = func->arguments(); + const AbstractMetaFunctionList &ownerFunctions = func->ownerClass()->functions(); + for (AbstractMetaFunction *f : ownerFunctions) { + if (f != func + && f->isConstant() + && f->name() == func->name() + && f->arguments().count() == funcArgs.count()) { + // Compare each argument + bool cloneFound = true; + + const AbstractMetaArgumentList fargs = f->arguments(); + for (int i = 0, max = funcArgs.count(); i < max; ++i) { + if (funcArgs.at(i)->type()->typeEntry() != fargs.at(i)->type()->typeEntry()) { + cloneFound = false; + break; } - if (cloneFound) - return true; } + if (cloneFound) + return true; } } - return skipable; + return false; } static bool functionSort(const AbstractMetaFunction* func1, const AbstractMetaFunction* func2) |