summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus
Commit message (Collapse)AuthorAgeFilesLines
...
* CPlusPlus: Remove foreach / Q_FOREACH usageArtem Sokolovskii2022-05-302-4/+4
| | | | | | Task-number: QTCREATORBUG-27464 Change-Id: I62e27bca141a529ac220211f8b31e78be0f7e855 Reviewed-by: hjk <hjk@qt.io>
* Display parent functions in the Find Usages menuIhor Ivlev2022-05-251-9/+81
| | | | | | | | | | | | | | | | To display the parent function, first we find it in displayResults and store the information to SearchResultItem, then SearchResultTreeItemDelegate gets the information and renders it. Similar approach is applied to ClangdClient, in addSearchResultsForFile. This change also adds default style for containing function highlight in the search. Default foreground and background colors are same as usual text colors. Task-number: QTCREATORBUG-27550 Change-Id: Id1251afa192f8d1232524742b7c211770bcb83fb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Remove foreach / Q_FOREACH usageArtem Sokolovskii2022-05-2013-56/+86
| | | | | | | | Task-number: QTCREATORBUG-27464 Change-Id: Idbcedd9f9a2e148cb18e53c9dc0b82b52b372d64 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove or replace a few unnecessary #includeshjk2022-05-201-1/+1
| | | | | | Change-Id: I0545533baab57a4383fda5fd680603fdc6459a01 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unused local variable in LookupContext::fullyQualifiedNameIhor Ivlev2022-05-121-1/+0
| | | | | | Change-Id: Icbec0969eab0651481ca752541dbee98fb363630 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CMake: Qt Creator Static build supportCristian Adam2022-04-291-3/+6
| | | | | | | | | | | | | | | | | | | This adds the build system feature that allows Qt Creator's libraries and plugins to be compiled statically. Fixes some symbol clashes when all plugins are linked into the same executable. Support for actually loading static plugins will be added in a separate commit. The feature is controlled by QTC_STATIC_BUILD which by default is OFF. Change-Id: I1fab7953c43e42dc75619e35660029ee067106df Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CppEditor: Properly handle function types as template argumentsChristian Kandeler2022-04-071-3/+6
| | | | | | | | | | ... when creating getters and setters. Fixes: QTCREATORBUG-27133 Change-Id: Ia77147a270fb1229c765ff9d5f03aa243d51fe97 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Ensure a space between ref qualifier and exception specChristian Kandeler2022-04-051-1/+4
| | | | | | | Task-number: QTCREATORBUG-27132 Change-Id: Iedb983f58ece345d5997607d2e557e36c951750f Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* CppEditor: Use trailing return type when moving function definitionChristian Kandeler2022-04-053-5/+19
| | | | | | | | | | ... if the original definition also used a trailing return type. Task-number: QTCREATORBUG-27132 Change-Id: Iaeeeac08601f1d931aabe12be9f89ca0240d97a2 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Remove qmake build filesEike Ziller2022-01-203-96/+0
| | | | | | | | | | Removes qmake as a build system for building Qt Creator itself. Keep them for some tests that are not completely moved to CMake yet. Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Do not needlessly allocate space for a vectorChristian Kandeler2022-01-121-8/+13
| | | | | | | | | It's not a rare ocurrence that the vector will stay empty, so let's not reserve memory unconditionally. Task-number: QTCREATORBUG-26841 Change-Id: I842620cfa1fd0571691829401e4ccc162ab61d7b Reviewed-by: hjk <hjk@qt.io>
* CppEditor: Fix highlighting of raw string literalsChristian Kandeler2021-12-102-0/+7
| | | | | | | | | | | | ... with the built-in highlighter. Pass the necessary context information in and out of the SimpleLexer. Task-number: QTCREATORBUG-26211 Fixes: QTCREATORBUG-26425 Fixes: QTCREATORBUG-26615 Change-Id: Id72f743e07ae117ca51b0d5e527b208dda133b7e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* CPlusPlus: Fix "Find references"Christian Kandeler2021-11-091-1/+1
| | | | | | | | | ... for certain types of template/namespace combinations. This essentially reverts 2798c11d1d. Fixes: QTCREATORBUG-26520 Change-Id: I1ab0e4e19bd09695d1536bf6f10960107e9ecbc4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Fix "insert def from decl" for template return typesChristian Kandeler2021-10-272-17/+47
| | | | | | Fixes: QTCREATORBUG-26397 Change-Id: Ia215f2c2b5da708b0fd7c894987683b305f4ccec Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Fix qHash-related size compatibility warnings by MSVCOrgad Shaneh2021-10-203-6/+8
| | | | | | Change-Id: I3b7981ce78b67db4b996f99682284a0b911d8cd7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: Fix "decl from def" quickfix with templated return typeChristian Kandeler2021-09-141-9/+9
| | | | | | | | | | We must treat return and parameters types of the function differently from the function itself with regards to template parameters. This was already done for parameters, but not for the return type. Fixes: QTCREATORBUG-26248 Change-Id: I44cf6f0bda7b5e3c38f9f73e13f51f2c12ab7dc4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-1/+1
| | | | | | | | | | | | | | | | 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>
* CppEditor: Fix "insert definition" for templates with value parametersChristian Kandeler2021-08-171-2/+9
| | | | | | Fixes: QTCREATORBUG-26113 Change-Id: I2d2a1c1bdcffd67072bbda99dabbbfbfafe115c5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Introduce a FilePath constructor from char arrayshjk2021-08-171-8/+0
| | | | | | | | | | | | Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for decorations in user code. At the same time, drop some convenience constructors and functions in CommandLine and Icon essentially serving the same purpose. Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* endless loop when tokens do not represent a lambdaJasmin Fazlic2021-08-051-2/+2
| | | | | | | | | | | | | Fixes the endless loop when traversing the callstack while debugging and the tokens do not represent a lamda. for example: `return Class{}(var);` Change-Id: I2c4dbf9df24046158147a04347aa435a7ccd02bc Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CppEditor: Fix switch statement completionChristian Kandeler2021-07-291-1/+1
| | | | | | | | | ... for the case where the value is retrieved via a call to a template function whose scope does not include the template type. Fixes: QTCREATORBUG-25998 Change-Id: Ie33817f445fb53595b783f716093637926297549 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Fix moving function definition out of specialized classChristian Kandeler2021-07-291-12/+18
| | | | | | Fixes: QTCREATORBUG-25808 Change-Id: I5950c7f66b736c6ee30411e8fdc0356d78faa518 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.15' into 5.0Eike Ziller2021-06-241-0/+9
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/cmakeprojectmanager/projecttreehelper.cpp src/plugins/coreplugin/mainwindow.cpp Change-Id: Ie3a281b8635e79ca5fa794a127ed0039f33fe2ee
| * CMake build: Force optimization of CPlusPlus libEike Ziller2021-06-221-0/+9
| | | | | | | | | | | | | | | | | | | | | | Even in the debug build, as done for the qmake build system. This is for performance optimization of this critical part for C++ parsing even in debug / developer builds. Change-Id: I9552ba9fc44e213f2df1d2d2a64a126af3603fd1 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* | CppEditor: Add second "Find References" ActionChristian Kandeler2021-06-072-3/+9
| | | | | | | | | | | | | | | | | | | | This one includes access type categorization, while the "normal" one does not. We need this now, because with clangd, the categorization is too slow to enable it by default. Change-Id: I2eb4608630d34452ae28f0836befd5d9053f42bf Reviewed-by: David Schulz <david.schulz@qt.io>
* | qbs build: Use exportingProduct in Export itemsChristian Kandeler2021-05-111-1/+1
| | | | | | | | | | | | | | | | The use of product in Export items is deprecated and will be removed in one of the next qbs versions. Change-Id: I2644a69012db4a4b4842066784913f4160d3d80a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | cplusplus: `PPToken` - introduce move constructorTim Blechmann2021-04-272-2/+6
|/ | | | | | | | | | | profiling qt-creator on my codebase i saw quite a few instances where reference counting of `QByteArray` showed up in `Preprocessor::handleFunctionLikeMacro` (hundreds of milliseconds of CPU time when profiling for a few seconds). using move semantics we can avoid this source of reference counting. Change-Id: I19a88a0501064f53d8095f7377bf901e462d25a0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Fix "Add Definition" quickfix for function parametersChristian Kandeler2021-04-091-0/+1
| | | | | | | | ... whose type is a template. Fixes: QTCREATORBUG-25560 Change-Id: I1d626f9376e8802a87ca1a28099932ccbf744d47 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Do not mis-classify bitfield declarations as initializationsChristian Kandeler2021-02-251-1/+2
| | | | | | Fixes: QTCREATORBUG-25390 Change-Id: I1976b7db2996f5a09db73adbd127aac9ab92d57d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Improve type name minimizationChristian Kandeler2021-02-221-0/+16
| | | | | | | | | | | ... for function parameters. These are located in the scope of the surrounding class or namespace. This uncovered a bug in the "Insert Virtual Functions of Base Classes" quickfix, which we also fix here. Fixes: QTCREATORBUG-8030 Change-Id: I7f11659dc8e252e3819df8178734e8958fa1b496 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* qbs build: Remove code for creating deployment packagesChristian Kandeler2021-02-171-6/+0
| | | | | | | | Not a use case anymore, and if it were, we'd do it using built-in capabilities. Change-Id: I4c588ad7fb282530880210cb4c5795677074b1e0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CplusPlus: Fix minimal name constructionChristian Kandeler2021-02-091-4/+4
| | | | | | | | | ... when creating the constructor implementation for a derived class. We would erroneously strip off the class name. Amends aae3ce15aa. Change-Id: I62c800d490626e8cb9416829633f9ef7b0c666cd Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CplusPlus: Fix minimal name constructionChristian Kandeler2021-01-292-12/+47
| | | | | | | | | | | | | | | | | | ... when using declarations are involved. Second attempt. I have a suspicion that this is not the "correct" approach, however: a) It appears to fix the problem. b) It does not break any tests. c) It's rather high in the call tree, so there's a low likelihood of breaking something else. d) Considering the hacky-looking pre-existing code dealing with using declarations (e.g. LookupContext::lookupByUsing()), it seems quite possible that there is no "correct" way with the current infrastructure. Fixes: QTCREATORBUG-14524 Change-Id: I28c6e53137c21ce158bbd03b92b3db39146116d5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Revert name minimization fixChristian Kandeler2021-01-291-8/+2
| | | | | | | This effetively reverts 87ec0f349f, which had unwanted side effects. Change-Id: I03438c18f43b07a6560416af746132bc4471fbb7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CplusPlus: Fix minimal name constructionChristian Kandeler2021-01-281-2/+9
| | | | | | | | ... when using declarations are involved. Fixes: QTCREATORBUG-14524 Change-Id: I0c391b88628f40973b6f601e60c64263f62a88a0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Refactor FindUsages::getType()Christian Kandeler2021-01-142-135/+167
| | | | | | | | | Use a dedicated class instead of a collection of lambdas. We had difficulties debugging this code, as gdb appears to have problems stepping into lambdas. The new structure is also easier to read. Change-Id: Icc88b5b884f1d60458c7c3254c2d13d7ab4592de Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Compile fixJarek Kobus2021-01-131-1/+2
| | | | | | | Amends 675abca1caad1c295330caa5e9b42cc812caee83 Change-Id: I958c6b43631d287e6973abb0c61a5c381766adb3 Reviewed-by: hjk <hjk@qt.io>
* Use std::unordered_map instead of std::mapJarek Kobus2021-01-131-2/+2
| | | | | | | In theory it should be faster. Change-Id: Ibf6ce8c5dced5a075b57f89ce6e2d5ed1c5d6be7 Reviewed-by: hjk <hjk@qt.io>
* Use positionInBlock in BackwardsScannerJarek Kobus2020-12-181-1/+1
| | | | | Change-Id: I7af777f1ff4d1b93e23462ceaf8b5989b8358d3b Reviewed-by: hjk <hjk@qt.io>
* Fix compile warnings about missing overrideJarek Kobus2020-12-081-21/+21
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: I9c50d070d34a198b39176f6db13bc2f95521a6a8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make canceling of Type Hierarchy evaluation more responsiveJarek Kobus2020-12-074-6/+39
| | | | | | | | | | | | | | | | | | On the beginning of the process of evaluating type hierarchy the evaluating thread may freeze on a first call to Snapshot::updateDependencyTable() for quite a long time (e.g. when showing the type hierarchy for IPlugin class inside Creator project - it may freeze up to about 3 seconds). So, when we want to cancel the evaluation (e.g. when we switch from "Type Hierarchy" into another view or when closing Creator) we may freeze for this period. In order to fix it we pass a future interface as an additional argument for Snapshot::updateDependencyTable() and cancel the update when cancellation of task was requested. Change-Id: I2147f10a68989587476c30369ec2ac552a57d5ae Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/4.14'Eike Ziller2020-12-031-1/+4
|\ | | | | | | Change-Id: Id4c4c06b086dfe38960f4d68694ae23f3e00109f
| * CPlusPlus: Fix mis-classification of pure virtualsChristian Kandeler2020-12-031-1/+4
| | | | | | | | | | | | | | | | Syntactically, they do have an initializer, but they are not initializations. Change-Id: I0556b279ce2d173868585cbce085b803c1cff285 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppEditor: Support decl/def switch for conversion operatorsChristian Kandeler2020-11-231-3/+19
| | | | | | | | | | | | Fixes: QTCREATORBUG-21168 Change-Id: I515fe146a679e007c96fa8d23f1457dadf07db3c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Merge remote-tracking branch 'origin/4.14'Eike Ziller2020-11-202-8/+18
|\ \ | |/ | | | | Change-Id: I5e138bb7883c0436fee14ca6af20e99396676af1
| * CppEditor: Remove using namespace quickfix: Don't insert inline namespacesLeander Schulten2020-11-192-8/+18
| | | | | | | | | | Change-Id: If386d31de723ca928d3c50f55e32205c50937b0a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Don't access static functions/fields via instanceAlessandro Portale2020-11-191-1/+1
| | | | | | | | | | | | | | Courtesy of readability-static-accessed-through-instance Change-Id: I71f54244f1e091315dac2943d9e1bfad6efa56a9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | Add missing "final" to unexported/unshared classesAlessandro Portale2020-11-181-1/+1
| | | | | | | | | | Change-Id: I84d5fc39d7ef5588a20545854d0cfd0b993db090 Reviewed-by: hjk <hjk@qt.io>
* | Merge remote-tracking branch 'origin/4.14'Eike Ziller2020-11-102-11/+38
|\ \ | |/ | | | | Change-Id: I2ae0eb18782224e48cd20d41907f9dfea6ee1771
| * CPlusPlus: Fix "find usages" categorization for sizeof and array accessChristian Kandeler2020-11-091-3/+13
| | | | | | | | | | | | Task-number: QTCREATORBUG-24894 Change-Id: I65fa097785b19e181f15178ad6d30608899316c0 Reviewed-by: André Hartmann <aha_1980@gmx.de>