diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-06-30 13:37:51 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-08-03 06:21:06 +0000 |
commit | 8c699313c85419dc73db35dbdefc844d88a039c6 (patch) | |
tree | 53e035e8ae21a7a02657e3a3f6ef30e2b97959e7 /sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | |
parent | 700ebd831f9ee7143c525bb936cd55f2a91adcc7 (diff) |
Shiboken: No longer change arrays[] to pointer types
In AbstractMetaBuilder, no longer change array types like "int[]"
to "int*".
Task-number: PYSIDE-354
Task-number: PYSIDE-516
Change-Id: Ia9e15ae3fca895bf179275eb31a94323d91f4941
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index afdc84e46..6032b788e 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -2474,45 +2474,36 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const TypeInfo &_typ return 0; } - // 2. Handle pointers specified as arrays with unspecified size - bool arrayOfUnspecifiedSize = false; if (typeInfo.arrays.size() > 0) { - arrayOfUnspecifiedSize = true; - for (int i = 0; i < typeInfo.arrays.size(); ++i) - arrayOfUnspecifiedSize = arrayOfUnspecifiedSize && typeInfo.arrays.at(i).isEmpty(); - - if (!arrayOfUnspecifiedSize) { - TypeInfo newInfo; - //newInfo.setArguments(typei.arguments()); - newInfo.setIndirections(typei.indirections()); - newInfo.setConstant(typei.isConstant()); - newInfo.setFunctionPointer(typei.isFunctionPointer()); - newInfo.setQualifiedName(typei.qualifiedName()); - newInfo.setReferenceType(typei.referenceType()); - newInfo.setVolatile(typei.isVolatile()); - - AbstractMetaType* elementType = translateType(newInfo, ok); - if (!(*ok)) - return 0; + TypeInfo newInfo; + //newInfo.setArguments(typei.arguments()); + newInfo.setIndirections(typei.indirections()); + newInfo.setConstant(typei.isConstant()); + newInfo.setFunctionPointer(typei.isFunctionPointer()); + newInfo.setQualifiedName(typei.qualifiedName()); + newInfo.setReferenceType(typei.referenceType()); + newInfo.setVolatile(typei.isVolatile()); + + AbstractMetaType* elementType = translateType(newInfo, ok); + if (!(*ok)) + return 0; - for (int i = typeInfo.arrays.size() - 1; i >= 0; --i) { - QString s = typeInfo.arrays.at(i); + for (int i = typeInfo.arrays.size() - 1; i >= 0; --i) { + AbstractMetaType *arrayType = q->createMetaType(); + arrayType->setArrayElementType(elementType); + if (!typeInfo.arrays.at(i).isEmpty()) { bool _ok; - int elems = findOutValueFromString(s, _ok); - - AbstractMetaType *arrayType = q->createMetaType(); - arrayType->setArrayElementCount(elems); - arrayType->setArrayElementType(elementType); - arrayType->setTypeEntry(new ArrayTypeEntry(elementType->typeEntry() , elementType->typeEntry()->version())); - decideUsagePattern(arrayType); - - elementType = arrayType; + const int elems = findOutValueFromString(typeInfo.arrays.at(i), _ok); + if (_ok) + arrayType->setArrayElementCount(elems); } + arrayType->setTypeEntry(new ArrayTypeEntry(elementType->typeEntry() , elementType->typeEntry()->version())); + decideUsagePattern(arrayType); - return elementType; - } else { - typeInfo.indirections += typeInfo.arrays.size(); + elementType = arrayType; } + + return elementType; } QStringList qualifierList = typeInfo.qualified_name; |