summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* CppTools/ProjectExplorer: Remove enum duplicationNikolai Kosjar2018-10-081-2/+3
| | | | | | | | ... between CppTools::ProjectPart and ProjectExplorer::ToolChain. Change-Id: I8b448747e454adbed77547460383b8515462cc81 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Use clang-format for indentationIvan Donchevskii2018-09-121-1/+5
| | | | | | | | | | | | | | | | | | | 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-8/+8
| | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/4.7'Eike Ziller2018-07-051-0/+30
|\ | | | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri Change-Id: I29916313f12e25f3942ac926f8e4d4490074978e
| * CppTools: Fix getting locator filters from the object poolIvan Donchevskii2018-06-281-0/+30
| | | | | | | | | | | | | | | | | | 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: Fix memory leak of QFutureWatcher when canceledHannes Domani2018-06-081-1/+2
|/ | | | | Change-Id: Ia9cd428e3bed193167903b6ffa080e4886193789 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangTools: Always use CompilerOptionsBuilder for clang toolsIvan Donchevskii2018-04-131-13/+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-4/+5
| | | | | | | | 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-13/+1
| | | | | | | | Without object pool resetting filters does nothing and therefore is not needed anymore. Change-Id: Id5439d11b0ee2564d7573b95c0c922d7fd7da59e Reviewed-by: hjk <hjk@qt.io>
* CppTools: Do not add LocatorFilters to global object poolhjk2018-03-081-9/+0
| | | | | | | Not needed anymore, they are more directly accessible nowadays. Change-Id: Ibe16ab1281a16b05e02fb20c0722d87196d99365 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: Get OverviewModel from model managerIvan Donchevskii2018-02-091-0/+6
| | | | | | | | 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-6/+6
| | | | | | | | This also fixes a crash on loading (some?) projects introduced in 577bf7c08a. Change-Id: Ie35d466fa3b84b183118fe93f55393a4c59755de Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: move locators ownership to ModelManagerIvan Donchevskii2018-01-171-9/+111
| | | | | | | | | 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-1/+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-2/+2
| | | | | Change-Id: I30f9048aff18440d8cc6a6247f5fd5bcdba5058d Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: add globalFollowSymbol to RefactoringEngineIvan Donchevskii2017-12-141-3/+16
| | | | | | | Allows to follow outside of current TU. Change-Id: Ieea2fd72bfdf6d60a988b40efcf2f41c5a71d045 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.5'Eike Ziller2017-11-241-2/+0
|\ | | | | | | Change-Id: I32715e2fdbb14e4fccc4c58d3fd6052d7c1127f3
| * CppTools: Fix initial macro parsing for generic projectOrgad Shaneh2017-11-241-2/+0
| | | | | | | | | | | | | | | | | | | | | | The extra macros in the config files are being read in CppModelManager::internalDefinedMacros(), but they also affect the language features in ProjectPart::updateLanguageFeatures(). Task-number: QTCREATORBUG-1478 Change-Id: Ic197b0b7d4cc6e6a74637da0c710b0630daae25c Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: use local renaming based on ClangCodeModelIvan Donchevskii2017-11-201-2/+10
| | | | | | | | | | | | | | | | Provide refactoring engine for ClangCodeModel and implement missing methods. Change-Id: If5c913e0c5a7941cd2ced54d0fcfa4d625eadc93 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: implement globalRename based on clang IndexIvan Donchevskii2017-10-251-3/+3
| | | | | | | | | | | | | | 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/+7
| | | | | | | | | | | | | | | | | | | | | | 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-8/+39
|/ | | | | | | | 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-4/+9
| | | | | | | | 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/+6
| | | | | | | | 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-25/+23
| | | | | | | | | | | 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>
* ProjectExplorer: Move built-in parser workarounds to built-in code modelNikolai Kosjar2017-03-161-1/+8
| | | | | | | | | | | | | | | | | | ...so that only the built-in code model parser sees them, but not the clang code model, which has problems with them. The specific case here is due to definition of __int32: winnt.h:3077:1: error: functions that differ only in their return type cannot be overloaded intrin.h:357:31: note: previous declaration is here While moving, drop __MSVCRT__, which seems to be a predefined macro of ancient MSVC versions, see https://sourceforge.net/p/mpg123/mailman/mpg123-devel/?viewmonth=201010&viewday=24 Change-Id: I4b8c49ed4bdc942a2190dbae3c260f3a1a8078a4 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Revert "CppTools: Do not put configuration document into global snapshot and ↵Nikolai Kosjar2017-03-071-3/+11
| | | | | | | | | | working copy" This reverts commit 05942b63f8bad6d6787fea10c31f10458cdccd06 because it breaks refactoring, e.g. Q_PROPERTY generators. Change-Id: I9a14b912ba72663f08ea99e7e066d824b18da4b0 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools/ProjectManagers: Reduce ui blocking when loading projectsNikolai Kosjar2017-02-201-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ${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>
* Unify projectexplorer language IDsUlf Hermann2017-01-301-1/+1
| | | | | | | | We don't need two IDs for C++ and the QmlJS ID should look the same as as the others. Change-Id: Ib9747f6b36a90bb652951d85eec69666615670c4 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CppTools: Fix choosing project part after project openNikolai Kosjar2017-01-261-11/+19
| | | | | | | | | As long as there are project parts for a source file, always determine the best project part, instead of trying to stick to the previous one. This ensures the best project part at all times and simplifies the code. Change-Id: I25ea3eb43a5a3e6d93688d4b8965f596dc9ae22b Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Reparse editor documents after active project changeNikolai Kosjar2016-12-161-7/+22
| | | | | Change-Id: I010709c866291bf59c27f4a05765e1ab0efd28af Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Clean up ProjectInfoNikolai Kosjar2016-12-131-10/+13
| | | | | Change-Id: I5d0db45d9fdb624bb6cc55d7f04061d553f13bce Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Do not hardcode default language versionNikolai Kosjar2016-12-131-1/+0
| | | | | | | ...instead, use the latest we support. Change-Id: I7e7768bc4bc31de1fe0f441c03f3ab5d677d76e8 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Do not put configuration document into global snapshot and working ↵Nikolai Kosjar2016-12-081-11/+3
| | | | | | | | | | copy These are remnants of the time when we had only one snapshot. Change-Id: I6ff4db645d1065a0ef195834890e0774e2e2c60e Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* CppTools: Call ProjectInfo::finish when we get itNikolai Kosjar2016-12-061-5/+8
| | | | | | | | No need to require the project managers to do this. Also, it is easy to forget. Change-Id: I96f7a5e5547418678af9653e5753c372f0880e5a Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CppTools: Add UI for file size limit of indexerNikolai Kosjar2016-08-311-4/+4
| | | | | | | Task-number: QTCREATORBUG-16712 Change-Id: I92db8cbcac9669cbd5e4ee5f7ef6f613797c753a Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Fix condition in file size checkNikolai Kosjar2016-08-161-1/+1
| | | | | Change-Id: I71d67f1273bad025b8dff45b3903b458f5cda2a2 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Clang: Add clang refactoringMarco Bubke2016-08-041-0/+13
| | | | | | Change-Id: I2e3f36f810276da3f8dc7dcc587b06f8edb586d3 GPush-Base: d02f51b48fc752fddcdef6dcb32b3f7f6c0195a3 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* CppTools/Clang: Announce only removed project partsNikolai Kosjar2016-06-281-12/+12
| | | | | | | | | | | | | | | | | | ...and not all projects parts of a project if it is closed. Re-produce with: open a project A with subdirs (e.g. qtcreator.pro) open a subdir project from project A (e.g. cppeditor.pro) close project A --> The project part representing the subdir is announced as removed although it is still open. The clang code model was the only affected user - affected translation units were not parsed/updated anymore ("ERROR: ProjectPartDoesNotExistMessage"). Change-Id: Ia79341ce201e3b4aefff9f597920dbc6f7d67634 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* CppTools: Use Qt5-style connectsOrgad Shaneh2016-05-231-13/+13
| | | | | | | Mostly done by clazy. Change-Id: I0fbbbe1a2d28b79bcb83093d608bca6e2f927ebb Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* QbsProjectManager: Fix SOFT ASSERT: "future.isFinished()"Nikolai Kosjar2016-05-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | ...in file qbsproject.cpp, line 940. The assert can be triggered with e.g.: 1. Load a bigger qbs project, e.g. qtcreator.qbs. 2. Trigger project build as soon as possible. 3. Cancel the "Parsing C/C++" operation. 4. Wait until the build finished and the assert occurs. This happens because CppModelManager::updateProjectInfo() since commit 536ccc8a8742b38e75547d98ce457b0b90af3ee7 CppTools: Fix incompletely indexed project will check whether the previous indexer run was canceled or not. If it was canceled, it will trigger a full-reindexing of the project. Updating the compiler call data is a special case and it should never trigger an indexing operation, so introduce a dedicated update function for this case. Change-Id: I456945ccf2bf697aaeada572ed87f3acb21a5eaf Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppTools: Fix incompletely indexed projectNikolai Kosjar2016-04-251-3/+30
| | | | | | | | | | | | | | | | Use case to reproduce: 1. Open some bigger project, e.g. qtcreator.pro 2. As soon as "Parsing C/C++ files" is reported, add a character to qmake's additional arguments in project mode (indexing should not be finished at this point). 3. The indexing gets canceled. ==> ...but reindexing is not triggered. Fix by checking whether the future was canceled. Task-number: QTCREATORBUG-16134 Change-Id: I520c6a64a6adc1cb04cafb5e0aa56c8bf41d7b14 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: fix metatype registration macro usageNikita Baryshnikov2016-03-241-2/+0
| | | | | | | | in places where we do not need it Change-Id: Ibf35f8144da859fffa3e0a7b6bb262284ec2292a Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Merge remote-tracking branch 'origin/3.6'Eike Ziller2016-02-241-13/+1
|\ | | | | | | | | | | | | | | Conflicts: src/shared/qbs tests/manual/proparser/main.cpp Change-Id: I13654bf10c14eb6b1d6805fe86b67ac73b2e4d75
| * CppTools: Do not clear project state on session unloadNikolai Kosjar2016-02-121-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Affected functionality was, among others: * Getting the correct project part when opening a file * Fallback project part (merged defines/includes) not up to date * Fallback for "Switch Header/Source" not up to date In the early days sessions switching was probably implemented by "close all projects of session X, open all projects of session Y". That's not the case anymore today. Change-Id: I4c6a80e2eb219615d3ea6fcf07be7c05072c8832 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* | CppTools: Use a shared thread poolOrgad Shaneh2016-02-191-0/+7
| | | | | | | | | | | | | | | | Without this, too many threads are spawned, and loading a project takes forever. Change-Id: I3c22557ddd7bfb0c70f7b089c276432e3b003097 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* | Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | | | | | | | | * Update files in src/plugins Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* | CppTools: Move ProjectPart in its own header fileMarco Bubke2016-01-131-7/+7
| | | | | | | | | | | | | | | | Also extracting inline HeaderPath class and change projects list in vector because the size is larger than a pointer. Change-Id: I885fdff3fe9bccc877634d1615249755f5b674fd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* | Clang: Activate code model automatically if plugin is loadedNikolai Kosjar2015-12-161-51/+5
| | | | | | | | | | | | | | This removes also the need to close editor documents. Change-Id: I96c68105bceb37841053f3dbd8a264e059a02cb8 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>