diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-04-27 13:00:37 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-04-28 10:56:00 +0200 |
| commit | 58955eac25f0295da477ab6f6f4588e26480e166 (patch) | |
| tree | 62eabe7f85a615d0bfcc0d48084079620aeff16f /sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp | |
| parent | 075d8ad4660f05e6d2583ff1c05e9987ad624bfe (diff) | |
shiboken6/clang: Suppress class scope look up for parameters with scope resolution
Add a flag to AbstractMetaBuilderPrivate::findTypeEntriesHelper()
to suppress the class scope look in case scope resolution.
Task-number: PYSIDE-2288
Pick-to: 6.5 5.15
Change-Id: I04a4810d03845fb48393c5efed3641220bd12d87
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp')
| -rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp index fa4cb503c..4e97228b1 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp @@ -2048,7 +2048,10 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio return nullptr; } - auto type = translateType(returnType, currentClass, {}, &errorMessage); + TranslateTypeFlags flags; + if (functionItem->scopeResolution()) + flags.setFlag(AbstractMetaBuilder::NoClassScopeLookup); + auto type = translateType(returnType, currentClass, flags, &errorMessage); if (!type.has_value()) { const QString reason = msgUnmatchedReturnType(functionItem, errorMessage); qCWarning(lcShiboken, "%s", @@ -2089,7 +2092,10 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio return nullptr; } - auto metaTypeO = translateType(arg->type(), currentClass, {}, &errorMessage); + TranslateTypeFlags flags; + if (arg->scopeResolution()) + flags.setFlag(AbstractMetaBuilder::NoClassScopeLookup); + auto metaTypeO = translateType(arg->type(), currentClass, flags, &errorMessage); if (!metaTypeO.has_value()) { // If an invalid argument has a default value, simply remove it // unless the function is virtual (since the override in the @@ -2215,11 +2221,13 @@ static TypeEntryCPtr findTypeEntryUsingContext(const AbstractMetaClassCPtr &meta // Helper for findTypeEntries/translateTypeStatic() TypeEntryCList AbstractMetaBuilderPrivate::findTypeEntriesHelper(const QString &qualifiedName, const QString &name, + TranslateTypeFlags flags, const AbstractMetaClassCPtr ¤tClass, AbstractMetaBuilderPrivate *d) { // 5.1 - Try first using the current scope - if (currentClass) { + if (currentClass != nullptr + && !flags.testFlag(AbstractMetaBuilder::NoClassScopeLookup)) { if (auto type = findTypeEntryUsingContext(currentClass, qualifiedName)) return {type}; @@ -2262,11 +2270,13 @@ TypeEntryCList AbstractMetaBuilderPrivate::findTypeEntriesHelper(const QString & // and does some error checking. TypeEntryCList AbstractMetaBuilderPrivate::findTypeEntries(const QString &qualifiedName, const QString &name, + TranslateTypeFlags flags, const AbstractMetaClassCPtr ¤tClass, AbstractMetaBuilderPrivate *d, QString *errorMessage) { - TypeEntryCList types = findTypeEntriesHelper(qualifiedName, name, currentClass, d); + TypeEntryCList types = findTypeEntriesHelper(qualifiedName, name, flags, + currentClass, d); if (types.isEmpty()) { if (errorMessage != nullptr) *errorMessage = msgCannotFindTypeEntry(qualifiedName); @@ -2658,8 +2668,8 @@ std::optional<AbstractMetaType> typeInfo.clearInstantiations(); } - TypeEntryCList types = findTypeEntries(qualifiedName, name, currentClass, - d, errorMessageIn); + TypeEntryCList types = findTypeEntries(qualifiedName, name, flags, + currentClass, d, errorMessageIn); if (!flags.testFlag(AbstractMetaBuilder::TemplateArgument)) { // Avoid clashes between QByteArray and enum value QMetaType::QByteArray // unless we are looking for template arguments. |
