summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppprojectupdater.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-179/+0
| | | | | | | | | | | | | | | | There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: Use only const pointers for ProjectInfo and ProjectPartChristian Kandeler2021-08-271-1/+1
| | | | | | | | All members were already const, but this makes it clear at all points of use that these data structures are immutable. Change-Id: Iea615c090bde462c445d15223caccc561b0c713d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CppTools: Turn some classes into pure value typesChristian Kandeler2021-08-131-16/+1
| | | | | | | | | | | | | ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers to Project and/or Toolchain, even though they were used in contexts where these pointers were either unsafe to access or not guaranteed to be valid anymore, which made their use difficult and error-prone. We turn these classes into pure value types by copying in all relevant information before the first async operation takes place. Fixes: QTCREATORBUG-25678 Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Don't update extra compilers individually after project loadEike Ziller2021-07-051-4/+87
| | | | | | | | | | | | | | | | | | | | | | | Each call of CppModelManager::updateSourceFiles detaches the current snapshot. The extra compilers where set up and triggered individually, and resulted in individual updateSourceFiles calls with the single result file of the extra compiler. For Qt Creator this would lead to 200 calls in quick succession after project load, potentially leading to a freeze of multiple seconds. Instead of updating the result files of the extra compilers individually after project load, integrate the update into the regular project source file update. So we end up with only a single call of updateSourceFiles. For this the project updater needs to trigger the extra compilers, and wait for all to finish as well as the regular project part update, before triggering the parser. Task-number: QTCREATORBUG-25783 Change-Id: I34f6df0fc0f96bcb42ee65019bee39cf49176c1f Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppProjectUpdater: Wait for all tasks to be finished in d'torJarek Kobus2021-05-271-19/+7
| | | | | | | | | | | | | | It may happen that the old task was canceled and still running while the new task was started. Later, when the d'tor is called both old and new tasks may still be running. Before we waited only for the new task to be finished in d'tor. Now we are waiting for all tasks to be finished. Amends: 7fb592fe0cfec22ae7e966b9c6b88aa801bf9592 Task-number: QTCREATORBUG-25709 Change-Id: Id4b44cd36ee03aa45472b15d8fbb25a2cab77e92 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Fix UI freeze on project updateDavid Schulz2021-05-071-2/+2
| | | | | | | | | | Do not wait for the previous update to finish before starting the next update. Amends: 6d7e5eb8d17194b124c8986d670ff96fda96f0f3 Change-Id: Ic8d43b56949cbf024832afc85e54a31db29b11ac Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove unneeded includesJarek Kobus2020-11-121-0/+2
| | | | | Change-Id: I67fee9303509b7080e123a2a5826e200ce498ce2 Reviewed-by: hjk <hjk@qt.io>
* Fix CppProjectUpdater cancelAndWaitForFinishedEike Ziller2020-11-111-13/+18
| | | | | | | | | | | | | | | | The code was pushing an additional QFutureInterface through the whole chain of functions, which was used for canceling. But since it was never started (and never finished, and never used for reporting results), calling waitForFinshed on it never had any effect with Qt5 and locks up with Qt6. Instead of using a separate QFutureInterface, use the actual QFuture that is available and intended for it. Fixes: QTCREATORBUG-24902 Change-Id: I5a49bcecc9cf70fbffa93aee4293004f9369df58 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix a build with Qt 6Jarek Kobus2020-11-051-1/+0
| | | | | | | | | In Qt 6 implicit conversion between QFuture and other types is forbidden. Make it explicit instead. See ff0ba7e2d7b91fd5809cb314935a1ca1a436f6c9. Change-Id: Ie42e6b9b5047ba5eeec9f63fd03179e73f95314d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppTools: Optionally move raw project parts creation into threadChristian Kandeler2020-02-061-1/+4
| | | | | | | | | | | | ... by letting callers pass in a generator function. This takes some load off the UI thread for larger projects. For now only used by the QbsProjectManager, which can provide a thread- safe generator function due to the project data existing in "value" form. Task-number: QTCREATORBUG-18533 Change-Id: I525dea36a4c4079bd1bd5a4fff844617547d56f1 Reviewed-by: hjk <hjk@qt.io>
* GenericProject: Make dependency on CppTools optionalEike Ziller2019-09-131-0/+10
| | | | | | | | | | | | | Especially in the light of the language server, the generic project is currently the project one can use for language servers that require a "project workspace". Makes it possibly to run Qt Creator with "-noload CppTools" if you still want to use generic projects with some other language. Change-Id: Ib9059289a2db4c44c0c1060a02fcdafacb885fbd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Move ProjectUpdateInfo to ProjectExplorerEike Ziller2019-09-121-1/+1
| | | | | | | Used for updating project parts, so move it near RawProjectPart. Change-Id: I77aeffbdbfb3d2ec0de600f61dcf7fbb7a355a98 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppProjectUpdater: Remove unread attributeBernhard Beschow2019-01-061-2/+1
| | | | | | Change-Id: I51123e5b5609de431cfa6d1558aed0b9739ff9c8 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* QbsProject: Remove unread attributeBernhard Beschow2019-01-061-4/+0
| | | | | | | | Also remove the signal CppProjectUpdater::projectInfoUpdated() which is now unused. Change-Id: I65afe8f96cd8175edaf8ccb6e5067e4f9cd8d99f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppProjectUpdater: Reuse cancelAndWaitForFinished()Bernhard Beschow2018-12-191-2/+1
| | | | | Change-Id: I749dd0244175060ce79d6050b12b729866c06c9d Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Make create* methods return somethingTobias Hunger2017-11-011-2/+1
| | | | | Change-Id: I20cfdaef23e9b7c48c9d3b4f27157e771fd9bc7f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools/ProjectManagers: Reduce ui blocking when loading projectsNikolai Kosjar2017-02-201-0/+111
${AnyProject}::updateCppCodeModel() did two potentially not that cheap operations in the ui thread: (1) Querying the MimeDatabase for the mime type for the source files of the project. In 99.9% of the cases no files need to be read for this as the file extension will resolve the type. The expensiveness comes from the sheer number of files that can occur. (2) Calling compilers with the "(sub)project's compiler command line" to determine the macros. While the caches avoid redundant calls, the number of the unique compiler calls makes this still a ui-freezing experience. These two operations are moved into a worker thread. For this, the expensive compiler calls are encapsulated in thread safe lambdas ("runners") in order to keep the "mutexed" data minimal. The original API calls of the toolchains are implemented in terms of the runners. While adapting the project managers, remove also the calls to setProjectLanguage(). These are redundant because all of the project managers already set a proper value in the constructor. Also, currently there is no need (client) to report back detection of C sources in project parts. This also keeps CppProjectUpdater simple. There is still room for improvement: * Run the compiler calls in parallel instead of sequence. * Ensure that the mime type for a file is determined exactly once. Change-Id: I2efc4e132ee88e3c8f264012ec8fafe3d86c404f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>