summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus
Commit message (Collapse)AuthorAgeFilesLines
* C++: Fix return type in preprocessor comparatorOrgad Shaneh2023-02-131-1/+1
| | | | | Change-Id: I6d85a78892291db7ae0b1de8a7e3b74d0401874a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Check maximum include depth in lexerChristian Kandeler2023-02-082-0/+13
| | | | | | | | We use a value of 200, which is also GCC's default. Fixes: QTCREATORBUG-28770 Change-Id: Id02b324cd2ffa81a709441a5d93856bcd06501c3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Cpp: support space ship operator in lexerDavid Schulz2023-01-302-28/+52
| | | | | | Fixes: QTCREATORBUG-27503 Change-Id: Idbff5a9b5b2e6e841e298ca6f706ef3c6aa1622b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Replace GPL-3.0 with GPL-3.0-onlyKai Köhne2023-01-1063-63/+63
| | | | | | | | | | | | | GPL-3.0 is deprecated by SPDX. Change done by find . -type f -exec perl -pi -e 's/LicenseRef-Qt-Commercial OR GPL-3.0(?!-)/LicenseRef-Qt-Commercial OR GPL-3.0-only/g' {} \; Change-Id: If316a498e3f27d2030b86d4e7743b3237ce09939 Reviewed-by: Lucie Gerard <lucie.gerard@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CMake build: Use version-less Qt targetsEike Ziller2023-01-051-3/+3
| | | | | | | | | Since we do not support Qt < 5.15 anymore, and as a first step for getting rid of our special FindQt5.cmake. Change-Id: Icc5dbaf9b0a3a622b1f609ff114b9decb6d2856c Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CPlusPlus: Work around Qt SiC breakagehjk2022-12-221-1/+2
| | | | | | | | | | | | | | | Qt Base b6cbd9c43afc7e005c1f78e1d0f700524930ed71 introduced #if !defined(QT_STRICT_QLIST_ITERATORS) && (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)) && !defined(Q_OS_WIN) #define QT_STRICT_QLIST_ITERATORS #endif removing iterator-to-pointer conversion starting with Qt 6.6 as dev, i.e. now. Change-Id: I75f25623917d0e666fb267db70d9701a13b270f2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* CppEditor: More migration to FilePathhjk2022-12-144-6/+4
| | | | | Change-Id: I261b713671e00bb567f61b4ee5ecf6fa83473bff Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/9.0'Eike Ziller2022-12-121-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/cppeditor/cppelementevaluator.cpp src/plugins/vcsbase/vcsbaseclient.cpp Change-Id: I31e03b063240416280f5ca88c31f432911d5c67e
| * CppTypeHierarchy: Don't keep pointers to temp objectsJarek Kobus2022-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When building type hierarchy the pointers to list elements were put into queue. Later, the list was modified and it was possible that list detaches causing stored pointers to be invalid. Simplify building type hierarchy by adding helper recursive methods. Fixes: QTCREATORBUG-28529 Change-Id: I240513fc097536d2175e2242766127b92aaa6a82 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CplusPlus: Pass FilePath to Preprocessor::run()hjk2022-12-074-15/+11
| | | | | | | | | | | | | | | | | | | | ... and update caller sides. Change-Id: I6a107e4a7fd9f7123cdc6f141da202845bcbbb66 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CPlusPlus: Do not try to qualify the names of template parametersChristian Kandeler2022-12-011-0/+2
| | | | | | | | | | | | | | | | | | | | These always appear as written. Task-number: QTCREATORBUG-28186 Change-Id: Iea8cc99ee6c17c1320817977fdb96ae1f730bc45 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: Prevent showing unwanted function template parametersChristian Kandeler2022-12-011-3/+4
| | | | | | | | | | | | | | | | Task-number: QTCREATORBUG-28186 Change-Id: Ic52090e873b4defa68cf98e2a5d08f2f0604e714 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: Another name minimalization fixChristian Kandeler2022-12-011-30/+43
| | | | | | | | | | | | | | | | | | ... involving using declarations. See also aae3ce15aa72631e290b4eb6d0e163706b10390b. Fixes: QTCREATORBUG-28386 Change-Id: I4171dce7b4e34b41c4a894e3bb34b3f62f82ac0f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Use FilePath for resolved include pathshjk2022-11-304-25/+29
| | | | | | | | | | | | | | | | ... and fix fallout. Change-Id: I66886e91ff476eff15db51cc024a8021e952d44d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | CPlusPlus: Code cosmeticshjk2022-11-292-17/+15
| | | | | | | | | | | | | | | | Rename a few 'fileName' into 'filePath'. Remove unneeded includes. Change-Id: I850e06cb4f58ec8dc70aa389f2521be8f5247b5c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | CppEditor: Remove Snapshot::remove(QString) overloadhjk2022-11-291-2/+0
| | | | | | | | | | | | | | | | ... and fix fallout. Change-Id: Ibbf865c3e4158fc98bb9b5372ce0633807b85576 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | CPlusPlus: Migrate Macro to FilePathhjk2022-11-283-10/+9
| | | | | | | | | | Change-Id: I94e8702e81e809e4d8318572cc070a0531edaefa Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CppEditor: Remove WorkingCopy::get(QString) overloadhjk2022-11-253-2/+7
| | | | | | | | | | | | | | ... and fix fallout. Change-Id: I8fe67616f8f327428b1c166ae69ec34c2924ee9f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppEditor: Switch to FilePath in IndexItemhjk2022-11-251-2/+1
| | | | | | | | | | | | | | ... and fix fallout. Change-Id: I45d27146806bdcb5ceb728b710eca51c7cd32ee2 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Return FilePaths from Document::includedFilehjk2022-11-253-22/+28
| | | | | | | | | | | | | | | | ... and fix fallout. Change-Id: Ieaad57700fa48d0c4a0dd9bf2c284315579b9473 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | CppEditor: Proliferate FilePath usehjk2022-11-253-7/+7
| | | | | | | | | | | | | | | | | | Remove SnapShot::{find,contains}(QString) overloads and fix fallout. Change-Id: I50c415826939e09ac111f33def611c7478fa5d97 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CppEditor: Proliferate FilePath usehjk2022-11-246-28/+29
| | | | | | | | | | | | | | | | | | | | | | This includes one functional change: It drops some cleaning of the path used to create the CppDocument, which is now assumed to be done on the caller side. Change-Id: I5e2a182028e4d5b56282ad85f4a5c665f081754f Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | CppEditor: Let users check for unused functions in (sub-)projectsChristian Kandeler2022-11-242-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that especially in C++, there can be a lot of false positives, especially in template-heavy code bases. We filter out the most notorious offenders, namely: - templates themselves - constructors and destructors - *begin() and *end() - qHash() - main() Since the code model does not know about symbol visibility, the functionality is quite useless for libraries, unless you want to check your test coverage. The procedure is rather slow, but that shouldn't matter so much, as it's something you'll only run "once in a while". Fixes: QTCREATORBUG-6772 Change-Id: If00a537b760a9b0babdda6c848133715c3240155 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Proliferate FilePath usehjk2022-11-228-29/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The starts with CppDocument::filePath(), plus a bit of the fallout This is one patch of potentially many. It is hard to draw the line where to stop this kind of chunk, this here converts a few additional functions for which including it in the patch looked like less churn than without. Converting is mostly fromString/toString, with a few exceptions for "already seem" like caches, that use cheaper "path()" to avoid likely performance regressions (on Windows FilePath comparison is currently case-insenstive, and more expensive). There should be no difference for local operation with this patch. Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CPlusPlus: Add new usage tag "Template"Christian Kandeler2022-11-172-0/+5
| | | | | | | | | | | | | | For use in follow-up patch. Change-Id: I49c057280be9b09862a89fa385a7396f1b1093bb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Add more usage tagsChristian Kandeler2022-11-072-6/+39
| | | | | | | | | | | | | | To be used in subsequent patches. Change-Id: Id7140aa39bb2adba343cc12b0273c90f3c12abeb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Make Usage::Type QFlags-basedChristian Kandeler2022-11-072-76/+82
| | | | | | | | | | | | | | | | We want to extend the enum with more non-exclusive values. Change-Id: I4d8ebe1f7327139c7817b9f621b4b74a883c5e09 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppEditor: Adapt include locations when renaming ui filesChristian Kandeler2022-10-242-4/+21
|/ | | | | | | Fixes: QTCREATORBUG-14259 Change-Id: I5e8209338b531f0e65d85b423053bd19a8b47652 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-076-11/+11
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
* CPlusPlus: Limit the usage of qMakePairJarek Kobus2022-10-044-4/+4
| | | | | | Change-Id: Ica59c320fb700369e968bb03a93deff34eb7ffb7 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* CppEditor: Remove extra CPlusPlus::Class memberChristian Kandeler2022-09-162-5/+2
| | | | | | | | | | | | | | | | | | | Amends 0fab5956ea91dc0ee40b4d99605ec26a3720c5c8. We want to avoid carrying these eight bytes ber Class instance around. Instead, we now just replace the (anonymous) struct name with the typedef'ed one. Note that in C (but not C++), this is possible: struct S {}; typedef struct {} S; struct S s1; S s2; However, our code model has never respected the extra struct namespace, so it can already not distinguish between occurrences of "S" and "struct S". Change-Id: I55feafea7d3a4a5848e10f7011f633a2ce0f626e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Store typedefed name for anonymous structsChristian Kandeler2022-09-152-2/+5
| | | | | | | | | ... and use it as the struct display name in some places. Fixes: QTCREATORBUG-26611 Change-Id: I1b127f5705307a0fabd2441ff871162c882927a5 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Remove Utils::optionalEike Ziller2022-09-012-11/+11
| | | | | | | | | | Since we are now requiring macOS 10.14 we can remove our local implementation of optional and use std::optional for macOS too. Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Use SPDX license identifiersLucie Gérard2022-08-2663-1512/+126
| | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CPlusPlus: Support structured bindingsChristian Kandeler2022-08-232-0/+8
| | | | | | | | | | While we do recommend clangd for modern code bases, we should still be able to parse basic language constructs. Fixes: QTCREATORBUG-27975 Change-Id: I189b991685a5cd5f62f2afce77878b60c895e8f9 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* CPlusPlus: Microoptimizationshjk2022-08-104-77/+26
| | | | | | | | Inline some simple accessors, return references instead of copies in some getters, Change-Id: I136574823c79ad0c63ed354b78e1ad83908e7ae5 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Remove Rreprocessor::run overload for QStringshjk2022-08-012-6/+0
| | | | | | | | | | The preprocessor operates on QByteArray, making it less convenient to use strings helps preventing accidental conversion roundtrips. Change-Id: Ifb2068a8fed137c52b05f2979b99cbce3462151e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: More porting.h related changeshjk2022-07-142-3/+0
| | | | | Change-Id: I528a6950dfa6e09eb7f7ada265c8c41dba816bfd Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Collapse most of porting,hhjk2022-07-133-6/+6
| | | | | | | | | Taking the Qt 6 branches, leaving some dummies until downstream adapted. Change-Id: Ib9b86568d73c341c8f740ba497c3cbfab830d8a1 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CPlusPlus: Drop the OverView::operator() overloadshjk2022-06-284-18/+9
| | | | | | | | | Use the named members instead. The operator() versions have been used only in a handful places, not using them makes things clearer on the user code side. Change-Id: I9b44371e094d498ff6ebfa9ecbe32f8654a63d4d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Inline more simple Type related functionshjk2022-06-286-20/+20
| | | | | Change-Id: I2103e8047b385b438e58072e8a2689f1889d2724 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Inline some simple central functionshjk2022-06-247-60/+60
| | | | | | | | | | | | | Depending on context, callgrind sees contributions of >8% to the total cost of project parsing for these functions. The functional are actualy executed executed out-of-line, often for a function body of one "payload" instruction only. Inlining removes the call/endbr64/ret overhead. Change-Id: I6886f08e322fcaa4e0f54d424279e0a8c24e4718 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Fix looking up containing function for search resultChristian Kandeler2022-06-133-84/+35
| | | | | | | | | | | | | - Move look-up to CplusPlus::FindUsages, where we are guaranteed that we actually have the document source. - Use the same straightforward algorithm as with clangd. - Undo the changes to CppDocument::functionAt(), which broke the autotest. Amends 6f7e7980d2b604c79507f9165098f783db8ab2e3. Change-Id: I008d05ba41a3b63b71e3131d7021e0d4e7d0641f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* 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>