summaryrefslogtreecommitdiff
path: root/src/qdoc/clangcodeparser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* qdoc: Fix parsing of private signalsTopi Reinio2020-10-201-4/+3
| | | | | | | | | | | Parameters with a type QPrivateSignal were already removed when constructing a FunctionNode from header declaration. This was erraneously subtracted from the number of stored parameters when parsing an \fn command. Fixes: QTBUG-87731 Change-Id: I01409c0fcdab0dfbf8a0b9d22cded99618bdcc2d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Allow documenting implicitly generated special member functionsTopi Reinio2020-10-161-81/+108
| | | | | | | | | | | | | | | | | Implicitly generated class members such as default constructor are not visible in the Clang AST, and QDoc failed to match \fn commands for such functions. Fix this by visiting the translation unit generated for the \fn command, and constructing a temporary FunctionNode. If this temporary node is of any of the special member types that can be implicit, add that function as a child to the class node. Add 'default' attribute for such functions in the generated docs. Fixes: QTBUG-86984 Change-Id: I6c662e4ca030d80b68dd22f3639526093c27c20b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Document friend functions as related non-membersTopi Reinio2020-10-081-5/+5
| | | | | | | | | | | | | | | | | | When parsing a friend declaration in a class, QDoc associated the subsequent function declarations to the namespace scope. This was conceptually correct as friend functions are not class members, but made it impossible to match documentation to these functions using the \fn command; the functions are still found under the class scope in Clang AST, and this has to align with QDoc's node tree for the documentation to be matched correctly. Fix this by letting friend functions remain in the class, keeping track of the friend declarations, and marking friend functions automatically as related non-members. Fixes: QTBUG-86987 Change-Id: I0ad26eed1c72af9302c9e420f5db0ec98c40d86a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Allow module header to contain more than just #includesTor Arne Vestbø2020-10-061-9/+4
| | | | | | | | | For some reason we can't just read this header directly, but need to parse a temporary header that includes the single module header. Change-Id: I573ebe6236b07f3df1dfde2386577dd4f2294508 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Unify clang diagnostics reportingTor Arne Vestbø2020-09-241-33/+40
| | | | | | | Clang's diagnostics are silenced unless debug is enabled with --debug. Change-Id: I1c79c56b6f0d4fd676de99c4a00c951499d4e3a6 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Manage logging category in utilities.h/cppTor Arne Vestbø2020-09-241-1/+0
| | | | | Change-Id: I39ec66fbe95edc42a3dac51e8bc718ee42cc4a2a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Add support for bindable propertiesTopi Reinio2020-09-211-21/+31
| | | | | | | | | | | | | | | | | Add support for the BINDABLE attribute in the Q_PROPERTY macro. The new properties are marked with 'bindable' tag, and the list of access functions/notifier signal is replaced with a descriptive note and a link to QProperty. Read-only properties are also properly marked as such. [ChangeLog][qdoc] The \property command now supports bindable C++ properties that use the new system based on QProperty. Task-number: QTBUG-85565 Change-Id: Ie352b3ce962b6b05a022d444da0991b8a849e474 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: ClangCodeParser: Improve function argument matchingTopi Reinio2020-09-181-85/+26
| | | | | | | | | | | | | | | | | | | | In certain cases, Clang returns a parameter type for a function argument that differs in the header declation and source definition. This can happen if the type has an alias in a different namespace, both namespaces are visible to the source file, and both the type and the alias are included in the pre-compiled header. Resolve these cases by recording the canonical spelling of the header type into Parameter, and comparing it to the canonical spelling from the source file. Remove findFunctionNodeForCursor() as redundant. This makes the fix apply both for /*! */ comments preceding function bodies, as well as separate \fn commands. Fixes: QTBUG-86665 Change-Id: I47566f90adb956095537115ff8e8fcd9c0adffbe Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Fix incorrect loop when processing tagged \fn parametersTopi Reinio2020-08-241-1/+1
| | | | | | | | | | This fixes ASSERT: "uint(i) < uint(size())" in file qt5/qtbase/src/corelib/text/qstring.h, line 1067 Pick-to: 5.15 5.15.1 Fixes: QTBUG-86188 Change-Id: I77e76d45b04561ad1ca63bc526fd7473e8c761f9 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Do not use random access APIs on QMap iteratorsGiuseppe D'Angelo2020-08-141-2/+2
| | | | | | | | Luckily there's a oven-ready function just for this. Change-Id: I6db9cebb614e96b176031025be56a60276581fe8 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* qdoc: Introduce \required command and handle REQUIRED for QML propertiesTopi Reinio2020-07-151-0/+2
| | | | | | | | | | | | | | | | | | | Q_PROPERTY macro now supports the REQUIRED keyword. This is relevant for QML types, where the type cannot be instatiated without declaring all required properties. Make QDoc parse the REQUIRED keyword, set associated QML property as required, and introduce a new command, \required, to do this explicitly in the docs. Likewise in QML visitor, check for the 'required' keyword for properties. [ChangeLog][qdoc] Support marking QML properties as required in the generated documentation. Fixes: QTBUG-85597 Change-Id: Ib8a25c5ebc1183812aec6e672b557c8fb1196741 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Ignore unnamed declarations when retrieving parameter namesTopi Reinio2020-06-301-15/+16
| | | | | | | | | | | | | The Clang visitor returns a CXCursor_ParmDecl also for parameter declarations in the return type, as is the case with std::function wrappers that take parameters. Handling these caused us to omit some of the actual parameter names. Skip declarations that do not provide a parameter name. Fixes: QTBUG-67244 Change-Id: Id5d8d3302fe3580c10814735a0684b83b8d5ebb4 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Port QtTools from QStringRef to QStringViewKarsten Heimrich2020-06-151-4/+4
| | | | | | Task-number: QTBUG-84319 Change-Id: Idb5a41172ea38b2f4edf385d67c1cdc2968a8d8c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDoc: Use QList instead of QVectorJarek Kobus2020-06-091-2/+2
| | | | | | | | Task-number: QTBUG-84469 Change-Id: I88b99ba7f5648d9da7878b7f7723f48cd86be2ac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Clean up members in ClangCodeParserPaul Wicking2020-06-051-76/+76
| | | | | | | | | | * Prefer m_ prefix over _ suffix for consistency. * Use s_ prefix for static. Coverity-Id: 226112 Task-number: QTBUG-79116 Change-Id: Iee15a8e5b257a5b6627715cba23e5c76542dfc29 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Drop commented out code from ClangCodeParserPaul Wicking2020-06-051-2/+0
| | | | | | Task-number: QTBUG-79116 Change-Id: I55abf03b9baa81785b8386ed58ae90497d3ac330 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract NamespaceNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: Ic5e0adbbeb27266ba1a55132a54310021f98fc21 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract ClassNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I3622fe2525b50793f71d027c344127532c2a451c Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract enum Access from NodePaul Wicking2020-06-041-7/+8
| | | | | | | | | | | | | Move Node::Access out of Node and make it a scoped enum, to break circular dependency issues between Node and RelatedClass. This is a requirement to extract struct RelatedClass from Node. Task-number: QTBUG-84578 Change-Id: I13a1ac275d46abcd04f5f712291c77c2f24a65db Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract EnumNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I06f0f91677adc5f0673b1eba414b131def101601 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract TypedefNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I8fbe13faefd918b616f8d0d4bc08077a880b6194 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract FunctionNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I5967054a1c802ac6daf2622dcd4e4c8c4b3977ac Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract PropertyNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I88b684150e797a92e943f064019a418d640065a7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract VariableNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I978797538095b2b82000aff0c16242fa7628c0ac Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Improve handling of templated typesTopi Reinio2020-06-041-10/+22
| | | | | | | | | | | | | | | | | | | | The Clang visitor did not differentiate between templated class-like types, always assuming that it is a 'class'. Fix this by retrieving the type of the specialization the template refers to. Ensure that templated structs and unions are named correctly in the generated output. Handle the type of the cursor that refers to a templated type alias, and improve the code for resolving the template parameters for aliases. [ChangeLog][qdoc] QDoc now correctly handles templated structs, unions, and type aliases. Pick-to: 5.15 Fixes: QTBUG-67432 Change-Id: Ia0fbfe7b7f22a54270650d96d0d67a4b8b8fd182 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Drop half-baked translation effortPaul Wicking2020-06-041-15/+16
| | | | | | | | | | | | | | The current implementation suffers from lack of maintenance. This causes a poor user experience that adds little value, or is even detrimental to perceived value. Work to improve the situation would have to be done at the expense of something else. This patch removes the Q_DECLARE_TR_FUNCTIONS macros from QDoc, and replaces calls to tr() with QStringLiteral(). Fixes: QTBUG-84568 Change-Id: I2df71c27246ca5de816608c887cf359db8f85900 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devTopi Reinio2020-05-291-21/+25
|\ | | | | | | Change-Id: I8c1fc05462e1b99b16d52e4f43b2b4b1aa645152
| * qdoc: properly implement \typealias commandTopi Reinio2020-04-231-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | \typealias was already a command recognized by QDoc, but it was simply treated as a synonym for \typedef and was not documented. Implement proper support for the command: - Add [alias] designation both in type summary and details. - Auto-generate information about the aliased type, including a link if aliasing a public, documented type. - Auto-convert aliases documented with \typedef to type aliases. - Add basic support for aliases also to DocBook and WebXML generators. - Document \typealias. Fixes: QTBUG-82712 Change-Id: Iafa8c7def0a7488d7521fbc2862290a9bb3167ff Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * qdoc: Fix handling of default values for function parametersTopi Reinio2020-04-211-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using an \fn command to document a function that has default values for parameter(s), The Clang parser retrieves a relevant section of the source file that contains the expression for the default value. In case of \fn, the source is a temporary translation unit that was constructed on the fly - but it may not exist anymore, and the default value is lost. Fix this by storing the contents of the temporary TU for later access. Fixes: QTBUG-83472 Change-Id: I20ad9e3322636450db1def65933837c1c767f2c4 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | QDoc: Clean up includesPaul Wicking2020-05-041-2/+1
| | | | | | | | | | | | | | | | | | * Remove unused includes * Replace deprecated C++ includes with counterpart. Task-number: QTBUG-71176 Change-Id: Ie3224d9f9c19fd8f93879de6c7604a8db421b88b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devAlexandru Croitor2020-04-151-17/+25
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: a bunch of .pro and configure.json file adjustments and some conflicting cherry-picks from dev -> 5.15 that are merged into dev again src/assistant/assistant/main.cpp Change-Id: I174c00b6a300c6d46c4e081bdcb2f15f23ae9ef2
| * Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-03-241-17/+24
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/qdoc/clangcodeparser.cpp Change-Id: I2ba822fde6c50ea782839de7d5cb155354c33b52
| | * QDoc: Fix handling of -isystem optionDmitry Shachnev2020-03-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When qdoc is built with QDOC_PASS_ISYSTEM define, it is possible to pass -isystem options to qdoc, and it will forward them to clang. Commit ce895f066579f71d fixed handling of the -F option, this commit fixes the -isystem option in a similar way. Change-Id: I876546650354ca3ee7f6edd216fd38b3d1a17285 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
| | * QDoc: Fix handling of -F optionEike Ziller2020-02-271-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though it was documented to use -F to pass framework paths to QDoc (macOS), that was not working and instead passing "-I-Fthe_path_that_was_specified" to Clang. [ChangeLog][qdoc] Fixed "-F" option on macOS Task-number: QTBUG-82252 Change-Id: Ib85e3affad5487e428a8eccf0c239b437c75b759 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * | qdoc: Add -fvisibility=default to the default arguments passed to ClangTopi Reinio2020-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This resolves some potential compile issues related to standard GCC headers. Fixes: QTBUG-69560 Change-Id: I17e0a90eca4384cd8b2171e53cee83cc77f7e1ab Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devPaul Wicking2020-03-111-3/+4
|\ \ \ | |/ / | | | | | | Change-Id: I7956e542a44db1a4e5589dccc267b7c306a50975
| * | qdoc: ClangCodeParser: Clear the stored namespaceTopi Reinio2020-03-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After processing a source file, we need to clear any potential stored namespace scope. Left uncleared, if the next source file is not parsed with Clang but still use ClangCodeParser::parseFnArg(), the incorrect scope is applied. Change-Id: Iba1e791ac01c0f1c699a808ce644b4edbb682399 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * | QDoc: Clean up whitespace in log messagesPaul Wicking2020-03-091-3/+3
| | | | | | | | | | | | | | | Change-Id: Ib7dbb54c0a2d8ea7b754edc8fb7d2175471acc38 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devPaul Wicking2020-03-041-10/+8
|\ \ \ | |/ / | | | | | | Change-Id: I211a32a441c5b465321770fc3d14b91eea33fb67
| * | QDoc: Disentangle Generator and ConfigPaul Wicking2020-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Keep track of use of DocBook extensions in Config. * Let Location query Config about use of Timestamps in logging. * Set writeQaPages in Config and get it from there. * Let Location query Config about whether logging is enabled or not. * Let Config track if QDoc is running in single or dual exec mode. * Move phase information to Config and track the current phase state there. * Remove the inclusion of generator.h from config.cpp, clangcodeparser.cpp. Task-number: QTBUG-82106 Change-Id: I06c8aeb40417e5c83cfa693f5f1ab2c210d34469 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * | QDoc: Use logging category over logToStdErrAlwaysPaul Wicking2020-03-041-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use the logging category framework for all log messages that used to be issued by logToStdErrAlways. Remove the method so that it doesn't suddenly creep back in. Change-Id: I65131bd01b5c79d6eab9619d9bb9b7bf6ff279c1 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-031-1/+1
|\ \ \ | |/ / | | | | | | Change-Id: Iff33dc736e4844af2c1c8e227ef1145d77fc1d85
| * | Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I7137cf8339bfe9fdcf4cb7cc695cb146aef410fb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-251-6/+24
|\ \ \ | |/ / | | | | | | Change-Id: Iabcee67b9cf246cd5f1fe97205ed41b4763210ec
| * | qdoc: Store and use the current namespace scope for \fn commentsTopi Reinio2020-02-181-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing \fn commands for member functions of classes declared under a namespace was error-prone as QDoc required the fully qualified paths for the function signature, even though the documentation comment was located under the correct namespace scope. Store the scope by backtracking the Clang AST until we reach the level of the translation unit, and store each encountered namespace declaration into a list. When generating the temporary source file for an \fn command, we can then recreate the correct namespace hierarchy. This does not break the existing \fn command usage as it's perfectly valid, even if unnecessary, to provide fully qualified paths in the function signature. [ChangeLog][qdoc] QDoc is now aware of the namespace scope of an \fn command without requiring fully qualified paths. Fixes: QTBUG-82190 Change-Id: Ia446c19d130b2ef48b16b67e4dfcbdaab1f9d4f5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-181-4/+3
|\ \ \ | |/ / | | | | | | Change-Id: Iddb27e0884cb095f46fd668a2b8d64dc6dd4f58d
| * | QDoc: Format according to stylePaul Wicking2020-02-141-4/+3
| | | | | | | | | | | | | | | | | | | | | Run clang-format across QDoc, this is the result. Change-Id: Iaabad0a07a0495990013cbf5995c65db531a7d0d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-081-2/+3
|\ \ \ | |/ / | | | | | | Change-Id: Ib8c7aa10dc0aa93ec4572a10b0cd39d9686f0523
| * | qdoc: Correctly resolve qualified path of external base classesTopi Reinio2020-02-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Often, a documented class inherits from a base that lives in another documentation module. QDoc recorded only the class name of such bases, omitting any qualified path. Fix this issue in the Clang-parser. Add an autotest for verifying documentation with cross-module inheritance and links. This requires adding a mechanism for copying the generated .index file(s) into a location where QDoc searches index files in. Fixes: QTBUG-81793 Change-Id: I4019a1ca3a0e4c69bccc1a92740fd51907bfb24d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | QDoc: Bump std version to c++17Mårten Nordheim2020-02-071-1/+1
|/ / | | | | | | | | Change-Id: I3d21b12f3c4fe5be2e64db73b9367dd4b85b39ab Reviewed-by: Paul Wicking <paul.wicking@qt.io>