summaryrefslogtreecommitdiff
path: root/src/qdoc/clangcodeparser.cpp
diff options
context:
space:
mode:
authorLuca Di Sera <luca.disera@qt.io>2023-03-24 13:55:05 +0100
committerLuca Di Sera <luca.disera@qt.io>2023-03-27 11:44:57 +0100
commitf6291e2163c96e9c6d15c0ac52a8313c4580cb8d (patch)
tree6ed8df9c1769e276c28cf02b920b42a5ffd450dc /src/qdoc/clangcodeparser.cpp
parent23f0761d22bd972b046614fa173b29555b2d2047 (diff)
downloadqttools-f6291e2163c96e9c6d15c0ac52a8313c4580cb8d.tar.gz
QDoc: Remove `QmlCodeParser::m_parser`
As part of producing a documentation set, QDoc parses a series of user-defined input source files in various languages to extract the user-provided documentation and certain source-code level elements. For QML source files, the `QmlCodeParser` class is used, taking care of reading the QML code and build an internal representation for some of its elements. `QmlCodeParser` uses the `QQmlJs` parsing api to do so. As part of using the `QQmlJs` parsing api, `QmlCodeParser` has to build a `QQmlJs::Engine`, `QQmlJs::Lexer` and `QQmlJsEngine::Parser`. Currently, `QmlCodeParser` stores the engine and parser elements as instance members. For example, for the `QQmlJs::Parser` instance, a member variable `m_parser` is used as storage. Supposedly, this is intended as a way to avoid building the three elements more than once. Building a `QQmlJs::Parser` more than once does not provide any meaningful overhead, moreover not in the code path where it is used. Furthermore, `m_parser` is used only a few times, in `QmlCodeParser::parseSourceFile`, the entry point for parsing a QML source file. Hence, to reduce the scope of `m_parser` and avoid requiring an out-of-scope initialization for it, `m_parser` is now removed in favor of a local instance in `QmlCodeParser::parseSourceFile`. The initialization and deletion of `m_parser` in `QmlCodeParser::initializeParser` and `QmlCodeParser::terminateParser` was removed as a consequence of the removal of the member. As `QmlCodeParser::initializeParser` and `QmlCodeParser::terminateParser` were only taking care of `m_parser`, their implementation is now removed as dead code. As `initializeParser` and `terminateParser`are required to be implemented, by `CodeParser`, `QmlCodeParser` base class, due to their pure virtual nature, an empty implementation was added to "qmlcodeparser.h". Similarly, the constructor for `QmlCodeParser` was only taking care of initializing `m_parser` and is now removed in favor of a defaulted implementation. Change-Id: Id07e6d9cf8083c83482232606fb9a2611dcce420 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
0 files changed, 0 insertions, 0 deletions