summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/builtinindexingsupport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-378/+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>
* Use Utils::FutureSynchronizer instead of QFutureSynchronizerJarek Kobus2021-05-121-12/+0
| | | | | | Change-Id: Iecfa676f58e5ca82be7c9c94233dcc8d3654c2d7 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Core: Streamline SearchResultWindow interfaceChristian Kandeler2021-02-181-4/+4
| | | | | | | | | | That is, make SearchResultItem the one data type for adding search results. This will allow us to add additional properties to search results without adding more and more parameters to a bunch of functions. Change-Id: Ic2740477ae47449cee75caa2525727fe2b460f91 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* A - (A - (B + 1)) = B + 1Jarek Kobus2020-12-181-1/+1
| | | | | Change-Id: I6ce320c0fd3958c1fef98b322bec8dbded2232cf Reviewed-by: hjk <hjk@qt.io>
* Fix CppProjectUpdater cancelAndWaitForFinishedEike Ziller2020-11-111-13/+7
| | | | | | | | | | | | | | | | 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>
* Utils: Drop Utils::SkipEmptyParts againhjk2020-07-211-1/+1
| | | | | | | | We require Qt 5.14 nowadays. Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* All: Use Utils::SkipEmptyPartshjk2020-06-171-1/+1
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Deduplicate elapsed time formattingAndre Hartmann2020-02-291-3/+3
| | | | | | | | While it's nice to see my code spreading, I still prefer to have it at one place. Change-Id: I7bdb13c47ed7e96227deeb14b0a8070aa40148de Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* More Utils::toSet/toListhjk2019-07-041-1/+1
| | | | | | | ... and unrelated cosmetic changes. Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Add logging to built-in indexerNikolai Kosjar2019-06-111-0/+5
| | | | | | | | This might help to identify problematic files. Change-Id: I76848e6ca12a654c8426cf0d73b50612273d48c3 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Replace uses of qVariantFromValue with QVariant::fromValuehjk2019-05-271-1/+1
| | | | | | | | Deprecated in Qt 5.14, alternative has been around since Qt 4 at least. Change-Id: I4e3a53c289088368609e0d0ce2405a832d311308 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: modernizeAlessandro Portale2019-01-211-9/+7
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Add system include path to HeaderPath and merge ProjectPartHeaderPathMarco Bubke2018-09-101-3/+3
| | | | | | | | | | | | | 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: Apply 'static' pattern to StringTablehjk2018-02-071-1/+1
| | | | | | | | This also fixes a crash on loading (some?) projects introduced in 577bf7c08a. Change-Id: Ie35d466fa3b84b183118fe93f55393a4c59755de Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Revert "CppTools: Do not put configuration document into global snapshot and ↵Nikolai Kosjar2017-03-071-1/+0
| | | | | | | | | | 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-19/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ${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>
* CppTools: Fix choosing project part after project openNikolai Kosjar2017-01-261-2/+1
| | | | | | | | | 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>
* Utils: Introduce a TemporaryDirectory and TemporaryFile classTobias Hunger2017-01-201-5/+4
| | | | | | | | Both wrap the corresponding Qt class, but make sure all temporary files or directories are created inside a "master temporary directory". Change-Id: I55461be507c828c965224c02863ea5ed9bbf9498 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* CppTools: Allow interpreting ambiguous headers as C headersNikolai Kosjar2017-01-161-1/+2
| | | | | | | | | | | | | | ...instead of C++ headers. For the Clang Code Model this results in using "-x c-header" instead of "-x c++-header". This introduces a new option in Options > C++ > "Code Model" to configure this. Change-Id: I8a0ce8fa6155f5ef58743ebc7f1d0b500fbf6599 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* CppTools: Reparse editor documents after active project changeNikolai Kosjar2016-12-161-1/+1
| | | | | Change-Id: I010709c866291bf59c27f4a05765e1ab0efd28af Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Remove some duplicationNikolai Kosjar2016-12-161-1/+1
| | | | | Change-Id: I8c84660b28c3e76b2cedd08ff3b44a38583f38a0 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Prioritize project parts from active projectNikolai Kosjar2016-12-161-1/+1
| | | | | | | ...when selecting one for the editor document. Change-Id: I85066aaa0862870cb2db2fb2cb40c2b2c23b2cac Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Do not put configuration document into global snapshot and working ↵Nikolai Kosjar2016-12-081-0/+1
| | | | | | | | | | 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>
* Find Symbols: Use QRegularExpression instead of QRegExpEike Ziller2016-11-231-4/+7
| | | | | | | This makes it more consistent with the other find filters. Change-Id: I39ad144d66091c3ccc5e4452009cc236165915ea Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Utils: First step to extend search results for clang query supportMarco Bubke2016-11-231-3/+0
| | | | | | | | | We need multi line support, multi text range support. This is only adding enablers and adds later the multi line and multi text support because this triggers larger changes because you have to know the text document. Change-Id: I44e46d9d80d7d73b2650c69cc83657c20c85bfae Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* CppTools: Add UI for file size limit of indexerNikolai Kosjar2016-08-311-0/+4
| | | | | | | Task-number: QTCREATORBUG-16712 Change-Id: I92db8cbcac9669cbd5e4ee5f7ef6f613797c753a Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Use a shared thread poolOrgad Shaneh2016-02-191-1/+1
| | | | | | | | Without this, too many threads are spawned, and loading a project takes forever. Change-Id: I3c22557ddd7bfb0c70f7b089c276432e3b003097 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* CppTools/Editor: Use Utils::runAsyncEike Ziller2016-02-151-1/+1
| | | | | Change-Id: Ifcc2a34e3478eb84f95221b79e39f7a670e6b2e0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@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-3/+3
| | | | | | | | 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>
* CppTools/Clang: Remove InMemoryInfoNikolai Kosjar2015-12-161-1/+1
| | | | | | | ...nowadays we only need the working copy. Change-Id: I30924b3c5dc68b428d6c10f6ba015b0640b476d2 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
* Remove unused functionThiago Macieira2015-08-171-2/+0
| | | | | | | | Found by ICC builtinindexingsupport.cpp(96): warning #177: function "<unnamed>::WriteTaskFileForDiagnostics::processedDiagnostics" was declared but never referenced Change-Id: I7de033f80b0e4431b7f1ffff13fa7bd62338aa50 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Clang: Do not call DocumentManager::modifiedDocuments() from worker threadNikolai Kosjar2015-07-101-1/+1
| | | | | | | This is unsafe. Change-Id: I8ac075a7289afa0d84785e37b1325d186a153000 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* CppTools: Remove separate indexing revisionNikolai Kosjar2015-04-241-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | For indexing we used a custom revision that was updated on each modelManager BuiltinIndexingSupport::refreshSourceFiles() call. This could lead to rejection of updated documents triggered by refactoring actions, like for the following case: 1. Open a project containing a.h and a.cpp 2. Open a.cpp, insert some new lines, save and close the document 3. Open a.h and rename a function that is defined in a.cpp --> The refactoring action modifies a.h and a.cpp, so re-indexing of those is triggered. Since a.cpp has already a higher revision (step 2) than the updated document, the updated document is discarded. As a consequence find usages and follow symbol fails for the renamed function. Now the document call back provided to CppSourceProcessor is responsible for updating the document revision based on the latest revision in the global snapshot. Change-Id: I4dfa0a4d34991655acfa749109f00c47b0fbfdbe Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* Clean exported headers of the CppTools plugin.Friedemann Kleint2015-03-051-0/+2
| | | | | Change-Id: I0144ac33e88980c431c54a6d69bbde28da4b1967 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* C++: Use correct features for document parsingOrgad Shaneh2015-02-201-1/+7
| | | | | | Task-number: QTCREATORBUG-8007 Change-Id: Ic96aaa433442812a99bac9d16bb9124d66762e8c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Update LicenseEike Ziller2015-01-161-6/+6
| | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* CppTools: Make use of QLoggingCategoryNikolai Kosjar2014-11-031-8/+1
| | | | | | | ...for document processing and highlighting. Change-Id: I31d42a5a5010260643ec76688080fd14a486f7e3 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* License update.Eike Ziller2014-10-151-7/+8
| | | | | Change-Id: I0acde2c3b995693de682679471f03af85bdd0a61 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* CppTools: Change CppModelManager implementation patternhjk2014-09-191-3/+3
| | | | | | | | | Replace the CppModelManagerInterface/derived CppModelManager combo by a more common CppModelManager/CppModelManagerPrivate pimpl pattern. Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: IndexItem cleanup: remove a bit of clutter.Erik Verbruggen2014-09-081-2/+1
| | | | | Change-Id: I758980009df4f7ef86fa2b5e3f4d44ccf3fc3fe3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: Change QStringList to QSet<QString> to prevent conversions.Erik Verbruggen2014-09-041-14/+12
| | | | | | | | | This eliminates a bunch of list->set->list conversions. Especially the ProjectInfo::appendProjectPart takes lots of time converting for every part added. Change-Id: Ib3c8cd4b0ad6c012ccbeed12ebedd46b9b6cca95 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
* Add copyright commentNikolai Kosjar2014-08-221-0/+29
| | | | | Change-Id: Ia16f38f4823a0d740391ef4450b858d10f3184e5 Reviewed-by: hjk <hjk121@nokiamail.com>
* CppTools: Rename SnapshotUpdater to BuiltinEditorDocumentParserNikolai Kosjar2014-08-201-6/+6
| | | | | Change-Id: I554b5e9e3f1ef7c167fa45b5cd0c230fdf63073b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Move WorkingCopy to new cppworkingcopy.{h,cpp}Nikolai Kosjar2014-08-201-1/+1
| | | | | Change-Id: I447acf28849bffb52c1e6b6eafdde221ec0b179e Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Tests: Add "Find Errors Indexing" modeNikolai Kosjar2014-08-071-14/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | Adding QTC_FIND_ERRORS_INDEXING=1 to the run environment will Creator force to do some "extended indexing" in order to find bugs: 1) The project files are parsed as if they would be opened in an editor. That is, parsing happens as precisely as possible, based on the ProjectPart information. 2) Symbols are looked up by invoking CheckSymbols, the backend of the semantic highlighter. 3) A "Task List File" (*.tasks) will be written with all diagnostic messages. This special indexing mode is meant for testing purposes. E.g. it can be run nightly on some bigger projects to find regressions. Note that Qt Creator will quit exactly after the first time some source files are indexed. E.g. that will happen if you open a file manually or if you open a new unconfigured project. Therefore it's required to configure projects as needed before invoking in this indexing mode. Change-Id: If25b83e67d24df9e28e107cb062f21cbf3b4c643 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Builtin-Indexer: Fix potential memory leakNikolai Kosjar2014-08-071-13/+30
| | | | | | | | | | | In case the list of source files to be parsed is empty, the CppSourceProcessor is never deleted. This was never a real problem because of the guard in CppModelManager::updateSourceFiles(). Change-Id: Icfd6962d11f2b2bf2ac28825f2fa0af0838a09c8 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Builtin-Indexer: Remove superfluous memberNikolai Kosjar2014-08-071-2/+1
| | | | | Change-Id: Ia76a59f0c2739bec5e145edce3ca8711f54b5fa4 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: fix include/framework path handling.Erik Verbruggen2014-07-041-7/+6
| | | | | | | | | | Instead of having two lists of paths, now only one list is used where both include paths and framework paths can be mixed. This reflects the way the compiler is invoked, and retains the (correct) search order. Task-number: QTCREATORBUG-11599 Change-Id: I373953e3e305df5b7a0d10920e12d146584adf9f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>