Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-672

shiboken: Refactor code handling C++ types

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P2: Important
    • 5.12.0
    • 5.9
    • Shiboken
    • None
    • All

    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

          For Gerrit Dashboard: PYSIDE-672
          # Subject Branch Project Status CR V

          Activity

            People

              kleint Friedemann Kleint
              kleint Friedemann Kleint
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: