summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-308/+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-9/+9
| | | | | | | | 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: Make sure there's only one C++ parsing thread per projectChristian Kandeler2021-08-231-2/+0
| | | | | | | | | | | | Switching back and forth between targets or build configurations could result in an arbitrary amount of C++ parser threads running at the same time, wasting valuable resources. We now cancel a currently running parser thread when starting a new one for the same project. Fixes: QTCREATORBUG-24890 Change-Id: Ie1afc4971515fcad01dae182578fd77daa642cec Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CppTools: Remove unused additional indexing support objectChristian Kandeler2021-08-231-1/+0
| | | | | | | Its presence is confusing. Change-Id: I61986e970e0f58cded5b97dae2cd28abcdb3ecff Reviewed-by: hjk <hjk@qt.io>
* CppTools: Turn some classes into pure value typesChristian Kandeler2021-08-131-3/+3
| | | | | | | | | | | | | 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>
* CppTools: Do not access kits in non-UI threadChristian Kandeler2021-07-191-0/+1
| | | | | | | Amends 9c3420120e. Change-Id: Iba8b1069bf4468119c7f518c562e4229141ac66b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Don't update extra compilers individually after project loadEike Ziller2021-07-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | 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>
* ClangCodeModel: Provide outline via clangdChristian Kandeler2021-07-011-0/+1
| | | | | | | | | | | Note that we used to encode the information about symbol visibility and static-ness in the icons, which we can't do anymore, because clangd does not provide this information. On the upside, this change likely fixes a ton of bugs, as our own outline was rather "quirky". Change-Id: I099f11ec4e3c6f52cd461fb43080bbdde3bed5e5 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Implement declaration/definition switch via clangdChristian Kandeler2021-06-181-0/+1
| | | | | Change-Id: I522a415d76fbc5332e5cc1fdfd2d7ab19cb9ed64 Reviewed-by: David Schulz <david.schulz@qt.io>
* Core: filepathify file renamingDavid Schulz2021-06-171-1/+1
| | | | | | Change-Id: I3d4f39e34e65cde3df7b7c19570e3a54d0625d53 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* AutoTest: Use Utils::FilePath for files and directoriesChristian Stenger2021-05-271-2/+2
| | | | | | | | Still some missing bits as some QString members had different meanings depending on their context. Change-Id: Ib48eab54498974a26bbd5123cbffeefee5f7e79c Reviewed-by: hjk <hjk@qt.io>
* ClangCodeModel: Add experimental clangd supportChristian Kandeler2021-04-221-0/+3
| | | | | | | | | | | | | If the user has enabled clangd (default is off), we start up one instance per project when it is opened/changed (including build config switches), and trigger background indexing. So far, the index is used to provide results for locators and "Find Usages". Per-document functionality such as semantic highlighting and completion is still provided by libclang. Change-Id: I12532fca1b9c6278baab560e7238cba6189cde9f Reviewed-by: David Schulz <david.schulz@qt.io>
* AutoTest: Free TestTreeItem from CppTools dependencyBernhard Beschow2021-04-121-0/+8
| | | | | | | | | | | | | Makes TestTreeItem programming language agnostic. By moving the "query" methods to CppTools, the cohesion within these methods is improved, i.e. information crosses the AutoTest <-> CppTools border fewer times. Furthermore, it allows the CppTools plugin to see how its data is being used, allowing it to optimize its queries behind the scenes. Change-Id: I0a60140abaca1193d500605dfa2812b4d937d94c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* "New Class" wizard: Check custom base class for QObject parentChristian Kandeler2021-01-251-0/+2
| | | | | | | | | | | | That is, if the user specifies a custom base class, we check whether its constructor takes a "QObject *parent" parameter, and if it does, we give the derived class one as well. This is technically a heuristic, but the pattern is pretty stable in the Qt world. Fixes: QTCREATORBUG-25156 Change-Id: Ie64440929df61cca7258d6d692c5de62970f9a65 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Fix CppProjectUpdater cancelAndWaitForFinishedEike Ziller2020-11-111-6/+2
| | | | | | | | | | | | | | | | 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>
* C++: Offer only signals when completing in a connect() callChristian Kandeler2020-08-271-0/+3
| | | | | | | | | | | | | ... at the second argument. The logic is as follows: The clang code model checks whether the set of completions contains any signals. If so, it instructs the built-in code model to analyze the AST to find out whether the completion location was at the second argument of a call to QObject::connect(). In that case, we filter out all non-signals, because they are not valid at that location. Fixes: QTCREATORBUG-13558 Change-Id: I9c7d0bd16161c723aef822280626cd06ece7df93 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: Introduce shortcut for forcing a function hint proposalChristian Kandeler2020-08-111-0/+1
| | | | | | | | | | ... and support it in the ClangCodeModel. This allows users to get function signature(s) displayed regardless of where exactly the cursor is on the function call. Fixes: QTCREATORBUG-19394 Change-Id: I033e8774db93680bfc3ee52610b817e0ef8ccc76 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Use a normal plugin pimpl member for CppModelManagerhjk2020-02-061-6/+6
| | | | | Change-Id: Id2c4b098084808070ef91de13c8338184e52141d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* VcsBase: Make dependency on CppTools optionalEike Ziller2019-08-151-0/+3
| | | | | | | | | | | | | The VcsBaseSubmitEditor uses CppModelManager to collect the symbol names from the affected files for completion in the commit message. Move the C++ code model code into CppModelManager, register it in the plugin manager, and call it via QObject means from the submit editor. This avoids a hard dependency from VcsBase to CppTools. Change-Id: I2fb34dbef153c1414820d711e7fc5596bcac1691 Reviewed-by: hjk <hjk@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-3/+3
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Add sourceFilePath to AbstractEditorSupportMarco Bubke2019-01-241-1/+4
| | | | | | | | | | Provide the source path to track a generated file source. You can for example get the modified time stamp for the source file and use it for the generated file content. Task-number: QTCREATORBUG-21876 Change-Id: Ia422e128c5cb7a3dce88960f126152c2f65afb41 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Refactor indenter to allow ClangFormat unit-testsIvan Donchevskii2019-01-221-1/+0
| | | | | | | | | | We do not build texteditor files in unit-tests so some tricks were required to make ClangFormatIndenter available. First simple unit-test proofs it builds and runs. Change-Id: I81d5ea099bd27fd1c1ed8b5b7877299dcc62a67f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: modernizeAlessandro Portale2019-01-211-3/+3
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Utils: Introduce GlobalFileChangeBlockerOrgad Shaneh2019-01-081-2/+0
| | | | | | | | | | Tracks application state, and signals when it is changed. Supports forcing blocked state with reference counting. Change-Id: Ic173d42446b1b08bd4a1e7c1acf38c68644d30b3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppModelManager: Remove method overload used only in testsBernhard Beschow2019-01-061-1/+0
| | | | | | | Use (and therefore test) the method actually used in production code. Change-Id: I4317517ef8a1779df4d46af3905790012ee98645 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Move settings to the Code Style widgetIvan Donchevskii2018-12-041-7/+0
| | | | | | | | | | | | | | | It makes sense to unify the indenter creation by replacing the CppCodeStylePreferencesFactory instead of removing it. We are reusing the same options page but with different kind of settings. With this change wizards will no more be confused by missing factory and will create the proper indenter. Fixes: QTCREATORBUG-21516 Change-Id: I38964d5fa1f2257617c66a1441db723d239a3237 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Avoid starting backend jobs for inactive app and during VCS operationsNikolai Kosjar2018-10-161-0/+2
| | | | | | | | | | | | | | | | | | | | | ...to reduce file locking on Windows caused by clangbackend's parse/reparse jobs. Considering inactive application state should help for external VCS operations, e.g. on the command line. However, activating Qt Creator while such a VCS operation runs might still lead to undesired behavior, but this should be the less common case. VCS operations started from within Qt Creator should see less locking conflicts as we know when they start and finish. However, we just avoid starting new jobs - there might be still jobs running. Pending or new jobs will be started once Qt Creator is activated again and all VCS operations finished. Task-number: QTCREATORBUG-15449 Change-Id: I5f04c34f006e66162368efbdd58bd822a706f35e Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: Fix missing overrideEike Ziller2018-09-181-1/+1
| | | | | Change-Id: I6ee424a844ce2657516258033764ef557a424830 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Add refactoring project updaterMarco Bubke2018-09-121-1/+3
| | | | | | | | The project parts are now first used by the pch manager and then notified by the pch manager to the refactoring plugin. Change-Id: I88074d8891cd0de9721497bbafee0deffc0b6339 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Use clang-format for indentationIvan Donchevskii2018-09-121-0/+8
| | | | | | | | | | | | | | | | | | | This is the new experimental plugin based on LibFormat. It replaces the default indenter for CppEditorDocument and applies clang-format after the CR or the set of 'electric' characters. Uses the global .clang-format kept in QtC settings or the one for current project. Both can be configured. For indentation some style modifications and code manipulations are done to prevent line shrinking when it's not expected. Manual indentation uses unmodified style from .clang-format file. Change-Id: I6279b805e418e1804b553efa615f5c843f395a58 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Add system include path to HeaderPath and merge ProjectPartHeaderPathMarco Bubke2018-09-101-4/+4
| | | | | | | | | | | | | System include paths are appended after other includes by the compiler. So we should set them as system includes and not as normal includes. Otherwise we change the include order. Headers in system include paths are not cluttering the screen with unwanted warning and by the way improve performance too. ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them. Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CppTools: Fix getting locator filters from the object poolIvan Donchevskii2018-06-281-0/+7
| | | | | | | | | They are no longer inside the global object pool. Get them from CppModelManager instead. Task-number: QTCREATORBUG-20678 Change-Id: Ifb3221a812295e1dcfe8b59ea693a4b350cbcc2e Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Use override consistentlyTobias Hunger2018-05-071-2/+2
| | | | | | | clang-tidy fixes from modernize-use-override check. Change-Id: I0e6d6a9df3e87b8042ccc5ea0adc70070a3821d6 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangTools: Always use CompilerOptionsBuilder for clang toolsIvan Donchevskii2018-04-131-3/+0
| | | | | | | | | | We do not ship clang-cl anymore which makes it impossible to run clang with MSVC options. Secondly we used to we tweak compiler options quite a bit so why not to switch to CompilerOptionsBuilder totally? Change-Id: Id323cb554587afaea7d9aa530e947a45a03922d1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Remove processEvents call from follow symbolIvan Donchevskii2018-03-191-1/+2
| | | | | | | | processEvents is a bad way of dealing with asynchronous requests. Use QFutureWatcher for that purpose. Change-Id: I3839cb9db80a6d391f6af1178e96986a325b7b99 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* CppTools: Remove resetFilters from CppModelManagerIvan Donchevskii2018-03-091-7/+6
| | | | | | | | Without object pool resetting filters does nothing and therefore is not needed anymore. Change-Id: Id5439d11b0ee2564d7573b95c0c922d7fd7da59e Reviewed-by: hjk <hjk@qt.io>
* CppTools: Get OverviewModel from model managerIvan Donchevskii2018-02-091-0/+2
| | | | | | | | Move ownership and add the placeholder for future clang based OverviewModel. Change-Id: Ia44d2c1d0db59b40239d1f7934bf37a02e4b14e6 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Apply 'static' pattern to StringTablehjk2018-02-071-4/+2
| | | | | | | | This also fixes a crash on loading (some?) projects introduced in 577bf7c08a. Change-Id: Ie35d466fa3b84b183118fe93f55393a4c59755de Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Fix compile for gcc 4.9Christian Stenger2018-01-181-2/+2
| | | | | | | | | Seems gcc 4.9 cannot handle forward declared classes in uniqe_ptr correctly. Broke with 7666db896d. Change-Id: Ib7e7d9d22e5b0a1d50a107202108ec2937e0a284 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: move locators ownership to ModelManagerIvan Donchevskii2018-01-171-1/+16
| | | | | | | | | Move locator and find filters ownership and initialization to ModelManager. Initialize builtin filters by default and provide methods to set them from plugins. Change-Id: I4cc82ecff3415329a5f97b1be9dcc45e6103bf5a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Move CppHoverHandler to CppToolsNikolai Kosjar2018-01-161-2/+6
| | | | | | | | This is in preparation for clang code model to provide its own hover handler. Change-Id: Ifbdd96f427989bd5d1fbc4badb9c38108485c2f2 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: Improve a function nameNikolai Kosjar2018-01-161-1/+1
| | | | | Change-Id: I30f9048aff18440d8cc6a6247f5fd5bcdba5058d Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: add globalFollowSymbol to RefactoringEngineIvan Donchevskii2017-12-141-0/+5
| | | | | | | Allows to follow outside of current TU. Change-Id: Ieea2fd72bfdf6d60a988b40efcf2f41c5a71d045 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: implement globalRename based on clang IndexIvan Donchevskii2017-10-251-1/+2
| | | | | | | Has the same limitations as findUsages. Change-Id: I8de4df2ecbfd8a4f3073666994398dc43af0d73c Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: implement findUsages with existing indexIvan Donchevskii2017-10-241-0/+2
| | | | | | | | | | | Functionality is limited to the abilities of current index which is not updated and is generated only at project open. Search box temporarily doesn't allow to "Search again". Change-Id: Id1047f27ad0aafc901f06aa51ad38ceab95eaebb Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: add multiple refactoring engines supportIvan Donchevskii2017-10-171-4/+18
| | | | | | | | Make model manager able to select the most functional refactoring engine from the available ones. Change-Id: I74031c910706fd694a0a7def022531501f1ea005 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: remove builtin RefactoringEngine dependency from CppEditorIvan Donchevskii2017-09-221-1/+1
| | | | | | | | Move CppRefactoringEngine to CppTools and builtin member ownership to model manager. Change-Id: I3e72308559fd2928229f9f25d4dd09beb3f56c34 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: remove builtin FollowSymbol dependency from CppEditorIvan Donchevskii2017-09-221-1/+1
| | | | | | | | Move FollowSymbolUnderCursor to CppTools and builtin member ownership to internal model manager. Change-Id: I97a4f744ec1709ccc0b34fb67b58680973ef566f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppEditor: refactor FollowSymbolIvan Donchevskii2017-09-151-0/+2
| | | | | | | | Create an interface to get the ability to use another FollowSymbol implementation Change-Id: I5802f62523ff3ee47b8a14e487adf43edcb6c9b1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Convert macros from plain QByteArray to a vector of structsMarco Bubke2017-09-141-2/+2
| | | | | | | | | | | The old code model expected the macros as C++ formatted text ("#define Foo 42) but newer targets like the Clang codemodel expect key value arguments like "-DFoo=42". So instead of parsing the text again and again we use an abstract data description. Task-number: QTCREATORBUG-17915 Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>