Description
The implementation of C++ types in shiboken has some issues that block adding more advanced types:
Complexity, duplicated types
- Several types represent a C++ type: TypeInfo (Codemodel), TypeParser::Info (done. removed), AddedFunction::TypeInfo. In addition, the code-model related types are eventually used to populate AbstractMetaType
- Parsing of type code snippets happens in several places
- abstractmetabuilder.cpp:64 parseTemplateType() for AddedFunction
- AbstractMetaBuilder::translateType (reparses TypeInfo::toString() back into TypeInfo to normalize signatures, apparently)
- AddedFunction::TypeInfo::fromSignature() for reading XML, handles only limited subset
- ShibokenGenerator::buildAbstractMetaTypeFromString()
Representation of const
TypeInfo, AbstractMetaType only have isConstant(), which is true for const int *
which technically (and in Clang representation) is not const, (the pointee is). It is thus not possible to differentiate from const int *const or int *const which is truly const. This causes subtle issues:
- Some signatures for querying the function documentation do not match (doc generator)
- No setters are generated for field types like const QWidget * (QStyleOptionViewItem)
- Patterns for matching rejections and modifications are a bit strange ( bool volatile* instead of volatile bool *)
Plans
A lot of needed information is readily available from Clang. So, introducing a type which represents all the information from Clang would be useful
One issue to consider is that doc-generation (namely the creation of XQueries for the WebXML doc extraction from function signatures) requires using unresolved typedefs (GLEnum instead of unsigned).
Attachments
Issue Links
- relates to
-
PYSIDE-304 PySide does not make setters for fields that are a variable pointer to a constant value
- Closed
-
PYSIDE-725 Shiboken should support creating bindings for explicit instantiations of template classes
- Closed
- resulted from
-
PYSIDE-363 Fix documentation generation
- Closed
For Gerrit Dashboard: PYSIDE-672 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
230439,11 | WIP: shiboken: Refactor type parsing | dev | pyside/pyside-setup | Status: DEFERRED | -2 | 0 |
230775,4 | WIP: shiboken: Factor out helper function for clarity | dev | pyside/pyside-setup | Status: DEFERRED | -2 | 0 |
230870,2 | shiboken: Streamline the type parsing code | 5.9 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
231039,14 | WIP: Make "const" more fine grained | dev | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
231234,2 | shiboken/ClangBuilder: Fix nested qualified names | 5.9 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
231453,1 | WIP: ShibokenGenerator::buildAbstractMetaTypeFromString() use type parser | dev | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
231504,3 | shiboken: Add comparison to AbstractMetaType | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
231549,7 | shiboken: Improve support for volatile | dev | pyside/pyside-setup | Status: MERGED | -2 | 0 |
231550,1 | shiboken: Add error handling to translateType() | dev | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
233571,4 | shiboken: Use raw string literals in ApiExtractor test testtemplates | 5.11 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233575,3 | shiboken: Add a test for typeinfo parsing | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233602,2 | shiboken: Remove code fixing template arguments | 5.11 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233820,4 | shiboken: Extend debug operators | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233821,6 | shiboken: Add instantiations to TypeInfo | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233822,2 | shiboken: Add comparison to AbstractMetaType | 5.11 | pyside/pyside-setup | Status: ABANDONED | 0 | 0 |
233823,5 | shiboken: Streamline type parsing | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233900,3 | shiboken: Improve error messages when rejecting functions | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233996,2 | shiboken: Introduce enumeration for C++ indirections | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233997,2 | shiboken: Improve const handling | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
233998,2 | shiboken: Move detection of template arguments to ClangBuilder | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
234390,3 | shiboken: Cache TypeInfo in clangbuilder | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
238200,3 | shiboken: Add support for const Foo* fields | dev | pyside/pyside-setup | Status: MERGED | -2 | 0 |