[Development] QtCS2019: moc and QMetaObject

Olivier Goffart olivier at woboq.com
Mon Nov 25 09:10:48 CET 2019


Here are the notes from the session

https://wiki.qt.io/Qt_Contributors_Summit_2019_-_moc_and_QMetaObject

Summary:

We discuss if we should rewrite moc using libclang.
moc currently hasn't still fully be ported to support C++11 yet. Features such 
as raw literals, trailing returns and other will confuse moc.
It is agreed that using clang for moc would be the path forward even if it is 
slower. We discussed that we should use the clang C API for compatibility 
reasons. we should avoid using Qt in the implementation to simplify the 
bootstrap proccess.
There is already a prototype i made years ago (but it is using the C++ API) 
https://github.com/woboq/moc-ng
However this was not seen as a blocking issue for Qt6 as the changes we want to 
do to the "generator" can easily be ported to the new moc without requiring to 
do all the work twice..

We discussed if Qt should provide an additional API such as
https://github.com/woboq/verdigris which allow to write code that does not use 
moc. But the consensus is that this wasn't usefull, and that verdigris can stay 
a separate library. However it should still be made possible. (And a solution 
for the new json output required by QML3 will be needed)

We discussed the reflexion features coming in future version of C++. But since 
this is for the far future and won't help us immediately, we won't consider 
them now. Later they can be adopted.

The QMetaObject itself will gain new feature for performance reasons so QML can 
be faster.

-- 
Olivier


More information about the Development mailing list