summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodeparser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * qdoc: Use documentation for implicit special functionsMartin Smith2017-08-101-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow implicitly declared special member functions to be explicitly documented. For example, in class QFuture, the destructor, copy constructor and assignment operatore are implicitly declared, but they are explicitly documented in qfuture.qdoc. clangqdoc no longer complains that it can't find these functions in any header file. It creates them for documentation purposes, and they are documented as expected. Where these function signatures appear on the class reference page, " = default" is appended to the end to indicate that the function is implicitly declared. Change-Id: I7bcf16c31099439f424b438eb41589435d7254b6 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: Clean up the Parameter classMartin Smith2017-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way function signatures are specified is changing. A basic assumption of qdoc was that in the function signature specified with the \fn command, each formal parameter would have a name, and the name would be documentede in the text using the \a markup. This is no longer valid. There are now several cases in Qt where std::nullptr_t is used to specify a formal parameter, and no parameter name is provided. Furthermore, there are a few cases where some other type is used as the parameter type and no parameter name is given. The meaning in the first case is that the function must be called with NULL, and the meaning in the second case is that the parameter is not used in the function implementation. This clean up task must be accomplished in preparation for implementing the changes described above. The Parameter class had become a kludge. The so-called "rightType_" data member (which has not been used for quite a long time now and which was marked for removal long ago) is removed here. The change also affects the <parameter> element in the .index file, where the "right" item is removed and the "left" item is renamed to "type" . This index file change might break 3rd party applications that parse qdoc's index files, but I think there is only one, so be on the lookout for a complaint from that guy. Task-number: QTBUG-58277 Change-Id: I721bebdd5d0f2fcd65324373c3a3ec3ea1c33e26 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: A different way to fix the "signed" problemMartin Smith2017-08-101-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old qdoc parser is still used for parsing \fn commands because clang can't be used to parse code fragments. This causes a problem when the "signed" reserved word is used because clang doesn't keep it if it doesn't add anything to the type, while the old qdoc parser always appends it to the type under construction. The fix here is to let the old qdoc parser hold the "signed" reserved word aside until it knows what the next lexeme is. Then it either appends the held "signed" or discards it, depending on what the next lexeme is. e.g., if the next word is "int" discard "signed" but if the next word is "char" append the held "signed" before appending "char". Change-Id: I67953d964cd09410126d64fa3305c669111e74ce Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: Enable documentation of type alias as typedefMartin Smith2017-08-101-0/+2
| | | | | | | | | | | | | | | | | | | | clangqdoc now handles the type alias declaraction and provides the \typealias command for documenting it. It is documented as a typedef. Task-number: QTBUG-58158 Change-Id: Iee0c8dea66026a89b3625b40b92b056cada893c1 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: Don't report error for things marked \internalMartin Smith2017-08-101-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | This change allows qdoc to avoid printing warnings about a qdoc comment, if the comment contains the \internal command. In these cases, the comment will not be used in the documentation, so there is no point reporting warnings about it. However, if the showinternal option is used, warnings about comments marked internal are printed anyway. Change-Id: Idcb329958681523c79e9f6a3a144ae26d44a6906 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * Parse function pointer types the same way clang doesOlivier Goffart2017-08-101-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an argument to a function is itself a function, use the same representation of its type that clang uses. - Omit spaces adjacent to parentheses - The argument name is not part of the argument type. This is required so types parsed with our parser lead to the same string as libclang gives us. The only function affected in QtCore is qRegisterAnimationInterpolator. Before: void qRegisterAnimationInterpolator(QVariant(* ) ( const T & from, const T & to, qreal progress ) func) After: void qRegisterAnimationInterpolator(QVariant (*)(const T &, const T &, qreal) func) Unfortunately, this means the documentation does not contain the parameter names in the function type. We will probably have to adapt the documentation of qRegisterAnimationInterpolator() to mention the meaning explicitly. Change-Id: I00ba1854869c061fb54c6a53e6eb02b934c20459 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * Use clang as a parser in qdocOlivier Goffart2017-08-101-865/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file qt_find_clang.prf is inspired by qtcreator's clang_installation.pri. The code from the while loop in ClangVisitor::parseProperty contains code moved from CppCodeParser::matchProperty. The code in the for loop of ClangCodeParser::parseSourceFile (from the "Doc parses the comment"), is mostly moved from CppCodeParser::matchDocsAndStuff. In CppCodeParser, most of the code is removed since clang is used for parsing. We just need to leave enough to parse the declaration in the comments which still use the old parser (\fn, ...) Known issues: - When the parameter name is a comment, it is lost. (e.g. QObject::eventFilter(QObject * /* watched */, QEvent * /* event */) - I can't compute default parameters when they are expanded from a macro. (e.g. QObject::tr) - Instances of #ifndef Q_QDOC need to be reviewed Change-Id: I92d4ca4fc52810d9d3de433147a9953eea3a1802 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | qdoc: Improve linking of QML typesTopi Reinio2017-10-271-1/+3
|/ | | | | | | | | | | | | | | | | | | | | | QML types and QML basic types were not autolinked correctly in many instances. - Provide correct context (genus) for code quote commands. This guarantees that the types resolve correctly for a \qml snippet even if there are colliding C++ target names. Note: we do not enforce 'CPP' genus for \code command, as it is commonly used also with QML code. - Similarly for examples, each .qml source file is set to have QML genus. - Remove QML basic types from the hard-coded map for known (C++) types/keywords. This prevented linking to these types. Task-number: QTBUG-62440 Change-Id: I578d8d4675e99cb4ba54171031efd8dc93040160 Reviewed-by: Martin Smith <martin.smith@qt.io>
* qdoc: Further improve example file listingTopi Reinio2017-07-041-2/+4
| | | | | | | | | | | | | | | Fix a bug where '\generatelist examplefiles' with no second parameter produced an empty list, instead of listing all files. Also, no longer restrict the searching of example image files to the images/ subdirectory. All images under a project directory are now listed, except those under doc/images. Minor fixes to related QDoc documentation. Change-Id: Id4516ba2feb98466a0e893a85f85118e3d21eae2 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Fix GCC 7 warnings about unmarked case statement fallthroughsThiago Macieira2017-06-041-1/+1
| | | | | | | doc.cpp:632:39: error: this statement may fall through [-Werror=implicit-fallthrough=] Change-Id: Ia3e896da908f42939148fffd14c48709a6772552 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Use join(QChar), join(QLatin1String) where applicableMarc Mutz2017-03-231-1/+1
| | | | | | | | They're faster/expand to less code. Change-Id: I4d79abb870c7b49784be17dc174ab68d98b1a75d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* qdoc: Implement C++11 'override' specifier supportRainer Keller2017-01-121-3/+5
| | | | | | | Change-Id: Iad837dbdaf492eff77ced4d93dc05095e1d89400 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Michael Winkelmann <Michael.winkelmann@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-051-1/+0
|\ | | | | | | Change-Id: I29e1f5d7d146cc77f8cf92bfbe2e41ffad50a041
| * qdoc: Improve resolution of QML type inheritanceTopi Reinio2016-08-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc maintains a global map of base types for all QML types. This caused issues whenever QML modules have conflicting type names; for example, types from Qt Quick Controls (v1) were incorrectly marked as deriving from QQC v2 'Control' type. To improve the situation, make following changes: - Manage 'inherited by' map in a single location. Types are added to this map in a pre-generate step (QDocDatabase::resolveQmlInheritance()) after parsing all sources. This allows better control of searching - if the QML type node has an import list, the search is now always based on it. - Add a safeguard against using a base type from a module with major version different to the import statement. - Use node pointers as keys in 'Inherited by' map, instead of type-name strings. Task-number: QTBUG-53529 Change-Id: I6665a520c9197fa90e84d67b12e3405b5b3f0901 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | qdoc: Add support for attribution pagesKai Koehne2016-08-081-0/+2
|/ | | | | | | | | | | | | | "\page xx attribution" now marks a page as describing a code attribution, and \generatelist{attributions} generates an overview of all attribution pages. Originally code attributions were meant to be handled by \legalese ... \endlegalese and \generatelist{legalese}. Anyhow, this fails giving more details than the pure license text. Change-Id: I3543f077051b361ce59fe27e50f9719dfa52ced3 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-291-2/+3
|\ | | | | | | | | | | | | Conflicts: src/assistant/assistant/doc/src/assistant-manual.qdoc Change-Id: I136caf5f26eff4d1c2574459b8dff9937c2c372d
| * Less randomness in qdoc output part IISune Vuorela2016-06-161-2/+3
| | | | | | | | | | | | | | | | | | Sort more lists before writing output Extract an existing function for comparing nodes, and use it across the code base Fix up the function to also sort private nodes, it is needed for reliable sorting. Change-Id: I934c875ef3e8a36d0e684f5b67d0ca1b81e5716f Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | Updated license headers and license testsAntti Kokko2016-06-101-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> tools & applications are licensed under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) License header tests also updated to match current headers. Change-Id: Ia6bdacaa3c5bbc9d31334e1a0cabfe502a484dc4 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* | qdoc: Allow example files to be excludedTopi Reinio2016-05-121-3/+11
|/ | | | | | | | | | | | | | | | | | | | | Documentation configuration variables 'excludedirs' and 'excludefiles' had no effect on what source and image files were listed as belonging to an example. This commit fixes that, and refactors excludedirs/files handling: Remove duplicated code blocks, amd simplify the code reading the variables: - Drop checks whether an excluded directory exists - Drop conversion of native separators for excluded paths Both are unnecessary; QDoc expects '/'-separated paths for many other variables, and if an excluded dir does not exist, it won't exclude anything. Change-Id: Ie25511e20d33888653c23bb84975368317eb4306 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* qdoc: Correct source line numbers in index fileMartin Smith2016-04-051-8/+24
| | | | | | | | | | Many function clauses in the .index files show the wrong source file line number for the function declaration. This update ensures that the source file line number is correct. Change-Id: I8494b649be1d1a74e5b057391566503f3d6f1424 Task-number: QTBUG-52290 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: Allows properties in QML basic typesMartin Smith2016-03-091-4/+6
| | | | | | | | | | qdoc now accepts \qmlproperty comments for QML basic types. I didn't test it, but I think most of what was required was added in QTBUG-51125. Change-Id: I81fa6fa75e73f9ac2fab4794191c37730a4e7561 Task-number: QTBUG-40428 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: Avoid more unnecessary qdoc warningsMartin Smith2016-02-261-24/+45
| | | | | | | | | | | Now avoids qdoc warnings for undocumented copy-assignment operators and move-assignment operators. This update also improves the text output by surrounding it with <p> and </p>. There was also a bit of refactoring. Change-Id: I922c7083d17b9b911d81f818f51fe7623a78eb22 Task-number: QTBUG-50630 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: Avoid unnecessary qdoc warningsMartin Smith2016-02-261-17/+26
| | | | | | | | | | | Generates default docs when special class member functions are declared but not documented, thereby avoiding the "No documentation for..." error. The member functions now handled are the destructor, the copy constructor, the move-copy constructor, and the default constructor. Change-Id: I9ddd7841b1dfec907ab3c2ccd7636dc898df1fce Task-number: QTBUG-50630 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: QML basic types can now have methodsMartin Smith2016-02-221-5/+7
| | | | | | | | | | | \qmlmethod now works for QML basic types. Use it the same way it is used for QML types. \qmlsignal should work now too, but I only tested this for methods. There is now not much difference between QML types and basic types. Change-Id: Ie7dfb01dd2ff0b68944b864ebe29d4a95ba7d550 Task-number: QTBUG-51125 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: Second try on Q_PROPERTY with default and final.Karsten Heimrich2016-02-151-2/+6
| | | | | | | | | | This is just because someone decided to use a C++ keyword as property, normaly this should fail, and it will for others like e.g. explicit, friend etc... Change-Id: Ie7f5b295c849d41291adeb3ad89f56800b2b10dd Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* qdoc: accepts C++11 variadic templates ellipsis operatorKarsten Heimrich2016-02-151-1/+1
| | | | | | | Change-Id: I8211aa66a3b8f95a0f75b7b15714efeef71e26ff Task-number: QTBUG-47085 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make sure we allow final and default in Q_PROPERTY.Karsten Heimrich2016-02-111-1/+1
| | | | | Change-Id: I194d9c041d94fc08032003e8a69329902c352e81 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* qdoc: Implement support for C++11 default member initialization.Karsten Heimrich2016-02-091-2/+2
| | | | | | Task-number: QTBUG-49732 Change-Id: Ic30a748359e956affbfddc2162c0f29af1458c31 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* qdoc: Implement C++11 'final' specifier support.Karsten Heimrich2016-02-081-1/+6
| | | | | Change-Id: I9248c0481c44f9ebbbe9df86cad182689288f810 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* qdoc: Implement support for C++11 default/delete declarations.Karsten Heimrich2016-02-081-4/+12
| | | | | | Task-number: QTBUG-50870 Change-Id: I8ce46e41e880ece93c9e6e09f2e01f1047de1622 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* qdoc: Implement support for C++11 scoped enumerations.Karsten Heimrich2016-02-081-0/+7
| | | | | | Task-number: QTBUG-41958 Change-Id: I290dc3f2f3072a1b6884d1484aa9109aa0b99dcc Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* move qdoc back to qttoolsOswald Buddenhagen2015-10-231-0/+2611
we can do that now, as the bootstrap lib is now a properly exported module, and qmldevtools is now bootstrapped as well. this removes the abomination of a copy of the qml parser in qtbase. unfortunately qtbase/2422251ee5025a067b14b989153764ab36e43f10 is reverted, as qtdeclarative is still missing the respective change. this introduces no regression in discoverability or usability, as a full doc build already needed qttools - for qhelpgenerator. Change-Id: Ic9c4c9732ddf5998637b9e42e27939ba50b31479 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>