summaryrefslogtreecommitdiffstats
path: root/src/qdoc/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QDoc: Remove Location::nullPaul Wicking2020-02-121-5/+5
| | | | | | | | | As Location is not a CoW class, the use of Location::null over Location() seems unfounded. Remove the static null object and replace its use. Change-Id: I27dd4dfabffbfedb4f310dac43614e1ebb03c522 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Move logging to helper methodPaul Wicking2020-01-301-13/+24
| | | | | Change-Id: I39d10454442178e6f1292d136eea8ee990ad162f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* clang-format QDocPaul Wicking2019-12-171-50/+53
| | | | | | | | | | | | | | | | This patch is the result of formatting all of QDoc's source with clang-format. The clang-format style is from the qt5 super repo's _clang-format definition. The purpose is unify the style across the code, to avoid spending too much time on style related issues in reviews and cleanup patches. Future changes to QDoc can benefit from using git-clang-format in combination with the git commit hook provided in qtrepotools.git as mentioned in this email to the dev list: https://lists.qt-project.org/pipermail/development/2019-October/037682.html Change-Id: I8af6a051c8334b5f35862a4dcd3becce8ac500c2 Reviewed-by: Martin Smith <martin.smith@qt.io>
* QDoc: Minor cleanup in main.cppPaul Wicking2019-12-121-48/+42
| | | | | | | Simple cleanup to improve readability. Change-Id: If9ee2947ad76e64d230584a3cb36e51457f643c3 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Use QVector instead of QListPaul Wicking2019-12-121-2/+2
| | | | | | | | | | | Replace the use of QVector in most of QDoc. Also, remove one redundant C-style cast to int for result from method call that returns an int. As this happened in a macro, the result is removing a whole bunch of nagging from code inspection. Fixes: QTBUG-80669 Change-Id: Ib1aed95e01eaddd1e1213a145e815a0c4753ac67 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDoc: Clean up whitespacePaul Wicking2019-12-111-16/+16
| | | | | | | Fix minor whitespace issues accodring to style. Change-Id: Ie56e815f23f25ccb1b2ffb03780b9e4c6b9d25eb Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Clean up loops with iteratorsPaul Wicking2019-12-101-25/+17
| | | | | | | | | | | - Use ranged-based fors where applicable. - Use auto keyword for iterators. - Move a few variable declarations to where they're to be used. - Update docs where applicable. Fixes: QTBUG-80536 Change-Id: I859440b96428dec4ef108b01d391479d3f8dbd83 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Ensure the output subdirectory is used for locating dependenciesTopi Reinio2019-11-181-14/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2b6c90317 allowed QDoc to load all available index files if 'depends = *' configuration was used. This could still fail when output from multiple modules is directed to the same location (single-dir output mode). QDoc correctly adds the output directory as a place to look for index files, but because that output directory is also added as a dependency, it was removed from the list of sub-dirs to look into once that dependency was processed. This meant that all the subsequent dependencies could not be located. Also, there's a fundamental difference in how we must resolve the dependencies; without .nosubdirs, QDoc takes the subdirectories of -indexdir entries and treats them as dependencies. With .nosubdirs, we need to look for actual .index files in the -outputdir and load all of them. Finally, move the logging line for 'depends = *' further down, so that we can print out the number of resolved dependencies. Task-number: QTBUG-80051 Change-Id: I35ff5c22e8e1f7e2b0c7de798531ad1c72813e51 Reviewed-by: Martin Smith <martin.smith@qt.io>
* qdoc: Allow a documentation project to load all available index filesTopi Reinio2019-11-141-3/+9
| | | | | | | | | | | | | | | QDoc recognized '*' as a valid input for the 'depends' qdocconf variable, with the intent to load all available index files. This did not work as we cleared the resolved dependencies by re-fetching the depends string from Config after resolving the dependencies. This fix is a backport of another commit that is targeted for the dev branch, but this useful already for 5.14. Fixes: QTBUG-80051 Change-Id: I1d752208078452f4b16b1d855cdb67b8cbabf1f4 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Remove QDocGlobalsPaul Wicking2019-10-141-73/+37
| | | | | | | | | | | | | | | | | | This change moves the setting of configuration options from QDocGlobals to Config. This allows for the removal of the entire QDocGlobals class. Some methods (getters/setters) are part of the move, others were used exclusively by Config:: and are therefore dropped entirely. Also, move the ownership of QDocCommandLineParser from main() to Config - this makes Config the authoritative source of all settings, whether from the command line or .qdocconf variables, and makes it possible to reset() the full state of the Config. Finally, remove the QDocGlobals auto-test, as it is no longer needed. Change-Id: I8e39931c828c763cb0462cbbdf3fe1a39b2ad70b Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Minor clean-up in main.cppPaul Wicking2019-10-101-2/+3
| | | | | | | | | - Reserve memory for container - Use range-based for loop Change-Id: Ia37e4ab1d14b4243ea40dca147acffdd86d021ca Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Use range-based for instead of foreachPaul Wicking2019-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces the use of foreach with range-based for throughout QDoc. It also ensures that the loop body doesn't modify the container being iterated over, by: - Making a const copy when the container is a member variable or the result of an expression, and iterating over that copy. This is the preferred approach. - Using qAsConst() when the container is a (static) member variable or local to the method and not const. The latter is typical where the collection is sorted immediately before the loop. In two cases (doc.cpp), replaced Q_FOREACH + delete with qDeleteAll. In two cases (cppcodeparser.cpp), the range declaration is replaced within the loop statement. These rewrites express the behavior clearer than the original code. In two cases (codeparser.cpp), use a range-based for instead of a while loop where the condition is an iterator, for more expressive code. Finally, use the auto keyword where appropriate and improve a few variable names. QDoc warning count and generated output is unchanged after this refactoring. Change-Id: I64f02d24dca373a3a41402d535382e2c526bb55e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDoc: Move setting of configuration strings from main to ConfigPaul Wicking2019-09-261-9/+1
| | | | | | | | | | | | | | | This change moves the setting of configuration values from main's processQdocconfFile() to an overload of Config::setOptions(). This is done as a first step in a move to set configuration values in the Config class, without going via the QDocGlobal class. Thus, we can eliminate large parts, if not all, use of the QDocGlobals class. As a nice side-effect, this also saves redundantly repeating the same transcribing of data from globals to config, once or twice as many times as there are qdocFiles. Change-Id: Iaa11008b9c67781f7ff004a8be4675a02610f58f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Minor cleanup in main.cppPaul Wicking2019-09-261-3/+2
| | | | | | | | Move a variable to where it's used. Remove unused code that's been commented out. Change-Id: I240265c8eded345b40c988fa50e1618bff530345 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qdoc: Fix regression in single-exec modeTopi Reinio2019-09-181-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A regression was introduced when refactoring QDoc's config system: the processQdocconf() function in main.cpp no longer constructs a new Config object; instead, it sets some config values using Config::setStringList(). However, unlike its name would imply, this function did not (re)set a config variable, it added to it. As a result, when in single-exec mode, the first call (prepare phase) to processQdocconf() worked as expected, as the default boolean variables were set as QStringList("false"), which is correctly evaluated to false. During the second call (generate phase), calling Config::setStringList() again resulted in 'false' boolean variable to be stored as QStringList("false", "false"), which evaluates to true. These boolean variables include REDIRECTOUTPUTTODEVNULL, which unsurprisingly caused problems as it was always set for single- exec builds. To fix this, make Config::setStringList() behave as its name implies, add insertStringList() function to add to an existing variable, and fix the code that tried to combine two string lists to use this new function. Fixes: QTBUG-77897 Change-Id: I62282f31c35e47e4791919688adb4ff49fd2e2df Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Remove QDocCommandLineParser's dependency on QDocGlobalsPaul Wicking2019-08-221-1/+2
| | | | | | | | | | | | | | | | | | | | This change moves a large chunk of code from QDocCommandLineParser::process() to a new method in QDocGlobals, setOptions(), which takes a QDocCommandLineParser and updates QDocGlobals accordingly. Two convenience methods are added to aid in setting these parameters. The change also removes the empty constructor in QDocGlobals, as it isn't needed. By now, QDocCommandLineParser no longer has external dependencies and can therefore easily be unit-tested. Task-number: QTBUG-71165 Task-number: QTBUG-71176 Change-Id: If67c841c3b0a2dbcc444bec92177e27e62288e6c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Get rid of old #if 0 blocksPaul Wicking2019-08-161-4/+0
| | | | | | | | | | Most of these have remained unchanged since 2015, so it seems it is simply not needed. In any case, these lines of code are all contained in the git history. Change-Id: I1bda6bc0aad61d59ec2f83de31d29e17d5255b71 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Further detangle QDocCommandLineParser::process()Paul Wicking2019-08-141-1/+25
| | | | | | | | | | | | | | | | | | | | This change removes QDocCommandLineParser's dependency on Generator and Location. The calls to their static methods are moved to a new helper function in main.cpp, postProcess(). Thus, QDocCommandLineParser no longer sets values in Generator or Location. QDir was included via Generator, and is therefore added as an include in QDocCommandLineParser. This change further clears up QDocCommandLineParser's external dependencies, to make it easier to test the class separately. Task-number: QTBUG-71165 Task-number: QTBUG-71176 Change-Id: I2a024d57d50f84f9271672b6a753e677b748f1b6 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Set default Config options in Config's constructorPaul Wicking2019-08-141-13/+0
| | | | | | | | | | | Move the setting of configuration defaults from QDocCommandLineParser::process() to Config::Config(). In the process, eliminate QDocGlobals::defaults() and its test. Task-number: QTBUG-71176 Change-Id: I97adbfd93b0c31130aab6cfcb10dfe7ffa458b9d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Clarify dependency between QDocCommandLineParser and ConfigPaul Wicking2019-08-141-1/+2
| | | | | | | | | | | | | | | | This change removes QDocCommandLineParser's dependency on the Config class, and moves the responsibility of setting configuration values to Config. This is done by turning QDocCommandLineParser into a struct, and making the QCommandLineOptions in it public. In Config, the new setOptions() method takes a QDocCommandLineParser from which it reads the values it needs. This moves QDocCommandLineParser one step closer to being easy to test. Task-number: QTBUG-71176 Change-Id: I2ee6e8cb6f5ff0f5d70a298ac99e3521a6f98ad9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Extract helper functions from Generator to UtilitiesPaul Wicking2019-08-091-2/+3
| | | | | | | | | | | | | | | | | | This change adds a new Utilities namespace to QDoc. This namespace holds QDoc-internal utility methods. The first few methods are debugging methods extracted from Generator::. Generator is then changed to make use of the same methods from Utilities. As a concequence of this, Utilities is also introduced to ClangCodeParser and main. This enables further refactoring of several classes, including the QDocCommandLineParser class. The purpose is to clarify dependencies and reduce entanglement, so that QDoc's classes become easier to test. Task-number: QTBUG-71176 Change-Id: I5838fc2d933f78db682cb6e4755d31bb48175fcb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Clean up whitespacePaul Wicking2019-08-081-6/+6
| | | | | | | | | | | Ensure that QDoc conforms to Qt style, whitespace edition. For the most part, the change involves moving the pointer operators. Also remove whitespace following an opening parenthesis, or immediately preceding a closing one. In some cases, adjust the following line accordingly in methods that span multiple lines. Change-Id: I56ae125a2acf09c669c0a73dc814d05f13575f39 Reviewed-by: Martin Smith <martin.smith@qt.io>
* QDoc: Ensure all includes are uniform and according to stylePaul Wicking2019-08-031-14/+15
| | | | | | | | | | | | | | | | | | | Housekeeping. Includes are organized after recommended best practice and organized in the following order: - include self (i.e. include own header) - include local files - include Qt, e.g. <QtCore/qstring.h> - include Qt private - include externals, e.g. stdio.h in alphabetic order within each block, aside from accommodating #if-ery, in which includes follow the block they belong to. Also, updated copyright notice to year of latest edit in each file. Change-Id: I1e6b215f172fd5373d57016f7678b88b9e73231e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: make the Config a parameter instead of a globalPaul Wicking2019-07-261-14/+14
| | | | | | | | | | | | | | | | | | | | | This shall make it easier to test QDoc, by making mocking possible. This change moves the instantiation of Config:: to reside inside main(), so that it can be passed as a parameter where it is needed. This object is then passed to QDocCommandLineParser::process(), so that it can be changed via the object itself rather than via statics/globals. This improves the testability of the QDocCommandLineParser class, as the Config object can easily be mocked. This change also replaces a couple of foreach() uses in main.cpp with range-based for. Task-number: QTBUG-71165 Task-number: QTBUG-71176 Change-Id: I7b98dfc36895cd88fe54dcc9ce31b75aab820b3b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QDoc: Accept command-line arguments from @-filesPaul Wicking2019-07-251-1/+1
| | | | | | | | | | | | | | | | | | This enables QDoc to read files given as command-line arguments that are prepended with '@'. Such a file can include any and all valid command-line arguments. Specifically, this lets the build system pass include paths as a file, which may be a requirement in certain Windows environments due to a platform limitation. argumentsFromCommandLineAndFile() was shamelessly stolen from moc. As adding unit tests here basically calls for refactoring the qdocCommandLineParser class, it was decided to test this in production. As it works for moc, the assumption is that it will work also for QDoc. Task-number: QTBUG-68259 Change-Id: I71698f6514b1343f0a99e7deef82857c1739742e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Remove dummy class, rename variable and expand commentPaul Wicking2019-07-101-1/+7
| | | | | | | | | | This change removes a dummy class in favor of instantiating its base class, and renames that instance to make it clearer what it does. The change also expands on the related comment to make the rather unintuitive behavior more immediate to the reader. Change-Id: I666b2281660cd2fabf21c2a441c7254d76058752 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-291-0/+4
|\ | | | | | | Change-Id: Ibe9557a8639e2717c646b40ad25511e7bea55168
| * qdoc: Don't let qdoc run without a project nameMartin Smith2019-06-191-0/+4
| | | | | | | | | | | | | | | | | | | | qdoc can't produce useful output if the project variable is not set in the qdocconf file. This update ensures that the project name is not empty. If it is empty, qdoc emits an error message in its log and terminates. Change-Id: Ic8d84987efe551651a06d720486960c4c62cb8a8 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Revert "QDoc: Remove unused code"Paul Wicking2019-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e6d86264bc145fe543bcfe534737f6c7fb7f584d. Reason for revert: The instance of the empty PlainCodeMarker class is used by logic that expects a CodeMarker as the last element in the CodeMarker::markers list. Removing this class thus resulted in undefined behavior and random hangs running QDoc. Change-Id: Ifb17d0eba784efaa6e29e10607a85bf824ab3469 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | QDoc: Remove unused codePaul Wicking2019-04-081-1/+0
| | | | | | | | | | | | | | | | | | | | The PlainCodeMarker class in unused except for being instantiated in main.cpp. This patch removes the unused code to reduce clutter. Task-number: QTBUG-71165 Change-Id: I63a26df703d23f2ea8f79b4fc9ada9a3e7d51bb2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Martin Smith <martin.smith@qt.io>
* | Fix deprecation warnings about deprecated container conversionsFriedemann Kleint2019-05-231-2/+4
|/ | | | | | | | | Fix warnings introduced by qtbase/92f984273262531f909ede17a324f546fe502b5c. Change-Id: Iaca85ad36591f7208f63305b885e7ff59c014a72 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* qdoc: Major clean-up of FunctionNode and parameter processingv5.13.0-alpha1Martin Smith2019-02-061-22/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This update was motivated by the need to correct two known issues in qdoc. First, linking to overloaded functions failed in some cases because the overloads were not numbered consistently, causing links to go to the wrong overload or to nowhere at all. Second, the mechanism for handling the \relates command didn't support using it to relate a function to more than one class. For example, there are many global qHash() functions spread around QtBase. Each is meant to compute a hash index for an object of some class type, so the object can be inserted into a QHash map for that class type. It is then desired to relate qHash(type Xxx, int seed) to both QHash<type> and class Xxx, so that the documentation for that qHash() function appears as a related non-member function of both QHash<type> and class Xxx. The example above also illustrates the overload numbering problem, because all these qHash() functions are overloads of the name qHash. To make matters worse, they are not all in the same module. Most of them are in QtCore, but a few are in QtNetwork, and this distribution problem will become worse over time as more qHash() functions are added. Prior to this update, qdoc was unable to relate a function to something in a different module, or it didn't always work. While designing a fix for these issues, it became clear that the processing of the FunctionNode and the function parameters would have to be rewritten. That's what this update does. These are the main points: 1. A new subclass of Node is added to act as a proxy for a class in another module. This ProxyNode acts as a place holder for the functions (and possibly other elements) that are related to a class in another module. This is used for the qHash() functions in QtNetwork that are related to QHash in QtCore. qdoc generates an html file named qtnetwork/qhash-proxy.html that contains the documentation for these functions. But these functions are listed as related non-members on the QHash class reference page in the qtcore output directory. They are listed there in the summary, but they link to the qhash-proxy.html page in qtnetwork. 2. A new, Parameters class is added to qdoc (parameters.h and parameters.cpp), and the class Parameter is moved there from node.h. class Parameters replaces the old QVector<Parameter> wherever it was used. This encapsulates all the parameter processing and matching in the Parameters class and simplifies the code at all the places where QVector<Parameter> had been used. 3. The assignment of overload numbers is now done in the normalizeOverloads() function, which is called after all the headers and sources have been processed but before the generate phase begins. This assignment is a simple renumbering now because all the overloads of a function are linked to each other via a nextOverload_ link in the FunctionNode. The first function named qHash() is inserted into the Aggregate node's function map, but subsequent qHash() FunctionNodes are not entered into the function map but are linked to the first qHash() via its nextOverload_ link. 4. The \relates command can now be used multiple times in a single qdoc comment. There remains some work to be done here because this currently only works for global entities, but there are several cases where \relates has been used in the qdoc comment of a member of a class. This will be fixed soon, I believe. When qdoc sees the first \relates Xxx command, for example for qHash(Yyy, seed), that qHash() is a child of the global namespace. qdoc allows it to remain as a child of the global namespace but it tells class Xxx to "adopt" that child (see Node::adoptChild()). This function makes this instance of qHash() be a child of class Xxx (in this case QHash<type>), so that the parent of this qHash() becomes Xxx. After this "adoption," qHash() is a child of both the global namespace and class Xxx, but qHash() only knows it is a child of Xxx, i.e. its parent pointer is Xxx. If this is the first qHash() to become a child of Xxx, it is inserted into the function map of Xxx, but its nextOverload_ link is not changed. This is because all the global qHash() functions have already been linked into the nextOverload_ linked list, and this list must not be changed. Hence, when qdoc searches for qHash(something) to make a link to it, it will find it as a child of the global namespace, but it will correctly link to it using its actual parent pointer. When qdoc sees the second \relates Yyy for this qHash() function, qdoc sees that this FunctionNode has already been made a related non-member of Xxx, so it can't let Yyy "adopt" it. Instead, it tells Yyy to clone this qHash(), which creates a shallow copy of it but resets its nextOverload_ pointer to nullptr. I believe this clone of qHash() won't be found in a search for a function named qHash(), because the global one (the adopted one) will be found first. Or, if it is found, a link to the clone will be generated, but that's ok because the documentation is identical. Note that the existence of qHash in two child lists is taken into account at destruction time. The only place where a Node is destroyed is in the destructor of Tree, which destroys the Node tree from the root down to the leaves. Each aggregate node is responsible for deleting each of its child nodes, but it only deletes a child node if it is the parent of that child node. All of the above revealed that some of the findFunctionNode() functions were either no longer needed or weren't being called in the first place, so they were deleted. This change is now ready for testing. Change-Id: I6da3e2e9e71d39a29d90e073ed614309a49e3d4c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Let qdoc print better log messagesMartin Smith2018-10-231-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change enables qdoc to print better log messages. A new logging function is added to Location, where the qdoc error and warning functions are located. The new function is logToStdErrAlways(msg). It always formats msg for output to stderr by prepending the current time and the word LOG. Several LOG messages are now sent to stderr. Also, qdoc now always tells clang to output its parsing errors to stderr during the building of the precompiled header in the prepare phase. These clang parser errors are easily identified in the new LOG. When no include paths are passed to qdoc on the command line, which is the case for QtPlatformHeaders, qdoc guesses some reasonable include paths from the information available and passes them to clang. It works ok for the QtPlatformHeaders module. However, clang gets lost in some NSOpenGL headers and prints quite a lot of useless parse errors, so we arbitrarily turn off clang's parse errors whenever qdoc has to guess the include paths. The guessed include paths are printed in the LOG, and a warning that clang does not print parse errors when the include paths are guessed is also printed in LOG. Change-Id: I8e5bd0cc5b27463c4c85c9cdcc01b030ac03a1c1 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Refactor command line parser class out of main.cppPaul Wicking2018-10-121-246/+47
| | | | | | | | | Move command line parser class out of main. Fix bug in QDocGlobals that caused include paths to break, by pushing one instead of two strings into a stringlist. Change-Id: I08b7eb02f1e3cf6e9ad33dc24322886ca2dc2fcd Reviewed-by: Martin Smith <martin.smith@qt.io>
* QDoc: Move global variables out of main.cppPaul Wicking2018-10-111-95/+86
| | | | | | | | | | | | | | | | | This change moves most of the global variables out of main.cpp, and into the new qdocglobals class, with getter and setter functions for each variable. It also introduces the basic structure for autotests for QDoc. The motivation is to increase the testability of QDoc, as well as to simplify any future refactoring. Change-Id: If71ba9f1837e759aa75b1c9fec326d72c41c4fcf Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Ole-Morten Duesund <olemd@odinprosjekt.no> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Change zero as null pointer constants to nullptr in main.cppPaul Wicking2018-10-041-3/+3
| | | | | | Change-Id: Ic48cb25019e0617938ee2c4ef74ee89309f5f8f9 Reviewed-by: Ole-Morten Duesund <olemd@odinprosjekt.no> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-301-3/+7
|\ | | | | | | | | | | | | Conflicts: src/androiddeployqt/main.cpp Change-Id: I3df907e197b1b976f74562f1a9cce10261f166f3
| * qdoc: Prevent duplicated example entries in annotated listTopi Reinio2018-06-221-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMultiMap where the example nodes are collected allows duplicate (key, value) pairs. QDoc analyzes the tree multiple times and we may end up with multiple copies of the same entry in an annotated list for examples. Also when listing the examples, use navigation.landingtitle as the (module) section title, with navigation.landingpage as fallback. This prevents html file names as section titles which look bad. Task-number: QTBUG-69079 Change-Id: I24199137856d9775078b7780e5b52642ec5acbbc Reviewed-by: Martin Smith <martin.smith@qt.io>
* | qdoc: Refactor section constructionMartin Smith2018-06-011-1/+0
|/ | | | | | | | | | | | | | | | | | | | | | qdoc outputs a standard list of sections for C++ classes, namespaces, header files, etc, and for QML types. The code for constructing the lists of section data structures was include in the CodeMarker class hierarchy, but it should not have been located there because it doesn't have anything to do with documentation markup. The result was that the CodeMarker classes (CodeMarker & CppCodeMarker) contained many member functions that should have been isolated in separate classes. This update creates those separate classes and refactors CodeMarker and CppCodeMarker by removing the classes used for creating the lists of sections into a separate Sections class. This refactoring not only makes the code cleaner, it also enables implementation of the custom sections idea described in QTBUG-45725. There is a lot more work to be done for this task. Change-Id: I950a78aa31c6b5f206854efa16363b992e9bfea5 Task-number: QTBUG-45725 Reviewed-by: Martin Smith <martin.smith@qt.io>
* qdoc: Distinguish between undefined and defined-as-empty config varsTopi Reinio2018-03-281-1/+1
| | | | | | | | | | | | | | | | Make Config::getString() return an empty string for variables that are defined as empty, while continuing to return a null string for undefined ones. Use a defined-as-empty 'moduleheader' variable: moduleheader = to mark a documentation project that doesn't need a precompiled header to be built. Change-Id: I2ccb631c73a1b91dc35955e5f21648db88915064 Reviewed-by: Martin Smith <martin.smith@qt.io>
* qdoc: Don't pass -isystem to clang without setting QDOC_PASS_ISYSTEMMartin Smith2018-03-221-0/+2
| | | | | | | | | | | | This update surrounds the adding of -system parameters to includePaths with qdoc will not pass any isystem includes to clang. This update also simplifies some if statements in the help project writer by using some existing convenience functions in place of comparisons to enum values. Change-Id: I35d89501dcb51a98af6a6c3278f0f071ceb78259 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Revert the heinous sysinc hack qdoc needed for clang 3.9v5.11.0-beta2Edward Welbourne2018-03-071-31/+1
| | | | | | | | | | | | This reverts commits c95cba39a68bea4dc4c3c003e768412f0640e24f and 65d817345faf34cf9e5cc4f203b276de906fd84a. Apparently clang is now smart enough to handle its system include paths itself; and trying to "help" was causing problems. It was, in any case, a heinous hack. Task-number: QTBUG-66746 Change-Id: I485c6acddfd89f91a4b719f2e2e049ff76a61ce9 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Fix bugs in resolving inheritance and finding overridden functionsMartin Smith2018-02-231-2/+1
| | | | | | | | | | | | | | | | | | | | | A class node must have pointers to the class nodes of its base classes, but these pointers might not exist when qdoc creates the class node for the class. They might not exist until all the index files and include files have been parsewd. qdoc was trying to resolve the base classes too early. This update lets qdoc wait until it is known that everything has been built before attempting to resolve inheritance. This update also delays finding the pointer to the function node for the overridden function for a function marked "override" until the pointer is needed. Instead of storing the pointer to the node, the qualification path to the function is stored as a string, and the string is used to look up the overridden function when it is needed, which is only when the \reimp command is processed during output. The function that resolves the pointer to the overridden function was moved to the function node class, where it makes more sense. The way a few qdoc warnings are reported was also changed. Change-Id: Ia54642d11242386ae75139065f481e5d30f79fb5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Add a logging categoryFriedemann Kleint2018-01-311-15/+20
| | | | | | | | | | | | | Remove the debug functionality from the Generator class and add a logging category instead. Add some debug statements outputting the command line arguments and clang arguments. This makes it possible to obtain logging output by setting for example QT_LOGGING_RULES=qt.qdoc.debug=true . Task-number: PYSIDE-363 Change-Id: I3ecfe548e14aa3e2d03f19d07fc61a2647b75111 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Merge remote-tracking branch 'origin/wip/qdoc-clang' into devLiang Qi2017-11-131-18/+71
|\ | | | | | | | | | | | | | | | | Conflicts: src/qdoc/cppcodeparser.h src/qdoc/location.cpp src/qdoc/qmlcodeparser.h Change-Id: I2e579ca5d83cd1c4b42acc9a07066d800cbc02cb
| * qdoc: skip the system include hack on MS-WinEdward Welbourne2017-09-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix-up for "qdoc: Find the system include path if not provided"; MSVC complained about "definition of dllimport function not allowed" due to the hack's insertion of code to define (rather than just declare) a function in locale.h; so this commit wraps the hack in Task-number: QTBUG-62878 Change-Id: Ic3fe9280b1b4a84ca569f448351f3a751a79caa5 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: Use clang to parse \fn commandsMartin Smith2017-09-061-1/+1
| | | | | | | | | | | | | | | | qdoc now uses clang to parse \fn commands. It even handles the multiple \fn case. Change-Id: I259fcdfc1bf180d32ef1cc9886a48aa3006e18fb Reviewed-by: Martin Smith <martin.smith@qt.io>
| * qdoc: Use correct method to set the hash seed to 0Martin Smith2017-08-101-1/+1
| | | | | | | | | | | | | | | | The method used for resetting the hash seed has changed. This change replaces the old call with the new one. Change-Id: I0fb674e73047b0988258b177586c44e5ea20e6f1 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: Add moduleheader as config variableMartin Smith2017-08-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | moduleheader is a new config variable you can add to the qdocconf file when the name of the module header file for your module is different from the project name. When the name of the module header file is different from the project name, if you don't tell qdoc what the name of the module header file is by setting moduleheader in the qdocconf file, then clangqdoc will not find the module header file to build the precomiled header with, which will result in clang not finding a lot of stuff. Change-Id: I0da1a0b0be05cb9e6e95e0123583ddeedaf6741d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * qdoc: Create and Visit the PCH alwaysMartin Smith2017-08-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PCH for module QtPlatformHeaders was not being built because there are no .cpp files there, and clangqdoc was only building the PCH when it was asked to parse the first .cpp file. Now it builds the PCH by a direct call from the main.cpp file, after the headers have been gathered into a list, but before the .cpp files are parsed. This does reduce the qdoc error count by a few, but it does not fix the documentation for QtPlatformHeaders. From my debugging, it appears that visiting the PCH produces no qdoc nodes for the C++ classes and functions, etc in the PCH. This update also improves the selection of default include paths when inadequate include paths are provided. That is the case for module QtPlatformHeaders, where no include paths are provided. The algorithm for constructing a list of reasonable guesses is modified here. Change-Id: I0dee8dc0279894a4482df30703657558cdb098de Reviewed-by: Topi Reiniö <topi.reinio@qt.io>