summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* QDoc: Remove superfluous code commentPaul Wicking2023-03-171-2/+2
| | | | | | | | | | | At some point, someone probably had an idea they wanted to pursue. As that time is now several years ago, I'd be willing to bet what that idea was is long lost knowledge. Drop the comments as they keep triggering the "what was the intention here?" question, which cannot be answered satisfactorily. Change-Id: I2996e98ee125ed0b198ee90677de82b5986cf5a6 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* qdoc: C++ marker: Allow single quote as a separator in integer literalsTopi Reinio2023-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | Since C++14, single quotes can appear in integer literals as separators to improve readability. When quoting a file that contains such a literal, QDoc interpreted the single quote as a delimiter for a char, and kept reading ahead for the closing quote. This interfered with correct marking up of C++ code and ultimately caused a warning: (qdoc) warning: Something is wrong with qdoc's handling of marked code as the plain code and marked-up code end up having different number of lines. Pick-to: 6.5 Fixes: QTBUG-111973 Change-Id: Icd2d95973f9cee72eb1c9e3f2d79df0af643dbaa Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Remove `ClangCodeParser::m_version`Luca Di Sera2023-03-162-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `ClangCodeParser`, the class that takes care of handling and parsing C++ source files to extract the user-provided documentation, will try to automatically find the element in the code that some documentation block refers to if that documentation block has no topic command. Whend doing so and failing, it will generally try to report a warning to the user. The warning is emitted based on certain conditions. In particular, if the documentation block exposes a "\since" command, a command that specifies from which version of the project the documented element is available, and the version specified by the command is a future version of the project, the warning is not emitted. The current version of the project is provided by the configuration that QDoc reads when compiling. `ClangCodeParser` copies that version and keeps it stored in an instance-scoped member, `m_version`, so that it can compare it to the one provided by a "\since" command. As `m_version` is used only for this comparison, which is located in a single function call, we remove `m_version` and directly access the value in the config, which is not expected to change at any point in the execution of QDoc, in-place. Hence, the `m_version` member was removed. Its initialiazation in `ClangCodeParser::initializeParser` was removed as a consequence. Furthermore, its single usage in `ClangCodeParser::parseSourceFile` was supplanted with a direct access to the configuration stored version. Change-Id: Ie607fa3b74b4f9c9e3fba82a98a8f2f601018f70 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove `CppCodeParser::ExtraFuncData`Luca Di Sera2023-03-162-9/+0
| | | | | | | | | | | | | | | | | | | | `CppCodeParser`, the class that generally takes care of providing the semantics of topics and meta commands for QDoc, exposed an inner class `ExtraFuncData`, that bundled together some of the data that QDoc might use when processing certain elements of the documentation. `ExtraFuncData` was instantiated once and never used. Supposedly, it was the either the result of a never finished refactoring or was suppressed away during a refactoring, without the complete code being cleaned of it. Nonetheless, it is now removed as dead code. Its single unused instantiation in `CppCodeParser::processTopicCommand` was removed as a consequence of the removal of the class. Change-Id: I7212cd0538421bb3c5e60517f53afb2eb4bd90bf Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove declaration for `CodeParser::parserForHeaderFile`Luca Di Sera2023-03-161-1/+0
| | | | | | | | | | | All implementation, usages and support entities for the method were removed in a recent commit. The declaration in "codeparser.h" was mistakenly left alone and is now correctly removed. Change-Id: Ib730d288cccad107a96f396e120b198af1f8b8be Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove `CodeParser::m_moduleHeader`Luca Di Sera2023-03-164-21/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc parses a series of source file in different languages and formats to find the user-provided documentation. The base parsing interface for elements that perform this process is given by the `CodeParser` class, with the concrete implementation of the process for different languages/formats give by its child classes. `CodeParser`, as part of its interface, provides certain methods that are only meaningful when processing specific programming languages source. For example, it exposes `CodeParser::setModuleHeader` and `CodeParser::moduleHeader` which are used to provide an PCH-able header file for the C++ headers that will be parsed for a project. Those methods are implemented in the `CodeParser` base-class, along as setter and getter for the instance-state `m_moduleHeader`. Nonetheless, they are only meaningful when running through the `ClangCodeParser` `ClangCodeParser` child class, which actually implements the processing of C++ source files. Those, `m_moduleHeader`, `setModuleHeader` and `getModuleHeader` are now removed from `CodeParser`. `ClangCodeParser` only requires knowledge of the module header in its private method `CLangCodeParser::buildPCH`, where the module header is used to actually produce a precompiled header that will later be used by further call to Clang when parsing C++ source files. Hence, instead of moving the `m_moduleHeader` instance state to `ClangCodeParser`, `buildPCH` and its public entry point `ClangCodeParser::precompileHeaders` were modified to require a `QString` parameter that is equivalent to the original value set through `setModuleHeader`, so as to reduce the of the state to its current lowest. The value of a "module header" is generally given through the configuration for the currently built project and was previously extracted in "main.cpp" and set through `setModuleHeader`. As a consequence of the above changes, the code that took care of setting the module header was modified to pass the relevant value directly to the single call of `ClangCodeParser::precompileHeaders`. Furthermore, the above code was moved directly adjacent to the call to `precompileHeaders` so that it appears nearer to its usage site. Change-Id: I1d4db2fba2807b69e23e182197a78796a2a4675f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Let Location::operator=() deal with self assignmentPaul Wicking2023-03-151-0/+3
| | | | | | | Skip assignment if attempts are made to assign to self. Change-Id: I4c9e7bc84436d59b43b8d9b41620b898a7dd95a1 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* qdoc: Remove unnecessary Config access functionsTopi Reinio2023-03-1417-181/+162
| | | | | | | | | | | | | | | | | | Config class now provides Config::get(), returning a ConfigVar reference which can be further converted to string, list, set, int, or bool. Use get() throughout the codebase and remove the old access functions. In addition, make Config::get() return a const reference, and prevent an unnecessary contains() check by using an iterator. Do some drive-by cleaning of related code. Change-Id: I2ff2203824cd4ae80c4615080948565219ad20b2 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Make global static in main local to functionPaul Wicking2023-03-131-8/+5
| | | | | | | | | | Move the global static ClangCodeParser into the one function that needs it, such that initialize/terminate behavior can be moved into ctor/dtor where it ought to be. Task-number: QTBUG-111686 Change-Id: I7034ba8ed302516e7d5dc36fcec1892d081f2072 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Allow a Comment field to document clues to updatersEdward Welbourne2023-03-101-1/+6
| | | | | | | | | | | There's no comment mechanism native to JSON and our tooling is fussy about rejecting an attribution file if it has any unknown keys; so provide a key to serve as a work-around, in which developers can leave notes to those reading the attribution later. Pick-to: 6.5 Change-Id: Ibd80b773d1c28715ec7c10a087f663a921b9ca6c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QDoc: Remove unused methodPaul Wicking2023-03-102-20/+0
| | | | | | | | | | | | The comment "try to make this private" made me curious, and I found the method that followed isn't actually used anywhere. Remove the comment and method. Upon further inspection, a couple of other methods turn out also not being called from anywhere. Drop these as well. Change-Id: I84a5aa8f6e5aad6832b2757c8c2293a51dffa898 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Don't call CodeParser::terminateParser from CppCodeParserPaul Wicking2023-03-101-3/+1
| | | | | | | | | Drop the call to CodeParser::terminateParser() from CppCodeParser::terminateParser, as the former does _nothing_. Task-number: QTBUG-111686 Change-Id: I900aede323e4249be339227fc0f70d1511d998a2 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Replace members in CppCodeParser with local staticsPaul Wicking2023-03-102-36/+26
| | | | | | | | | | | * Replace the members m_nodeTypeMap and m_nodeTypeTestFuncMap in CppCodeParser with statics local to the implementation. * Initialize the new variables directly instead of in CppCodeParser::initializeParser. Task-number: QTBUG-111686 Change-Id: I6ea8985b061efb40c2e2dbac4a7f28c82c219ad6 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Remove CodeParser::initializeParser()Paul Wicking2023-03-104-12/+1
| | | | | | | | | | | | | Due to recent changes, CodeParser::initializeParser() is a noop. * Derived classes implement overrides, so make it pure virtual in CodeParser. * Drop the call from the initializeParser methods of CppCodeParser and QmlCodeParser. Task-number: QTBUG-111686 Change-Id: Ia018132d9401b9189e3a0d6346606488fd163edd Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Remove CodeParser::s_showInternal member and associated getterPaul Wicking2023-03-103-8/+5
| | | | | | | | | | | | Get rid of the static CodeParser::s_showInternal member, because there's no reason for the CodeParser to have a static member that tracks whether the config is set to showInternal, when the config already carries that information around. Most of the derived CodeParsers already keep a reference to the config anyway. Get rid of it, as it is unnecessary. Task-number: QTBUG-111686 Change-Id: If658282b1c198e48dd236dc6b9eac280e2a5890e Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: refactor and document CppCodeParser::hasTooManyTopicsPaul Wicking2023-03-101-21/+30
| | | | | | | | | | | | | | | | | | | | | * Inverse a conditional check and make the condition more expressive. This allows an early return, as well as dedenting the remaining code in the method, and the removal of a later Q_ASSERT that could be surprising for readers that don't keep in mind that QString::lastIndexOf may return -1. * Use std::all_of instead of a for loop on a negative condition, to make the code more expressive about the intention. Remove an internal bool that was used to indicate whether the error condition was met or not as it is superfluous after this change. * Rename a variable internal to the method for accuracy. * Add internal documentation for the method. * Remove adding of punctuation in the warning message in favor of reusing convenience methods provided by Utilies. Build the warning message using std::accumulate. * Be const correct, because it's nice. Change-Id: I418362a9464575e1aeae2c93bd20e9a114ace3bc Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Move `CodeParser::parseHeaderFile` to `ClangCodeParser`Luca Di Sera2023-03-107-56/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc parses a series of source file in different languages and formats to find the user-provided documentation. The base parsing interface for elements that perform this process is given by the `CodeParser` class, with the concrete implementation of the process for different languages/formats give by its child classes. `CodeParser`, as part of its interface, provides certain methods that are only meaningful when processing specific programming languages source. For example, it exposes `CodeParser::parseHeaderFile` whose purpose it to provide an entry point for parsing C++ header files. The method is only meaningfully implemented and used in the `ClangCodeParser` child class, the class that actually implements the processing of C++ source files. Hence, the method is now removed from `CodeParser`'s interface and directly exposed as part of the interface of `ClangCodeParser`, to reduce the surface of the method and to reduce the dependencies between `ClangCodeParser` and the `CodeParser` interface, which is generally expected to be removed in the future. `CodeParser` are, currently and temporarily, mostly initialized statically and then retrieved through certain methods of the `CodeParser` interface. `CodeParser::parserForHeaderFile` is one such method that would retrieve a `CodeParser` or child class instance that is able to parse an header file. Due to the removal of `parseHeaderFile` from `CodeParser` interface and the fact that only one specific parser is able, and should be able, to parse header files, `CodeParser::parserForHeaderFile` was removed. Its only usage in "main.cpp", where it was called to retrieve the already available `ClangCodeParser`, was modified to make use of `ClangCodeParser` directly. An auxiliary method, `CodeParser::headerFileNameFilter`, previously used only by `CodeParser::parserForHeaderFile`, which provided a list of extensions to identify what files could be accepted by a certain parser as header files, is now removed as dead code. A non-meaningful reimplementation of the `headerFileNameFilter` method in `CppCodeParser`, a child class of `CodeParser`, was removed as of consequence. Similarly, the same method implementation in `ClangCodeParser` was removed. The filtering functionality that the method indirectly provided when used by `CodeParser::parserForHeaderFile`, which is to be retained for backward compatibility reasons, was moved to `processQdocconfFile` in "main.cpp", where the header files that should be parsed are gathered. Instead of using the `headerFileNameFilter` method, the data that was provided by it is now exposed as a static member of `ClangCodeParser` and accessed directly when filtering is necessary. Change-Id: Iff9a204627675aa7b34232c114945afceb8313ff Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Remove `ClangVisitor::m_friendDecl`Luca Di Sera2023-03-101-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc parses C++ code that is part of a documentation project through the use of a Clang-based parser, using the extracted information both to find user-defined documentation and to check that it has certain qualities. QDoc extracts that kind of information by traversing the AST produced by calls to Libclang, Clang's C API, and slowly lowering that AST into a custom AST made of `Node`s. This traversal is generally handled by `ClangVisitor` as called by `ClangCodeParser`, the top level interface for parsing C++ source and header files. When a function/method is defined as `friend` of a certain element, QDoc extracts that information and specially marks the corresponding `Node` so that it can be categorized and highlighted in a certain way when shown to the user. In the AST that Clang produces, such an element that is marked as a `friend` produces an AST node, `FriendDeclaration`, or a cursor of kind `CXCursor_FriendDecl`, whose child is the marked element. `ClangVisitor` is built so that, while traversing the AST, no context is preversed between the inspection of each node. Furthermore, the traversal is one-directional, so that no information found in child elements is bubbled up to a previous step of the traversal. With those self-imposed restrictions in mind, to handle the information of a declaration being a `friend`, a boolean member `ClangVisitor::m_friendDecl` is used. The member is set to `true` when a `CXCursor_FriendDecl` is found, inspected at a later point in the traversal of the cursor children, and finally set back to `false` when all the children of the cursor have been visited. The `m_friendDecl` member was then used while processing other elements of the AST to discern whether the element that was being processed should be marked as a `friend` or not. Due to the recursion of the AST, the place where the boolean flag was set and the place where it was actually used could be quite apart, sometimes down many levels of a call stack, reducing the locality and scrutability of the downstream code. Due to the instance-scope of the member, extraneous children of a `CXCursor_FriendDecl` could be evaluated as `friend`s even when that could not have a valid semantic. Similarly, due to the mutability of the member and its excessive scope, care was required to ensure that the flag was reset at the correct point during the traversal, extending the mental load required to understand the code and the possible classes of bugs. To simplify the code, `m_friendDecl` is now removed, in favor of in-place, AST-based checks to evaluate whether an element is a `friend` or not. The member variable was removed from the instance, along with its single write access in `ClangVisitor::visitHeader`. Additionally, its single read access in `ClangVisitor::processFunction` was modified to retrieve the `friend` information through Clang's APIs. Specifically, the C++ API from Clang, which has been introduced by recent changes in QDoc that allows it to be used along with Clang's C API, is used to obtain such information, through the `Decl::getFriendObjectKind`, as it is more expressive and more direct than the required C API's calls. Certain unnecessary comments in the touched code were removed as they were providing no useful information. The change does not impact the produced documentation and is expected to be semantically equivalent to the behavior of the previous code. Change-Id: Ifb453ac6d29fa9e2db90f311a1656c95b9dcd712 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Remove reference to Multiple Inheritance ExampleAndreas Eliasson2023-03-101-3/+0
| | | | | | | | This example was part of 6.4 but has been removed in dev. Pick-to: 6.5 6.5.0 Change-Id: Ic5bbdf075ce0c45a894d5963a3790e7faf4cd5ba Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QDoc: Remove UsingClause struct and its usePaul Wicking2023-03-098-106/+0
| | | | | | | | | | | | | | | | | | | | | | | | The documentation for UsingClause states that it's "supposed to describe a using clause" and that "I" (here, Martin Smith, the one that documented the struct and maintainer of QDoc at the time) believe the struct not to be in use at all. Since 816b967374aa714139ddc59676dd32702bed9f49 was introduced in 2017, type aliases ('using clause') have been handled by clang in QDoc through the \typealias command. However, the code that was responsible for handling using clauses prior to clang becoming the C++ parser for QDoc was never really cleaned up, leaving code that was read but never written to. This caused QDoc to create a QList<UsingClause> of size 0 in Tree::resolveUsingClauses() more than 20000 times while generating the documentation for Qt. As the only use that was left is essentially a noop, remove the UsingClause struct along with its only user, Tree::resolveUsingClauses. Task-number: QTBUG-58158 Fixes: QTBUG-111820 Change-Id: Id83d12d4c0c53ef8b096b892c71bca97b7fa6752 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Move `CodeParser::precompileHeaders` to `ClangCodeParser`Luca Di Sera2023-03-092-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc parses a series of source file in different languages and formats to find the user-provided documentation. The base parsing interface for elements that perform this process is given by the `CodeParser` class, with the concrete implementation of the process for different languages/formats give by its child classes. `CodeParser`, as part of its interface, provides certain methods that are only meaningful when processing specific programming languages source. For example, it exposes `CodeParser::precompileHeaders` whose purpose it to provide a PCH for parsing C++ source files. The method is only implemented and used in the `ClangCodeParser` child class, the class that actually implements the processing of C++ source files. Hence, the method is now removed from `CodeParser`'s interface and directly exposed as part of the interface of `ClangCodeParser`, to reduce the surface of the method and to reduce the dependencies between `ClangCodeParser` and the `CodeParser` interface, which is generally expected to be removed in the future. Change-Id: I243b81974c741589e7f644e1996cdb274e20502b Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: flatten loop in PureDocParser::processQdocCommentsPaul Wicking2023-03-081-28/+28
| | | | | | | | | | | | | | | | | | | TLDR; Inverse the conditional to continue the while early, in order to flatten the rest of the method. PureDocParser::processQdocComments consists of a while loop over a token. For any token that isn't Tok_Doc, get the next token and continue. Tok_Doc tokens are processed, and this processing constitutes the bulk of the method. Inverse the logic of the conditional to allow an early continue. This allows for dropping the else branch entirely, and makes it clear early on that the method is only interested in Toc_Doc. Another advantage is that the bulk of the method can be dedented to the main scope of the while loop, reducing the cognitive load for readers of this code. Change-Id: I01c9d3f547cd7610aa5adc19ffac456096f0a427 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* QDoc: Remove `PureDocParser::m_tokenizer`Luca Di Sera2023-03-072-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `PureCodeParser`, a class whose responsibility is to extract documentation from non-programming-language files (e.g .qdoc files), uses a `Tokenizer` instance to lex its processed source files. A reference to the `Tokenizer` instance is stored in a member variable, `m_tokenizer`, that is later accessed when the capabilities of the `Tokenizer` are needed. The `Tokenizer` instance that is referenced by `m_tokenizer` is created on the stack every time `PureDocParser::parseSourceFile`, the entry point to the parsing of an input file, is called. As the instance will be destroyed after the call to `PureDocParser::parseSourceFile` ends, `m_tokenizer` will be left pointing to an invalid memory location, ensuing undefined behavior should it be accessed outside of the scope of a call to `PureDocParser::parseSourceFile`. Since no access to `m_tokenizer` is performed outside this scope, no bug was produced from it. `m_tokenizer` only usage is in `PureDocParser::parseQdocComments`, the method that actually performs the parsing and whose only caller is `PureDocParser::parseSourceFile`, so that the instance-scope is unrequired. Hence, `m_tokenizer` was removed in favor of a smaller scope variable in `PureCodeParser::processQdocComments`. The initialization of `m_tokenizer` that was previously executed in `PureDocParser::parseSourceFile` is now moved to `PureDocParser::processQdocComments`, in a `tokenizer` variable that is created in the scope of the method. The usages of `m_tokenizer`, all local to `PureDocParser::processQdocComments`, were modified to be usages of `tokenizer`. The usages are further modified to use the member of object access operator instead of the member of pointer access operator due to the now non-pointer type of `tokenizer`. Thus, `m_tokenizer` was removed as dead-code. Change-Id: I5c9e092cc5fd3b67ada8433b88fec2c42e4f6975 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove `PureCodeParser::m_token`Luca Di Sera2023-03-072-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `PureCodeParser`, a class whose responsibility is to extract documentation from non-programming-language files (e.g .qdoc files), uses a `Tokenizer` to lex its processed source files. During this processing, it uses an instance member, `m_token`, to store the kind of the next token in the source input. Nonetheless, the processing of a source file is well-scoped to a single function, `PureCodeParser::processQdocComments`, the only user of `m_token`, so that `m_token` does not require the instance-scoping that it has. Hence, `m_token` was removed in favor of a smaller scope variable in `PureCodeParser::processQdocComments`. The initialization of `m_token`, that is, the extraction of the first token from an input file, was previously executed in `PureDocParser::parseSourceFile`, the entry point for `PureDocParser::processQdocComments`, and has now been moved to `PureDocParser::processQdocComments`, in a `token` variable that is created in the scope of the method. The usages of `m_token`, all local to `PureDocParser::processQdocComments`, were modified to be usages of `token`. And hence the `m_token` member was removed as it is now dead-code. Change-Id: Ifafd6fdef1ce86865431581063da8ceb2e05d3c7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove `CodeParser::m_currentFile`Luca Di Sera2023-03-074-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `CodeParser`, the base class for parsers of input source file in QDoc, exposed an internal member that stored the path of the file that was currently being parser by an instance of `CodeParser`. The member was set when a new file was being parsed, and required to be handled by all downstream parsers, both in setting and in clearing it at the correct point. Nonetheless, the member is generally unrequired and was indeed not used, as the scope and usages of the path of a parsed file is well-defined and limited during parsing. The presence of the member is a source of bugs. Indeed, not all child classes where correctly handling the lifetime of the member. Further, it generally adds maintenance cost to the child classes and hinders the creation of new derived classes as it increases the mental load and implicit knowledge that is required to implement a `CodeParser`. Hence, the member and all references to it were removed in `CodeParser` and its child classes; to simplify the codebase, remove unnecessary state, avoid the additional classes of bugs that would exist if the member was ever read and as the member represented dead code. `CodeParser::currentFile`, a getter for `m_currentFile`, was removed as a consequence of the member removal. Change-Id: If5b5538d038a073d8288a644fe39d3dddc1d89c8 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Avoid returning a value from `PureDocParser::processQDocComments`Luca Di Sera2023-03-072-3/+3
| | | | | | | | | | | | | | | `PureDocParser::processQDocComments` was returning a boolean value that was unused at its single call site. Furthermore, the method would always return `true` in each and all cases, so that the returned boolean was not representing anything meaningful. Hence, the `PureDocParser::processQDocComments` was modified to have a void return type. Change-Id: Ie217c27d7304b527c4c45965c67861ce3b336a5a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Clean up usage of QDocDatabase::findAll* functionsTopi Reinio2023-03-074-91/+46
| | | | | | | | | | | | | | | | | | QDocDatabase has a set of functions to traverse through all trees in the forest and collect nodes that match specific criteria into static maps for later retrieval. These functions may (and are) called multiple times, so QDoc tries to ensure that each tree/function pair is executed only once, and a reference to an existing map is returned on subsequent calls. Instead of storing a boolean in a Tree for marking it 'analyzed' and having convoluted conditionals for re-executing a search function, maintain a hash of functions per tree that are already processed. This makes the code more readable and maintainable. Change-Id: I6d610e7f86c9e250f0b050fd35f90bdf5d04396b Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Doc: Document \sincelist QDoc commandTopi Reinio2023-03-072-0/+24
| | | | | | | Pick-to: 6.5 Change-Id: I925e1b1afbb62fb582a09921f244d4975f9dc881 Reviewed-by: <safiyyah.moosa@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Exclude designer from dependencies when building EP examplesAlexandru Croitor2023-03-061-0/+3
| | | | | | | | Task-number: QTBUG-90820 Task-number: QTBUG-96232 Task-number: QTBUG-110369 Change-Id: I3b28c7bddee185b046ebe4222c2bb8d96f72cd81 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qdoc: Add meta description header to HTML outputTopi Reinio2023-03-061-0/+6
| | | | | | | | | | | | | | | | A meta description is an HTML element that provides a brief summary of a web page, typically displayed as part of a search engine results page. Use the \brief description for pages that have it. This should cover virtually all of the API reference as type \brief appears on module pages and therefore is rarely missing. Many overview \page's have it as well. Pick-to: 5.15 6.2 6.4 6.5 Fixes: QTBUG-111360 Change-Id: Ie403777fd895a995bbd7d717333e95c1b6b77d89 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* qtattributionsscanner: Add SecurityCritical attributeKai Köhne2023-03-063-3/+19
| | | | | | | | | | | | | | | | | | | Serves as an indicator in the release process that these components need to be carefully monitored and updated (even more often than the other third-party modules). So far this is not reflected in the generated documentation. This might change in the future though. For reasoning, see also https://lists.qt-project.org/pipermail/development/2023-February/043667.html Pick-to: 6.5 Change-Id: I82c59e0198fc2fdc855aed89aa49f929391aa0ef Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDoc: Always depend on QmlPrivatePaul Wicking2023-03-0410-89/+22
| | | | | | | | | | | | | | | | | | | | | | Make Qml a hard dependency for QDoc. - There are no known usecases for running QDoc without qml support. - We're not testing QDoc without qml support, as it's not officially supported. - There are known issues with parsing certain file types when qml support is missing. - Dropping feature checks makes the code easier to reason about and thus maintain. - Clean up some of the configure and CMake configuration that's affected by the change. [ChangeLog][QDoc] QDoc now requires the library QmlPrivate. Make sure the qtdeclarative module is available. Fixes: QTBUG-111673 Change-Id: I3a8aa20ace3c379c3896b9f59aa4e8113cd9a873 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: remove DocParser::terminate() (noop)Paul Wicking2023-03-033-6/+0
| | | | | | | | | | Since dropping support for QDoc's alias configuration variable, DocParser::terminate() is a noop. Drop the method. Task-number: QTBUG-111670 Change-Id: Ic9f1e44d3d87a7c13353dc2538735003febf6484 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Drop support for renaming commands via qdocconf filesPaul Wicking2023-03-0312-241/+174
| | | | | | | | | | | | | | | | | | | | For "compatibility reasons", support for renaming commands through an "alias" defined in a .qdocconf-file was introduced to QDoc. In particular, this was an aid when renaming QDoc's \input command to \include. This usage has since been unified in Qt, with the exception of in QDoc's own documentation project, and the more powerful \macro command can be exercised to achieve the same behavior. This feature's implementation obstructs efforts to make QDoc's code more thread safe. As there are no known usecases, remove support for renaming commands to pave the way for a more performant QDoc. [ChangeLog][QDoc] Support for the 'alias' variable in qdocconf-files is removed. Use QDoc's 'macro' construct instead. Fixes: QTBUG-111670 Change-Id: Ifcf8a47ee1e1940607cec4841e6ba06b493e6d24 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Remove Config::lastLocation()Topi Reinio2023-03-027-195/+199
| | | | | | | | | | | | | | | | | | | Config stored an internal Location, used for error reporting. This location instance was updated whenever a config variable was queried. This prevented parallelization of code that accesses Config via the singleton instance. Remove Config::lastLocation, and move functions that return a configuration variable as a string, string list, boolean, etc. to ConfigVar itself. Keep existing access functions in Config as simple wrappers. Provide Config::get() that returns a reference to ConfigVar, and provide location info via ConfigVar::location(). This allows call sites to get location info for a configuration variable on demand. Change-Id: I72c6f5cec699e44aa2f3164e6019a04adbd1ab07 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Qt Designer: Fix a crash with main windows with no central widgetsFriedemann Kleint2023-03-011-5/+4
| | | | | | | | | | In the container extension for QMainWindow, check if the central widget is actually a managed widget. Fixes: QTBUG-111603 Pick-to: 6.5 6.2 Change-Id: I50161a386084bc90d695461149486f3a7415e317 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Report QLiteHtmlWidget in Assistant's About dialog if usedShawn Rutledge2023-02-281-2/+4
| | | | | | | | | | | | | | It has been confusing for several releases that the About dialog kept saying it's using QTextBrowser. I can't find any evidence that there's even any code to instantiate a HelpViewerImpl right now. Amends 6e7ef34e6c8a2bd130fd5305e4b41fc8b11100a3 which removed the call "new HelpViewerImpl" in the HelpViewer ctor. Pick-to: 6.2 6.4 6.5 Task-number: QTBUG-92267 Change-Id: Ieed2cf3237a07772152f179b9a82a2e35bfed0ee Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Doc: Update \brief description to be genericSafiyyah Moosa2023-02-282-16/+6
| | | | | | | | | | Update the description of \brief QDoc command to be generic and apply to any topic command. Update link targets. Fix spaces. Fixes: QTBUG-111391 Pick-to: 6.5 Change-Id: If41fd64ad420433aa022e7bb92506c06cfc0e76f Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Pervasive conversion of attribution scanner to Qt::StringLiteralsEdward Welbourne2023-02-284-112/+113
| | | | | | | | Map QLatin1String("...") to "..."_L1, QStringLiteral("...") to u"..."_s. Pick-to: 6.5 Change-Id: I2f6b2bf94bbcc982d90363a735d048f7eb5cb946 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* qdoc: Clean up code related to processing of \include'd linesTopi Reinio2023-02-281-20/+14
| | | | | | | | | | | | | * Use qsizetype instead of int. * Remove unnecessary variable 'startLine'. * Replace a while loop with a for loop. * Replace nested conditional statements with (A && B). * Fix a corner case where a lone snippet tag at the last line of included file caused out-of-bounds access of the line buffer. Pick-to: 6.5 6.4 6.2 Change-Id: I0b1009cf122681bcf700b67040a3d0ca19e82378 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Disable -fPIE for tools that depend on 3rdparty libsAlexey Edelev2023-02-242-0/+10
| | | | | | | | | | If the 3rdparty libs are not built with -fPIE enabled we cannot link it to the tools. Disable the flag until provisioning got the proper update. Change-Id: I25aa3dcec480219e3d29225ee517d9a910a1966e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Make it explicit that XLIFF 2.0 is not supportedKai Köhne2023-02-231-3/+2
| | | | | | Pick-to: 6.5 Change-Id: I7b069537b39c657f56e648dc9ac5619fe56ee4f1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Force BUILD_TESTING to OFF for qlitehtmlAlexey Edelev2023-02-211-0/+1
| | | | | | | Fixes: QTBUG-111091 Change-Id: Ia9c2503d4304f9d8223151f9fc07f94cf8855527 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QDoc manual: improve description of argument handlingPaul Wicking2023-02-201-5/+6
| | | | | | | | | | | Move the important block up, so that people notice in the first time they read the docs. Add a sentence to describe the point of enclosing arguments in curly braces. Fixes: QTBUG-109734 Pick-to: 6.5 Change-Id: I245ff686a43c6fd443afdf98a28cd9564e492ed7 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* Qt Designer: Fix palette mask handling to consider single groupsFriedemann Kleint2023-02-205-44/+72
| | | | | | | | | | | | | | | | | Whereas the palette resolve mask in Qt 5 had one bit for all 3 colors of a role, the mask is now a 64bit value with one bit for each combination of role/group. Introduce helper functions (copied from the QPalette source) to get the correct mask bits for each role/group and for all groups of a role. In the multiselection property helpers, check each role/group. In the palette editor, use row masks to clear rows. Pick-to: 6.5 6.4 Task-number: QTBUG-110963 Change-Id: I089a75d03828ff894527601fc111d5e39183e695 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Qt Designer/QtUiTools examples: Drop 'Example' from titlesFriedemann Kleint2023-02-205-12/+11
| | | | | | | | Task-number: QTBUG-110447 Pick-to: 6.5 Change-Id: Ia9c06560f15dfee58a8a441c3791785827b70913 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Qt Designer: Fix exit crash on WindowsFriedemann Kleint2023-02-201-1/+3
| | | | | | | | | | | Deleting the global menu bar deletes the window menu, which causes a crash when form windows are removed later on. Amends 78d807bc05590cd785e485fe1d2b07e86ca9bf79. Pick-to: 6.5 Change-Id: I0789d77323d7c205163bbeb416452d31631c70d9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Handle text in quotes in extra comments in lupdateJohnny Jazeix2023-02-172-4/+16
| | | | | | | | | | Allows to have text in extra comment within quotes that will be kept intact when running lupdate. Fixes: QTBUG-110630 Co-authored-by: Kai Köhne <kai.koehne@qt.io> Change-Id: I267e779193f168a8af067b927735991f2c512145 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update qlitehtml moduleKai Köhne2023-02-171-0/+0
| | | | | | | | | | | [ChangeLog][Third-Party Code] Litehtml (used in Qt Assistant) was updated to upstream version v0.6. Fixes: QTBUG-110353 Pick-to: 6.5 Change-Id: Ib67936cd4493ff84d247fa241a1cc4ef641cf752 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Update screenshots of the Qt Designer examplesFriedemann Kleint2023-02-166-2/+2
| | | | | | | | | | | Remove duplicated identical pictures and replace taskmenuextension-example-faded.png by a normal screenshot since it is hard to maintain. Task-number: QTBUG-110447 Pick-to: 6.5 Change-Id: Iba7ee91dee8fb63af40c1c9b4163d573a1deae5f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>