aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-12-08 13:40:32 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-12-11 13:47:37 +0100
commit6a1a08cfaf11ad38612e59cb1d56160160504ec8 (patch)
tree70b495aa43426f439c76c4c998ebb059a7470ba9 /sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
parent6ccb3f64575696c8327aeb7c12f8f0ff99bdecf0 (diff)
shiboken6: Determine function types in the code model
Extend the _FunctionModelItem function type enumeration by operator types and determine them by name or from clang. Split the bitwise operators into shift and other bitwise operators for stresm operator detection. Similarly, add operator type values to AbstractMetaFunction::FunctionType and replace the isOperator() checks accordingly. Remove the unused isOtherOperator() function. Rename AbstractMetaFunction::isNormal() to needsReturnType() for clarity. Rewrite the binary operator search in AbstractMetaBuilder by checks based on enumeration value and rewrite traverseOperatorFunction to return a bool so that shift operators are found when stream operator is not applicable. Rewrite the function query functions of AbstractMetaClass to also use the enumeration values. Pick-to: 6.0 Change-Id: I06cc2deefcd8a158f83c95513a7962de467f7f2a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
index 9006e2321..cf489eb2e 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
@@ -1235,13 +1235,25 @@ bool Builder::endToken(const CXCursor &cursor)
break;
case CXCursor_Constructor:
d->qualifyConstructor(cursor);
- d->m_currentFunction.clear();
+ if (!d->m_currentFunction.isNull()) {
+ d->m_currentFunction->_determineType();
+ d->m_currentFunction.clear();
+ }
break;
case CXCursor_Destructor:
case CXCursor_CXXMethod:
case CXCursor_FunctionDecl:
case CXCursor_FunctionTemplate:
- d->m_currentFunction.clear();
+ if (!d->m_currentFunction.isNull()) {
+ d->m_currentFunction->_determineType();
+ d->m_currentFunction.clear();
+ }
+ break;
+ case CXCursor_ConversionFunction:
+ if (!d->m_currentFunction.isNull()) {
+ d->m_currentFunction->setFunctionType(CodeModel::ConversionOperator);
+ d->m_currentFunction.clear();
+ }
break;
case CXCursor_Namespace:
d->popScope();