| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit df735050ecd01687f17df8f161c706541319ad05.
While the commit works, it introduces unnecessary complexity to the
processing of the \meta command. The same functionality can be
achieved with the help of a documentation macro.
The commit did contain a bug-fix for the \generatelist command,
which is re-introduced as a separate change.
Pick-to: 6.5
Change-Id: Ie8578baa35cfee210fc52428c610307f51103d22
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
| |
Change-Id: Ic6f1e5d1e2d7468b522ce7d5209cc73c7bb80c5c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
| |
Pick-to: 6.5
Change-Id: I1a76bf2224795275a8c62cf37144936bda87cbca
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`WebXMLGenerator::startLink` is responsible for writing the WebXML tags
for links. The method takes a pointer to `Atom`, from which a string is
obtained for use in parts of the output. In most locations, the callee
pre-qualifies the validity of the pointer it passes to the method
(e.g. `if (atom) startLink([...]`).
However, there's an exception to this in
`WebXMLGenerator::generateAnnotatedList`, which calls
`Text::firstAtom()` -- that may return `nullptr` -- in the call to
`startLink`. This is considered a valid use-case that occurs when
there's only title/meta commands and no body in the documentation.
In such a case, or if the string obtained from `Atom::string()` is
empty, `WebXMLGenerator::startLink` is designed to fall back to the
full name of the `Node` being processed. However, in the case when
generating a link for an example, `Generator::exampleFileTitle()` is
called to obtain a file name for the example, and the `Atom*` is
dereferenced to obtain a string is input for the latter method. At
that point, the `Atom*` may be an unguarded null pointer.
This change updates the generatedOutput test for QDoc by adding a
minimal documentation project that serves as means to reproduce a bug
that was observed in Qt3D, and fixes the bug in QDoc. The documentation
project is designed such that the preconditions outlined in the first
paragraph are met; that is to say, the structure of the documentation
is such that, for an `Atom` that's constructed while generating the
documentation set, `Atom::firstAtom()` is going to return a null
pointer. The change to the test serves to validate the bug fix as well
as to guard for future regressions.
Avoid the crash that would occur when dereferencing this null pointer
in `WebXMLGenerator::startLink` by checking the validity of the `Atom*`
before dereferencing it to obtain a string used as file title when
generating a link for an example.
Fixes: QTBUG-112641
Pick-to: 6.5
Change-Id: I3633e5473b60013968becac4cd7bdacdbbdcb9ff
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
| |
As a drive-by, extend the list of C++ keywords checked for naming.
Pick-to: 6.5
Change-Id: I37b095d0fa29b9c431b7ad11bb5f962a8eeb5d79
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Fix slot connection, amending
f6c9325f639d882992bb3c6386185defd2090498.
Pick-to: 6.5
Fixes: QTBUG-112682
Change-Id: Idb325f31ed8f454433f4b8d28183a571877972ff
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QDoc includes a number of attributes when generating index files.
Some of these include the default value the attribute has when reading
the index files back in, such that the overall effect of writing them to
the index file in the first place is none at all for QDoc.
For example, for a function that isn't virtual, const, static, final, or
overridden, the index file contains the attributes
virtual="non" const="false" static="false" final="false" override="false"
This change modifies QDoc's behavior such that these attributes are only
written to the index file if they are true. This reduces the size of the
index files generated for Qt by approcimately 7.16%. Test data for the
generatedOutput test is updated to reflect the new content of the index
files covered by that test.
[ChangeLog][QDoc][Index files] QDoc no longer writes the attributes
virtual, const, static, final, or override, to the index files, unless
the attribute is part of a function or method's signature. This reduces
the file size of index files somewhat.
Fixes: QTBUG-112494
Change-Id: I7d25dc429749dd29dbdcd65b7ca78a51ced5dd0f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The index files generated by QDoc contains an attribute for a
function's "virtualness"; that is, if the function is a virtual, pure
virtual, or not virtual. These attributes are written to the index
file if they exist, and read back in, again if they exist. For
functions that do not have this attribute in the index file, a
virtualness of NonVirtual is implicitly assumed.
This change explicitly initializes the responsible member variable,
FunctionNode::m_virtualness, to NonVirtual. Furthermore, the setter
overload setVirtualness(const QString&), which is called only when
reading an index file back in, is modified to handle the special case
for pure virtuals first, then setting m_virtualness to Virtual if
that's the case, and NonVirtual for any empty, missing, or unknown
attributes.
Task-number: QTBUG-112494
Change-Id: I8f08b72ae58dca5da07932f010da230c667b056c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
| |
QDocIndexFiles::generateFunctionSection has a lot going on.
Use extract method as a step to clean up the method and
introduce a level of abstraction to parts of its internals.
Change-Id: If2efbfb10fcd8585c9c2298b2557ac880052a7ac
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The FunctionNode class contains the public method setVirtual().
The method's intent is to set the private member m_virtualness
to FunctionNode::Virtualness::NormalVirtual. This behavior is
achieved, and exercised in QDoc, by calling another method of
the same class, setVirtualness(Virtualness), which offers the
option of passing any value from the FunctionNode::Virtualness
enum, making that API more flexible than that of setVirtual()
which doesn't take any arguments.
As the private member is set in code by a different setter,
and because the setVirtual() method is unused, remove the latter
as dead code.
Task-number: QTBUG-71176
Change-Id: Ieab1fa5b6be92e481fc9df887816fec3f08bbdaf
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The FunctionNode class contains the private member `m_parentPath` and
the associated public setter method setParentPath(). There is no
associated getter method, nor is the member variable ever read.
Furthermore, the setter is never called from anywhere.
Remove the member and setter as dead code. This reduces the public
API of the FunctionNode class and unclutters its internals just a bit.
Task-number: QTBUG-71176
Change-Id: Ic60f89eb5c0c96cf9261a5810a0a8b3e6342e9a1
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
| |
Use the isStringLiteralPrefix function that was introduced in an earlier
commit.
Change-Id: I0095ca45e232639317c6fe6fcfd2ee57fe8b1caa
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fix for QTBUG-73273 already added code to allow prefixed raw string
literals. Now, lupdate supports regular prefixed string literals as
well.
If the parser encounters a prefixed string literal, ignore the prefix
and handle the rest as ordinary string literal.
Note that expressions like tr(U"foo") won't compile out of the box. We
support them nevertheless. The user might provide their own tr macro
that handles such string literals.
[ChangeLog][lupdate] lupdate now supports prefixed string literals like
u"foo".
Pick-to: 6.5
Fixes: QTBUG-59802
Change-Id: Ibe8b4b83ee1197a73678b1e8f37dd6ac7db57714
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's an edge case in the number heuristics of lupdate that triggers a
Q_ASSERT due to an out-of-bounds string character access. To run into
the assert, the following must be true:
- oldSource == oldTranslation
- oldSource must contain a number followed immediately by more than one
characters
- oldSource and newSource must differ only in the character after the
number
Examples that trigger the assert:
| oldSource | newSource |
|------------+------------|
| "%1MiB" | "%1Kib" |
| "1Mi" | "1Ki" |
| "1M " | "1Ki " |
| "123abcde" | "123xbcde" |
Examples that do not trigger the assert:
| oldSource | newSource |
|------------+------------|
| "%1MiB" | "%1Kob" |
| "1M" | "1K" |
| "123abcde" | "123xxcde" |
Add a test case that triggers the Q_ASSERT.
Add a check to avoid the out-of-bounds access as a minimal fix. The
whole number heuristics algorithm is fishy and produces results that
don't match the source code comments. But it's been like that "forever",
so let's not change existing behavior people may rely on.
Pick-to: 6.5
Fixes: QTBUG-111775
Change-Id: Ibb6bcce9115f7060b6de3f97451e38105623c003
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 454ab5ffd5b07 ff let qtattributionsscanner bail out if the
content of the "Path" and "Files" properties are not valid relative
file paths at the time qtattributionsscanner runs.
For Qt for MCU tough, the relative path to third-party files does
differ between the git checkout, and the source SDK as given to the
user.
This patch, therefore, allows opting out of the check by adding a
--no-path-checks option.
Pick-to: 6.5
Change-Id: I809b52e233a6b56194feb1b5b8168f36ba1b9972
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Recent changes removed the enum value SearchType::Module from the
FindPredicate struct's member enum. This made the switch in the
struct's operator() on `type_` redundant, as the two remaining cases
both result in the same behavior. Remove the switch as it isn't needed
anymore.
Change-Id: Ib2a15de7d4aa9588943a6babb497ec2b970a6290
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
|
| |
A recent change made the enum value
ClangCodeParser::buildPCH::FindPredicate::SearchType::Private
unused. Remove the enum value and the case that considers it.
Change-Id: If3f4379bdad2339e873e347e422df35871629d38
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Node::setLogicalModuleInfo(const QString &) isn't called from
anywhere. Remove the virtual function from the Node baseclass,
and the unused overridden implementation in its derived class
CollectionNode.
Task-number: QTBUG-71176
Change-Id: I0fa368300f712c33725c87a5c8656bbb34eed398
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
The enum class construct can only be based on an integral type so they
can be skipped over safely.
Pick-to: 6.5
Task-number: QTBUG-36589
Change-Id: I9a7dd7508f80002e9e46429de726a75607d21a54
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
|
|
|
|
|
|
|
|
| |
As a drive-by, add a 128x128 logo for Designer, as screen sizes grow.
Pick-to: 6.5
Change-Id: I886841c9a6cbc8b6996466d9ca687be6f7eca666
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Resizing to 4/5 of screen dimensions was previously followed
by calling adjustSize(), which immediately overrides the
size assigned to the minimum size that accommodates child
widgets. Reversing the calls makes us both not start outside
the screen as intended and sets the correct size of 4/5 of
screen real estate.
Fixes: QTBUG-112220
Pick-to: 6.5
Change-Id: I7439ee35bb07f448372fbf2f3943475db7095ac5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
ClangCodeParser::buildPCH included a local variable, privateHeaderDir,
which was written to in a loop over the parser's includeDaths private
member, but never read. This patch removes the local variable and loop
from said method, as it is effectively dead code.
Change-Id: Ifae97e0e31074bb4e5d97a427f9392b2526f2f37
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`ClangCodeParser`, the class responsible for parsing Cpp source files
during a QDoc run, uses a PCH to speed up compilation when reading the
above mentioned source file.
A PCH file is built in `ClangCodeParser::buildPCH`.
To avoid redoing the same work more than one time if it is unnecessary,
`buildPCH` branches on certain conditions and does nothing if those
conditions are not met.
To make the code easier to read, move the code that performs the PCH
building operation to the top level of the method body, instead of
branching, and use early returns when the conditions are not satisfied.
Change-Id: I95b07a12bc1723ea7bdaee41367483a61dcb5609
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 element as
an instance member, `m_engine`.
Supposedly, this is intended as a way to avoid building the element more
than once.
Building a `QQmlJs::Engine` more than once does not provide any
meaningful overhead, moreover not in the code path where it is used.
Furthermore, `m_engine` 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_engine` and avoid requiring an
out-of-scope initialization for it, `m_engine` is now removed in favor
of a local instance in `QmlCodeParser::parseSourceFile`.
Change-Id: I73f23ec06c1fa3ba3fe50ff4dffc9ff9229c114d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 all those elements as instance
members. For example, for the `QQmlJs::Lexer` instance, a member
variable `m_lexer` is used as storage.
Supposedly, this is intended as a way to avoid building the three
elements more than once.
Building a `QQmlJs::Lexer` more than once does not provide any
meaningful overhead, moreover not in the code path where it is used.
Furthermore, `m_lexer` is used only once, in
`QmlCodeParser::parseSourceFile`, the entry point for parsing a QML
source file.
Hence, to reduce the scope of `m_lexer` and avoid requiring an
out-of-scope initialization for it, `m_lexer` is now removed in favor of
an local instance in `QmlCodeParser::parseSourceFile`.
The initialization and deletion of `m_lexer` in
`QmlCodeParser::initializeParser` and `QmlCodeParser::terminateParser`
was removed as a consequence of the removal of the member.
Some comments that mentioned the initialization or deletion of the lexer
were modified to represent the modified code.
Change-Id: I32d38e7883273ab83745eb1f34d183fd5ecca19a
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When QDoc runs it collects a series of input source files based on
certain configuration variables.
The collected input source files are later used as the base for
extracting the user-provided documentation.
The files are collected into a map, in `processQDocConfFile`,
`sources`.
The map uses the same values, file paths that QDoc extracted from the
above mentioned configuration variables, for each key-value pair.
That is, given a file path X, `sources` stores a key-value pair X-X.
Supposedly, the intention of using a map was to avoid duplicates.
Indeed, the code that populates the map avoid inserting elements that
already are present in the map, thus making use of the fast lookup that
the data structure provides.
As half of the map is left unused, indeed only the keys are ever
accessed, we replace the map with a set, which better provides the
required removal of duplicates.
Change-Id: If4de2f1a6c8b45ac138139b7d49b1d0d73ed2c1f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When QDoc runs it collects a series of input source files based on
certain configuration variables.
The files are collected into two maps, in `processQDocConfFile`,
`sources` and `sourceFileNames`.
The collected input source files are later used as the base for
extracting the user-provided documentation.
Nonetheless, `sourceFileNames`, which is populated along with `sources`
was never used and is thus removed as dead code.
Change-Id: Ie02025e8b1054e4a4f3e9235ee1cc2d7631a2935
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Examples in the Qt codebase are now tagged with specific categories,
using the '\meta category {Category}' command. To easily generate
lists of members in each category, add support for a 'category'
argument in the \generatelist command.
Internally, utilize the mechanism already provided by \ingroup command,
by adding the node to an internal group prefixed by 'category', when
processing the '\meta category' command.
\generatelist already supported listing members of a group as a simple
unordered list of titles/links. Fix the generated links as they were
broken, always referring to the current document.
In DocBook generator, reuse generateAnnotatedList() as it already has
support for outputting simple itemized/unordered lists. Create a new
private enum GeneratedListType to select the list 'subtype' and clean
up the API.
Add simple test case and documentation of the new argument.
Pick-to: 6.5
Fixes: QTBUG-111891
Fixes: QTBUG-111575
Change-Id: Icd5647a09b9ae8cb0ac243fa49d3d99263d397cb
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generator::generateDocumentation() recursively traverses the tree of
PageNode objects, i.e. nodes that generate output. However, it did
not check if there are documented nodes in the global scope (root
namespace) that generate no output.
A typical case where this happens is global functions, where the
author forgot to associate the function to something using the
\relates command.
Make QDoc print out a warning for these nodes, and mark them
to have 'DontDocument' status so they will be ignored later on
for linking and inclusion in the .qhp file.
Also in Generator::generateDocumentation(), rename a variable local
to a for-loop from 'node' to 'child', to prevent shadowing a 'node'
in the outer scope.
Pick-to: 6.5
Fixes: QTBUG-112256
Change-Id: I74fcc704f6848fc1eef8529da80f57678a83766e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
* Replace calls to QCoreApplication::translate() with QStringLiteral().
* Remove related configuration strings.
* Remove #ifndef QT_NO_TRANSLATION blocks.
Task-number: QTBUG-71176
Change-Id: If7ac4d84a757d75c8a36f94f1811391c81b56aff
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since recent refactoring removed the main use of the qdocFiles
local variable, drop it in favor if accessing the source for
that information directly through Config::instance(). Do the same
for two other accesses through the local reference to Config::instance,
thus allowing the removal of that reference.
Task-number: QTBUG-71176
Change-Id: Id64d58cacc3b368d1986e12119a71cdbdc8d648a
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent changes have extracted helper functions for running QDoc in
single or dual execution mode, respectively. Both functions do minor
setup, including getting a list of .qdocconf-files from `Config`. The
setup and list of .qdocconf-files differ in these two execution modes.
Both functions then loops over their list of .qdocconf-files. This loop
calls clear() on Config's list of module dependencies before dispatching
the qdocconf file to processQdocconfFile() for further processing. This
loop is identical to both modes of execution; in single execution mode,
this particular loop is performed twice.
This patch extracts this loop as a separate function that accepts a list
of .qdocconf-files it will iterate over. As this loop makes out the bulk
of code in the two functions for execution modes, this implementation
detail obscures the material difference of the work performed in the two
callers of this new function. By extracting it, code readability is
improved by letting the interesting parts take center stage.
Task-number: QTBUG-71176
Change-Id: Ie7f63bde17d9b676f9755874537af6c5bb1f9c7e
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent refacoring extracted the executing code in QDoc's main() function
for running QDoc in "single execution mode". This patch does the same
for "dual execution mode", which is QDoc's default behavior. The result
is a more expressive main() function, that is easier to reason about for
code readers.
Task-number: QTBUG-71176
Change-Id: I494f58cd0d424f4cde47cc0363f908f85aa44eac
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In QDoc's main(), two identical conditional checks for whether QDoc runs
in single execution mode follow each other. This patch extracts the
contents of these conditionals and places them in a separate function,
singleExecutionMode(). This in turn makes main() slightly easier to read
and reason about.
The new function is documented such that its purpose can be understood
in clear terms. The list the function operates on is obtained from Config.
As that is a singleton object, the function doesn't require the passing
of a reference to that object, as it can access the required functionality
directly through the singleton instance itself. The new function is
therefore parameterless.
Task-number: QTBUG-71176
Change-Id: I49fb571b99a24ff70ab8f0b17de8e1f44064e418
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
A recent change exposed a clear opportunity to extract a function from
the rather large processQdocconfFile function in QDoc's main.cpp. This
patch does that, and adds documentation for the new function so that it
becomes clear for readers what goes on and what possible side-effects
can occur.
Fixes: QTBUG-112218
Change-Id: Id9084ee55250526679a47ff56b852d54569cb62c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Following a recent change that changed the scope of QDocDatabase
access in CppCodeParser to method local, the class no longer has
a member called `m_qdb`. To avoid confusion, drop the `m_` prefix
from local use, so that readers won't mistake local variables for
a class member.
Change-Id: I2f1d38707911c2ee4e8be45a43cb5b861e59ecae
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QDoc extracts the user-provided documentation from which its output is
generated from a variety of input source file based on a project
configuration.
Those input source file can be of a variety of formats, as long as QDoc
currently supports them.
When parsing those files, QDoc extracts format specific information,
such as information about the available elements in a C++ translation
unit, and all the QDoc language comment-block that form the actual
documentation.
The format specific elements that are extracted are lowered into an
internal representation, the `Node` hierarchy, that QDoc later uses to
perform sanity checks on the user-provided documentation or to
automatically generate certain documentation.
The QDoc comment-blocks are generally processed in place, and they, too,
are converted into an internal representation, partly filling a `Node`
data partly filling a `Doc` instance, and used during later stages to
generate the final output.
It performs this process through the `CodeParser` hierarchy.
The base `CodeParser` class provides an interface to parse certain
source file based on their extension.
Child classes of `CodeParser` implements the actual parsing based on the
format that they support.
`CppCodeParser`, a direct child of `CodeParser`, implements the semantic
for topic and meta commands in a comment block.
That is, it gives meaning to commands such as `\fn` and `\example`.
`ClangCodeParser`, a direct child of `CppCodeParser` and indirect child
of `CodeParser`, implements the logic to extract information from C++
source code.
`PureDocParser`, a direct child of `CppCodeParser` and an indirect child
of `CodeParser`, implements the logic to extract QDoc comment-blocks
from a ".qdoc" file.
Finally, `QmlCodeParser`, a direct child of `CodeParser`, implements the
logic to extract information from QML source files.
Both `ClangCodeParser` and `PureDocParser`, but not `QmlCodeParser`,
depends on `CppCodeParser`.
That is, as they process the found QDoc comment-block in-place during
their parsing, they use `CppCodeParser` to perform this processing.
Indeed, `CppCodeParser` is never itself instanciated, and is only
intended to provide the shared logic for `ClangCodeParser` and
`PureDocParser`.
At the same, since `CppCodeParser` purpose is not to actually parse any
source file, it doesn't respect, meaningfully, the interface for
`CodeParser`, mostly providing stub implementation for its pure virtual
methods to satisfy the compiler.
Due to recent, purposefully made, changes, `CppCodeParser` does not
depend, mostly, on any internal-only state of `CodeParser`, while
`ClangCodeParser` and `PureDocParser` do not depend on any internal-only
state of `CppCodeParser`, instead depending only on access to some of
its methods.
Hence, `CppCodeParser`, which does not respect the `CodeParser`
interface meaningfully, can be removed from the hierarchy, simplifying
it and reducing the implicit state and interface of the other members,
additionally moving the codebase forward in the intention of removing
the `CodeParser` interface and some of the shared-mutable state that
QDoc depends on.
Thus, `CppCodeParser` does not inherit anymore from `CodeParser`.
As a consequence, `ClangCodeParser` and `PureDocParser` now inherit
directly from `CodeParser`, flattening the hierarchy depth to one.
Certain pure virtual methods that were provided directly or indirectly
by `CppCodeParser` are now implemented directly in `ClangCodeParser` and
`PureDocParser` to satisfy the `CodeParser` interface.
In particular, `ClangCodeParser` now implements an empty
`terminateParser`, as before the `terminateParser` implementation only
referred back to `CppCodeParser::terminateParser`.
Similarly, `ClangCodeParser::initializeParser` does not refer back to
`CppCodeParser::initializeParser` anymore.
`PureDocParser` now implements empty `initializeParser` and `language`
methods, as, while required by the `CodeParser` inheritance, are
completely meaningless in the scope of the class.
The methods that `CppCodeParser` inherited from `CodeParser` are thus
removed.
That is, `CppCodeParser::initializeParser`,
`CppCodeParser::terminateParser`, `CppCodeParser::language` and
`CppCodeParser::sourceFileNameFilter` are directly deleted.
`CodeParser` objects are built once and registered into a static list
owned by `CodeParser`.
Their lifetime is then managed by the `initialize`/`terminate` methods
of `CodeParser`, manually.
As `CppCodeParser` does not respect this manual management anymore, the
processing performed in `initializeParser` was moved to its constructor
and the processing performed in `terminateParser` was moved to its
destructor.
In doing so a declaration for the destructor was added to
"cppcodeparser.h" and an implementation of it was added to
"cppcodeparser.cpp", replacing the `terminateParser` implementation.
Similarly, the defaulted constructor for `CppCodeParser` was removed in
favor of a custom one and its implementation replaces the implementation
for `initializeParser`.
The implementation for `CppCodeParser` made use of the `m_qdb`, a
pointer to the `QDocDatabase` singleton, which keeps a certain amount of
state that is necessary during parsing, instance-member provided by the
`CodeParser` class.
Due to the changes in the inheritance hierarchy, those usages were
modified to obtain an instance of the database directly in their scope.
In particular, `CppCodeParser::parseOtherFuncArg`,
`CppCodeParser::parseMacroArg`, `CppCodeParser::processTopicArgs`,
`CppCodeParser::processQmlProperties`,
`CppCodeParser::processMetaCommand` and
`CppCodeParser::processTopicCommand` were modified as such.
`CppCodeParser` made use of certain static methods of `CodeParser`.
Usages of those methods were modified to directly refer to the
`CodeParser` namespace as they are not implicitly available in the
relevant scopes anymore.
In particular, `CppCodeParser::processTopicArgs`, which referenced
`CodeParser::parserForLanguage` and
`processTopicCommands`/`processMetaCommand`, which referenced
`CodeParser::isWorthWarningAbout`, were modified as such.
Both `ClangCodeParser` and `PureDocParser` made use of `CppCodeParser`
methods in the call chain for the virtual `parseSourceFile` method, the
entry point to the parsing of a source file.
All the usages are required to process the extracted QDoc comment-blocks
in-place.
Due to the hierarchy changes, both objects do not have access to the
required methods anymore.
As this dependency cannot be directly removed at this point,
`CodeParser::parseSourceFile` interface was modified to require a
`CppCodeParser` instance, to allow for the required in-place processing.
Thus, `ClangCodeParser::parseSourceFile`,
`PureDocParser::parseSourceFile` and `QmlCodeParser::parseSourceFile`
had their signature update to respect the new interface.
`QmlCodeParser` does not make use of `CppCodeParser` provided methods
and thus had no implementation change for `parseSourceFile`.
`ClangCodeParser` makes direct usages of certain `CppCodeParser` methods
in `parseSourceFile` and was thus modified to access them through the
passed in `CppCodeParser` instance.
`PureDocParser` makes use of `CppCodeParser` methods in
`processQDocComments`, the actual processing logic for the parser, as
called by `parseSourceFile`.
Hence, `PureDocParser::processQDocComments` was modified to receive an
instance of `CppCodeParser`.
The instance is passed directly by `parseSourceFile` and each call to
`CppCodeParser` method was modified to use the passed in instance.
Certain methods for `CppCodeParser` that are accessed by either
`ClangCodeParser` or `PureDocParser` were protected.
To allow the access to continue now that the classes aren't related
those methods are now public under `CppCodeParser`'s interface.
In particular, `CppCodeParser::hasTooManyTopics`,
`CppCodeParser::processTopicArgs`, `CppCodeParser::processMetaCommand`
and the two overloads of `CppCodeParser::processMetaCommands` were
modified as such.
Due to `parseSourceFile` now requiring a `CppCodeParser` instance, its
only usage, in `processQDconFile`, was modified to obtain such an
instance.
The instance is built in-place, once per call, in the smallest scope
that respects those requirements near the call to `parseSourceFile`.
Precedently, the manual lifetime management derived by `CodeParser`
would scope a `CppCodeParser` implicit instance, as provided by
`ClangCodeParser` and `PureDocParser`, as the whole of
`processQDocConf`.
As the only usages of `CppCodeParser` is through direct calls to
`parseSourceFile`, the new scope, while smaller, still ensures that the
object is long-lived enough for its usages.
All state that `CppCodeParser` depends upon, as the `CodeParsers` is
either instance based or `processQDocConf` scoped and thus no semantic
changes should derive from the instancing scope.
The change, while invasive, is not expected to change any of the output
documentation for QDoc, preserving the same semantic as before.
Change-Id: Iae448be6c6975649044aa08ed334c73faa38bddf
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Drop the wording 'modified in x.y' from auto-generated note for \enum
with a \since. Modifying an enum is now handled with \value since-clauses,
and updating the \since version for the parent \enum would be incorrect.
Fixes: QTBUG-108246
Change-Id: I6f32d14d108a1a71d0c0efc185f390617f0ba3cb
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
|
| |
Streamline Aggregate::findAllSince() and stop it from generating items
marked with \dontdocument command; these resulted in broken links if a
dont-document class uses a \since command.
Change-Id: I1d06e3c846c206cdc54edb9e1fe9b1b8b105b544
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The output of \sincelist command lists enumerations introduced in a
specific version, documented with \enum with an associated \since
meta-command. Individual enum \value entries can also be marked with
a since-clause, however, this information was missing from the
generated list.
Adding support for this is less than trivial because EnumItem is not
a Node subclass, and the Sections class, which is responsible for
distributing the entries displayed in a since-list, operates on
Node instances. To work around this,
* Introduce since()/setSince() to EnumItem
* Resolve since info for enum values in Tree::resolveSince()
* Add enum values to a dedicated map in QDocDatabase
* Add enum value since attributes to .index file
* Add 'New Enum Values' as a new Section entry
In order to generate content for the new section, don't directly
populate it; only add a single entry to mark it non-empty. Actual
enum values are then fetched from the new 'since-map'. Entries in
this map contain a pointer to the associated EnumNode, used for
linking.
Add a simple test case in generatedoutput autotest.
Fixes: QTBUG-110781
Change-Id: I064446dc1e369013284ba934adeabe908754b3bb
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
|
|
|
|
|
|
|
|
| |
It is not set by default in Qt 6.
Pick-to: 6.5
Change-Id: I5f474410d257e49422367c570ac6da4d56a08d22
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
|
|
|
|
|
|
|
|
|
| |
Pick-to: 6.5
Fixes: QTBUG-111310
Change-Id: Ib8515535181cec75140cb5f065cd3f5aa45ee16c
Reviewed-by: <safiyyah.moosa@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
|
|
|
|
|
|
| |
Pick-to: 5.15 6.2 6.4 6.5.0 6.5
Change-Id: I62921a04d2173dcd78797d792437a27bbaafc5c7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we only supported \meta tag {}, even for multiple tags. This is
confusing, so allow both 'tag' and 'tags' synonymously.
Pick this also to 6.5, cause quite some examples in various repositories
contain "\meta tags".
Pick-to: 6.5
Change-Id: I2d0e59b4a0de27aa5f045b4d5f981c47aaf8b98c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of extracting user-provided documentation, QDoc has to parse a
variety of source files in a variety of languages.
`CodeParser` is the base class of objects that take care of performing
this parsing process in QDoc.
When extracting the documentation in one of the `CodeParser`s QDoc
generally tries to parse the extracted documentation in-place.
For certain documentable elements, QDoc expects that an "\inmodule"
commands is provided, as it requires it to understand where to position
them when generating the output documentation.
To ensure that this constraint is satisfied, CppCodeParser`, the
`CodeParser` subclass that takes care of providing the semantic for QDoc
block-comments, calls at a certain point
`CodeParser::checkModuleInclusion`, a method that makes sure that the
internal representation of the comment-block and the documented element
have a valid "\inmodule" information for the later stages.
`checkModuleInclusion` is only called by `CppCodeParser` and does not
require any instance-state that would not otherwise be available.
Hence, `checkModuleInclusion` is removed from `CodeParser` in favor of
being a static in "cppcodeparser.cpp", just above its actual usage.
An access to `m_qdb`, an instance-member for `CodeParser` that reference
the `QDocDatabase` singleton was modified to directly obtain a
`QDocDatabase` instance, as the member is not available outside
`CodeParser`s.
Change-Id: I0a8abc53d3c4fbd3e6687254a0034a3e12a6e018
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of extracting user-provided documentation, QDoc has to parse a
variety of source files in a variety of languages.
`CodeParser` is the base class of objects that take care of performing
this parsing process in QDoc.
When extracting the documentation in one of the `CodeParser`s QDoc
generally tries to parse the extracted documentation in-place.
The documentation has a series of available commands that might depend
on the currently used parser.
To support this process some of the `CodeParser` child classes provides
series of methods to retrieve the required commands for each parser.
`CppCodeParser`, the parser that provides the semantic for QDoc's
comment-blocks, for example, provides `metaCommands`, to list the
available "meta commands" in a comment-block.
`metaCommands` returns a static member, `metaComamnds_`.
This static member is initialized during the construction of an
`CppCodeParser` instance, and the initialization is made so that it
doesn't run more than once, albeit this is done in a non-thread-safe
way.
The initialization is based on `CppCodeParser::common_meta_commands`, as
a base, plus some other commands that are not in `common_meta_commands`.
Generally, this process could be better expressed by the use of a static
with in-place initialization. There are two probable reasons why this
has not been the way it was written in the past.
Supposedly, when this code was written, there was no suitable way to
initialize a `QSet<QString>`, the type of `metaCommands_`,
in-place, as similar patterns can be found in other legacy parts of QDoc
that are confirmed to have had this issue due to their age.
Additionally, the expansion of the `COMMAND_*` macros, which form the
content for `metaCommands_`, were, until recently, dependent on
certain data being available in another part of the system, so that
expanding them in a static context that would be processed before this
data was available would incur into a series of errors.
This dependency was removed in a recent patch, so that the issue is no
more.
Hence, the `metaCommands()` method is removed, along with
`metaCommands_`, in favor of a public static,
`meta_commands`, that is initialized in-place, to simplify the
related code.
All usages of `meta_commands` were modified to refer to
`CppCodeParser::meta_commands`, keeping an equivalent semantic, as a
consequence of the change.
As the initialization of `metaCommands_` was the only thing that was
being done in the constructor for `CppCodeParser`, the constructor was
removed in favor of a default one.
Change-Id: I6e54b95a50d07a394d727c0af8c409599a088d4c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of extracting user-provided documentation, QDoc has to parse a
variety of source files in a variety of languages.
`CodeParser` is the base class of objects that take care of performing
this parsing process in QDoc.
When extracting the documentation in one of the `CodeParser`s QDoc
generally tries to parse the extracted documentation in-place.
The documentation has a series of available commands that might depend
on the currently used parser.
To support this process some of the `CodeParser` child classes provides
series of methods to retrieve the required commands for each parser.
`CppCodeParser`, the parser that provides the semantic for QDoc's
comment-blocks, for example, provides `topicCommands`, to list the
available "topic commands" in a commnet-block.
`topicCommands` initializes a static member, `topicCommands_` and then
returns it, avoiding initialization if the method is called more than
once.
While this process can be better expressed by the simple use of a
`static` there are two probable reason for why it wasn't done in this
way.
Supposedly, when this code was written, there was no suitable way to
initialize a `QSet<QString>`, the type of `topicCommands_`,
in-place, as similar patterns can be found in other legacy parts of QDoc
that are confirmed to have had this issue due to their age.
Additionally, the expansion of the `COMMAND_*` macros, which form the
content for `topicCommands_`, were, until recently, dependent on
certain data being available in another part of the system, so that
expanding them in a static context that would be processed before this
data was available would incur into a series of errors.
This dependency was removed in a recent patch, so that the issue is no
more.
Hence, the `topicCommands()` method is removed, along with
`topicCommands_`, in favor of a public static,
`topic_commands`, that is initialized in-place, to simplify the
related code.
All usages of `topicCommands` were modified to refer to
`CppCodeParser::topic_commands`, keeping an equivalent semantic, as a
consequence of the change.
Change-Id: I9de2332bf557254e7ffd33290e6af678c2b121aa
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of extracting user-provided documentation, QDoc has to parse a
variety of source files in a variety of languages.
`CodeParser` is the base class of objects that take care of performing
this parsing process in QDoc.
When extracting the documentation in one of the `CodeParser`s QDoc
generally tries to parse the extracted documentation in-place.
The documentation has a series of available commands that might depend
on the currently used parser.
To support this process various `CodeParser` child classes provides a
way to access the available commands.
In particular, `QmlCodeParser`, the class that processes QML files,
provides `topicCommands`, a method to retrieve the available topic
commands for documentation extracted by QML files.
`topicCommands` initializes a static member, `topicCommands_`
and then returns it, avoiding initialization if the method is called
more than once.
While this process can be better expressed by the simple use of a
`static` there are two probable reason for why it wasn't done in this
way.
Supposedly, when this code was written, there was no suitable way to
initialize a `QSet<QString>`, the type of `topicCommands_`,
in-place, as similar patterns can be found in other legacy parts of QDoc
that are confirmed to have had this issue due to their age.
Additionally, the expansion of the `COMMAND_*` macros, which form the
content for `topicCommands_`, were, until recently, dependent on
certain data being available in another part of the system, so that
expanding them in a static context that would be processed before this
data was available would incur into a series of errors.
This dependency was removed in a recent patch, so that the issue is no
more.
Hence, the `topicCommands()` method is removed, along with
`topicCommands_`, in favor of a static,
`topic_commands`, that is initialized in-place, to simplify the
related code.
`topicCommands()` only uses were in `QmlCodeParser::parseSourceFile`,
the entry point for the extraction of documentation from a specific QML
file.
Thus, `topic_commands` is now scoped as a static in `parseSourceFile`,
the smaller scope where it is required.
All usages of `topicCommands()` were modified to refer to
`topic_commands`, keeping an equivalent semantic.
Change-Id: Ic97166a9a563f4e8d5ac840999231d92045a6f0d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of extracting user-provided documentation, QDoc has to parse a
variety of source files in a variety of languages.
`CodeParser` is the base class of objects that take care of performing
this parsing process in QDoc.
When extracting the documentation in one of the `CodeParser`s QDoc
generally tries to parse the extracted documentation in-place.
The documentation has a series of available commands that might depend
on the currently used parser.
To support this process `CodeParser` provides as part of its interface a
series of methods to retrieve the required commands for each parser.
One of those methods, `commonMetaCommands`, provides the commands that
are common to all parser.
`commonMetaCommands` initializes a static member, `commonMetaCommands_`
and then returns it, avoiding initialization if the method is called
more than once.
While this process can be better expressed by the simple use of a
`static` there are two probable reason for why it wasn't done in this
way.
Supposedly, when this code was written, there was no suitable way to
initialize a `QSet<QString>`, the type of `commonMetaCommands_`,
in-place, as similar patterns can be found in other legacy parts of QDoc
that are confirmed to have had this issue due to their age.
Additionally, the expansion of the `COMMAND_*` macros, which form the
content for `commonMetaCommands_`, were, until recently, dependent on
certain data being available in another part of the system, so that
expanding them in a static context that would be processed before this
data was available would incur into a series of errors.
This dependency was removed in a recent patch, so that the issue is no
more.
Hence, the `commonMetaCommands()` method is removed, along with
`commonMetaCommands_`, in favor of a public static,
`common_meta_commands`, that is initialized in-place, to simplify the
related code.
`common_meta_commands` is initialized inline under `CodeParser` in
"codeparser.h".
Its initialization depends on the `COMMAND_*` macros being available.
Previously, those macros were defined under `Codeparser` in
"codeparser.h" so that they would not be available at the point of
initialization.
Hence, all definition of the `COMMAND_*` macros were moved higher up in
"codeparser.h", to ensure that they would be available when required by
`common_meta_commands`.
All usages of `commonMetaCommands()` were modified to refer to
`CodeParser::common_meta_commands`, keeping an equivalent semantic.
Change-Id: If4987e5c1b53e80585e7556e62701690d98954c3
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
|