aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-22 13:57:00 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-22 13:10:59 +0000
commit002e68898c22211c8195d2b50752fbf479b482df (patch)
tree2e53a705fd974fe56bb5b0385b47fb6bd29066c8
parenta049a84ec038d6f87bed5164360c97920e62fe5a (diff)
AbstractMetaBuilderPrivate::traverseDom(): Fix crash
AbstractMetaBuilderPrivate::traverseOperatorFunction() would crash when encountering: class QTreeWidgetItemIterator { public: inline QTreeWidgetItem *operator*() const; since it expects operator* with arguments. Rewrite the code compiling the list of operators filtering out the ones without arguments. Task-number: PYSIDE-323 Change-Id: I16fb8a15f892d385713a7487f9d996d6488954b7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--ApiExtractor/abstractmetabuilder.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/ApiExtractor/abstractmetabuilder.cpp b/ApiExtractor/abstractmetabuilder.cpp
index 98c91f7ee..43c389045 100644
--- a/ApiExtractor/abstractmetabuilder.cpp
+++ b/ApiExtractor/abstractmetabuilder.cpp
@@ -653,20 +653,28 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
}
{
- FunctionList binaryOperators = dom->findFunctions(QLatin1String("operator=="))
- + dom->findFunctions(QLatin1String("operator!="))
- + dom->findFunctions(QLatin1String("operator<="))
- + dom->findFunctions(QLatin1String("operator>="))
- + dom->findFunctions(QLatin1String("operator<"))
- + dom->findFunctions(QLatin1String("operator+"))
- + dom->findFunctions(QLatin1String("operator/"))
- + dom->findFunctions(QLatin1String("operator*"))
- + dom->findFunctions(QLatin1String("operator-"))
- + dom->findFunctions(QLatin1String("operator&"))
- + dom->findFunctions(QLatin1String("operator|"))
- + dom->findFunctions(QLatin1String("operator^"))
- + dom->findFunctions(QLatin1String("operator~"))
- + dom->findFunctions(QLatin1String("operator>"));
+ FunctionList binaryOperators = dom->findFunctions(QStringLiteral("operator=="));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator!=")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator<=")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator>=")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator<")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator+")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator/")));
+ // Filter binary operators, skipping for example
+ // class Iterator { ... Value *operator*() ... };
+ const FunctionList potentiallyBinaryOperators =
+ dom->findFunctions(QStringLiteral("operator*"))
+ + dom->findFunctions(QStringLiteral("operator&"));
+ foreach (const FunctionModelItem &item, potentiallyBinaryOperators) {
+ if (!item->arguments().isEmpty())
+ binaryOperators.append(item);
+ }
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator-")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator&")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator|")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator^")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator~")));
+ binaryOperators.append(dom->findFunctions(QStringLiteral("operator>")));
foreach (const FunctionModelItem &item, binaryOperators)
traverseOperatorFunction(item);