aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus
Commit message (Collapse)AuthorAgeFilesLines
* Use QString::size() instead QString::length()hjk2025-11-135-8/+8
| | | | | | | Minor gain in debug builds and when stepping. Change-Id: I2540d309661e4babfd7331b068c17657ded2a098 Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/18.0'Eike Ziller2025-11-131-1/+2
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/docker/dockerdevice.cpp src/plugins/projectexplorer/devicesupport/devicemanager.cpp Change-Id: I4b50a2c81c443e1a42c0e379a49916289ed4751e
| * CppEditor: Do not try to auto-insert "closing quotes" inside stringsChristian Kandeler2025-11-111-1/+2
| | | | | | | | | | | | Fixes: QTCREATORBUG-33733 Change-Id: I1380a90652fc7066c18e7d026c60a648ce333e82 Reviewed-by: David Schulz <david.schulz@qt.io>
* | Cplusplus: Remove unused pp-scannerhjk2025-11-055-370/+2
| | | | | | | | | | Change-Id: Ic1bb2cab424b7077e5b85ec923a50f02269ef497 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CppEditor: Add "struct" when spelling out struct types in C filesChristian Kandeler2025-11-042-0/+5
| | | | | | | | | | | | Fixes: QTCREATORBUG-20838 Change-Id: If3f0c6a9bcf1ddbd264c4b9ac26bdecd88faca77 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Try a bit harder to find the start of a function callChristian Kandeler2025-11-031-1/+1
| | | | | | | | | | | | | | | | | | This allows us to provide function hints in the presence of many arguments. Task-number: QTCREATORBUG-31035 Change-Id: Ie7b52de59f34017a8dfc5cc853ac675db9bdf3ae Reviewed-by: David Schulz <david.schulz@qt.io>
* | Cplusplus: Mark Document ctor and assigment as deletedhjk2025-10-231-5/+2
| | | | | | | | | | Change-Id: I9b7f4a4e32128aa28496bcec374a962e83b8c884 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CPlusPlus: Drop the QString Preprocessor::run() overloadhjk2025-10-232-12/+2
| | | | | | | | | | | | | | | | ... and use toFSPathString, not toUrlishString to transform file paths. Change-Id: Ia106cf771e2609b4f989da16965dbd68dc077482 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Merge remote-tracking branch 'origin/18.0'Eike Ziller2025-10-091-1/+2
|\| | | | | | | | | | | | | Conflicts: src/libs/tracing/qml/MainView.qml Change-Id: I09e8420b693907246dc09487f1b8ba4d5515f35b
| * CppEditor: Prevent spuriously applying raw string prefix magicChristian Kandeler2025-10-081-1/+2
| | | | | | | | | | | | | | | | | | | | The application of the insertion action has to act under the same condition as the check. Amends 1bce50a4c4d0e5b76480887b8498b8936f0acdff. Fixes: QTCREATORBUG-33596 Change-Id: I1512bec0059a517f148e6ef1519f4dafca723edc Reviewed-by: David Schulz <david.schulz@qt.io>
* | CppEditor: Allow to generate function definition from friend declChristian Kandeler2025-10-072-4/+8
| | | | | | | | | | | | | | | | | | | | Due to implementation issues, we limit ourselves to unqualified names, which shouldn't matter much in practice (plus this is fringe functionality anyway). Fixes: QTCREATORBUG-31048 Change-Id: Ie2ad3268d15db59359bc83485ce48784ed29538c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppEditor: Add quickfix that adds a class def from a forward declChristian Kandeler2025-10-021-1/+0
| | | | | | | | | | | | | | | | | | | | We tailor it to the "private implementation" use case, so it is only offered if header and source file are present and the forward decl is in the header. Fixes: QTCREATORBUG-19929 Change-Id: I51c43d2f0913cfbc03d49d2474634e261dce7de5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppEditor: Support parameter packs in refactoring operationsChristian Kandeler2025-09-182-29/+59
|/ | | | | | Fixes: QTCREATORBUG-32597 Change-Id: I8d6c9571f9a00ab36f09537a6be4a343b3fd9a84 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix pretty-printing of constrained function parametersChristian Kandeler2025-09-013-9/+15
| | | | | | | | | | | | | | | This consists of three parts: 1) Fix parsing of contrained types. In a declaration func(MyConcept auto p); the parameter p was mis-parsed as a type name. 2) Properly handle the resulting AST so that a constrained parameter gets the right type. We re-use NamedType and combine it with the "auto" flag. 3) Teach the TypePrettyPrinter to handle such types. Task-number: QTCREATORBUG-33005 Change-Id: I2c6e3a64a2b9fb3d294a580fbc43ceb80f5d75e1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Fix pretty-printing of type constraint template parametersChristian Kandeler2025-08-292-3/+12
| | | | | | | | | | Note that this also affects other types of template parameters that we parse as type constraints, because we cannot tell them apart syntactically. Task-number: QTCREATORBUG-22954 Change-Id: I52971c4c6e1cf2eae362c746c71773c829127a67 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add missing null pointer checkChristian Kandeler2025-08-221-0/+2
| | | | | Change-Id: I4aae6fed7283d03ca759b168e0843a5deb5bf615 Reviewed-by: hjk <hjk@qt.io>
* Fix leaks in CPlusPlus autotestsChristian Kandeler2025-08-181-1/+1
| | | | | Change-Id: I4da9e96fea421f8aa4b6c6d1ffba8eb63930d4a7 Reviewed-by: hjk <hjk@qt.io>
* CppEditor: Fix handling inline namespacesChristian Kandeler2025-08-121-5/+4
| | | | | | | | Amends fe27f947b916a6b7333be50127c219bafb3d2353. Fixes: QTCREATORBUG-28692 Change-Id: I93c05c63de9fe87712abd771067299be23997e60 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Add proper support for template template parametersChristian Kandeler2025-08-122-25/+37
| | | | | | Fixes: QTCREATORBUG-17695 Change-Id: Ib040155504c2af824b5afd0bedc934c8e525c27c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Do not try to minimize names containing template name idsChristian Kandeler2025-08-081-2/+12
| | | | | | | | | | The template arguments are only present in the use of the type and will get lost when replaced by the plain name of the class. Doing this right might be possible, but would require a bigger rewrite. Fixes: QTCREATORBUG-9727 Change-Id: I12c1fceeea10b278e50a124418c1407d208d1d66 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix preprocessor expansion in include directivesChristian Kandeler2025-07-251-0/+8
| | | | | | | | Function-like macros were not considered. Fixes: QTCREATORBUG-27473 Change-Id: I6561afafe1163d746f03b1cdfea3012f953dfb8e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Cplusplus: Don't remote-qualify unresolved includeshjk2025-07-251-1/+1
| | | | | Change-Id: I7479ac4e7212a0ea661c8cde400a64d59457dd9c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Drop a few simple accessor functionshjk2025-06-242-28/+16
| | | | | | | | | | ... in favor of direct access to const data members. No difference in release, no measurable difference in debug, but takes mental cycles to wonder whether there could be a difference. Change-Id: I0f99ba324110e64c5ce620659ad7286b045d2280 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Save a few cycles in Client::isInjectedFile()hjk2025-06-242-3/+4
| | | | | | | | | | | | ... by moving to FilePath and FilePath::pathView(). This shouldn't be a lot as FilePath::toUrlishString() comes back quickly for local paths, but with this change there's no string creation at all, and the caller side is uniform now. Task-number: QTCREATORBUG-33116 Change-Id: Icc8669571c7e99ab73b3576af50a2ffbe7ce726b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/17.0'Eike Ziller2025-05-074-7/+10
|\ | | | | | | Change-Id: I086d8b300535aa1255ed68b850ddb7184f9fdbb1
| * CPlusPlus: Paddle back a bit for fast pre-processingChristian Stenger2025-04-304-7/+10
| | | | | | | | | | | | | | | | There are code paths that expect unexpanded function-like macros. Amends b419f638ecdec1e39f94c632065d73eddf3399dc. Change-Id: I28e8dedbf30c2a06bb29f61cfa0f69fc68012b03 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CPlusPlus: Support paren matching in raw string literalsChristian Kandeler2025-05-061-0/+31
|/ | | | | | | | | | | That is, if the user types an opening parenthesis inside a raw character string that does not have a complete prefix yet, assume that the parenthesis completes that prefix (if syntactically plausable) and insert its counterpart. Task-number: QTCREATORBUG-31901 Change-Id: Iafc0f590936b8698b94154278adeb006f02cf683 Reviewed-by: David Schulz <david.schulz@qt.io>
* CPlusPlus: Fix warnings about unused variablesChristian Kandeler2025-04-171-2/+2
| | | | | Change-Id: I519d95c0b73125c5bef875826f48f3211430c5bc Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Do not skip function-like macro expansion in FastPreprocessorChristian Kandeler2025-04-091-1/+0
| | | | | | | | | | | | | | | | Originally, macro expansion was disabled entirely in 2f649be1464e1ba6857f28cfb6c362f8fb0a8ca4, which was reverted for non- function-like macros in 605acda9ae751f31b68f5416077410a22555c3c0. Now we revert it entirely, as it clearly yields incorrect results. Note that FastPreprocessor is used in e.g. the central function Snapshot::preprocessedDocument(), so we cannot be sloppy there. I don't know how "fast" the FastPreprocessor still is after that, nor what was its intention in the first place, as there is no documentation whatsoever. Fixes: QTCREATORBUG-32598 Change-Id: If2da1dea89a74f619692eb46c3484cf970c06e55 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CplusPlus: Code cosmeticshjk2025-04-0912-51/+41
| | | | | | | QVector->QList, #includes, ... Change-Id: If6052294f20f759ed600e29d6eec5598fdcb10fd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* fix:ParseTranlationUnit is misspelledTian Shilin2025-02-282-5/+5
| | | | | | | Spelling mistakes this can lead to confusion. Change-Id: I25845911e4cbd670ea3b5e02dd4ae27542a67ff2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Editor: Make braceDepth an explicit member in TextBlockUserDataDavid Schulz2025-01-202-2/+2
| | | | | | | | | | ... instead of merging this information together with other unrelated information into the QTextBlock::userState. This removes the undocumented bit operations done on the userState and make the code more readable. Change-Id: Iae6b27298245c0191d6337ddf6c20aa30d1afcb3 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Rename FilePath::toString() into toUrlishString()hjk2025-01-102-2/+2
| | | | | | | | | | | | | | | | toString() is almost always the wrong conversion, but unfortunately too easy to find and often even working at least for local setup. This here raises the bar as the non-availability of the "obvious" toString() hopefully helps people to think about the semantics of the needed conversion and choose the right toXXX() function. The chosen new name is intentional ugly to reduce the likelihood that this (still almost always wrong) function is used out of convenience. Change-Id: I57f1618dd95ef2629d7d978688d130275e096c0f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/15.0'Eike Ziller2024-12-101-0/+3
|\ | | | | | | | | | | | | Conflicts: src/plugins/clangcodemodel/clangdclient.cpp Change-Id: Ibcfdf6d940d4d0e60f990c77c79cf3ed4438971b
| * CppEditor: Fix pretty-printing of auto typeChristian Kandeler2024-12-061-0/+3
| | | | | | | | | | | | Task-number: QTCREATORBUG-31678 Change-Id: I2c1684c71315d50c98f451b280fbfd08b5d8d3e8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppEditor: Add support for refactoring classes with conceptsMasoud Jami2024-11-124-14/+28
|/ | | | | | | | | | | | Add support for concepts that are used in class declartions by differentiating between "typename" template parameters and concepts. With this new patch it's possible to move (refactor) a member of a class that uses concepts to a cpp file, while respecting the concept definition. Fixes: QTCREATORBUG-31214 Change-Id: Id3e6f978e688c58c7291926823d5bddaaa587f60 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPP: Replace Q_ASSERTs with QTC_CHECKsJarek Kobus2024-10-101-30/+32
| | | | | | Fixes: QTCREATORBUG-31778 Change-Id: Iedb19523d636c6b975d6d8a49a7f0a1eff9a940f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Fix pragma parsingChristian Kandeler2024-09-251-2/+5
| | | | | | | | | Trailing comments were not handled properly. Amends ccae4fc93c3bdddc37e8cf68d9f0923fb64c1e7c. Fixes: QTCREATORBUG-31611 Change-Id: I9ec57e4b90faa6a5097f1bfdcaff20531b3dc589 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Port away from qsnprinf() and mark the project free of itMarc Mutz2024-08-271-5/+6
| | | | | | | qsnprintf() has been deprecated in favor of std::snprintf(). Change-Id: I3a963e7715403a8ac5cf0d93302eb40d0c116656 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Remove #include <utils/fileutils.h> from most header fileshjk2024-07-262-2/+3
| | | | | | | | | | It has some platform specific warts, filepath.h is somewhat cheaper and less ugly overall. Partially clean up surroundings Change-Id: Ida1fd470ec020f69c446109427f92a08e879789f Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CPlusPlus: Replace one FilePath::toString() with path()hjk2024-07-191-1/+1
| | | | | | | The injected files check would be wrong with remote paths. Change-Id: I729d9fa9b1399d4ef5337004153e62ca287948cb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Consider #pragma once when inserting includesChristian Kandeler2024-06-138-7/+55
| | | | | | Fixes: QTCREATORBUG-30808 Change-Id: Ib9f2ed1e428abfaa608b9dc42bc09dd2d403ee56 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Support completion of list iteratorsChristian Stenger2024-04-301-0/+8
| | | | | | | Fixes: QTCREATORBUG-30608 Change-Id: I169efe675e13540ecc5fbbd6b15dd13d8522db7d Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* QuickFix: Fix add definition for templated function in namespaceArtem Sokolovskii2024-02-071-3/+3
| | | | | | | | | - Fix add definition for templated/not templated function in templated class inside namespace Fixes: QTCREATORBUG-22076 Change-Id: I565cbdc8c6ab8d09727b4cd6f1c8fb45741c213f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* LookupContext: Replace QSharedPointer with std::shared_ptrJarek Kobus2024-02-067-50/+48
| | | | | | | | According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews QSharedPointer impl is poor and it's going to be removed from Qt 7. Change-Id: Ia7ec4b427c5971d6bd375659b291a9aad2ead253 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/12.0'Eike Ziller2024-01-301-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/cppeditor/cppfilesettingspage.cpp src/plugins/haskell/haskellplugin.h Change-Id: I880693c2e4986853b7aa600a5b7d6c09ad14634e
| * CPlusPlus: deal with QByteArray::(c)begin() return nullptrThiago Macieira2024-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You should either use begin() and end(), or data() and size(), and either way you shouldn't dereference the first iterator if the size is zero. Roberto's parser in 3rdparty/cplusplus assumes you've passed at least one character (I'm guessing the null terminator) and does pointer manipulation there: void Lexer::setSource(const char *firstChar, const char *lastChar) { _firstChar = firstChar; _lastChar = lastChar; _currentChar = _firstChar - 1; _currentCharUtf16 = ~0; _tokenStart = _currentChar; _yychar = '\n'; } Note the _firstChar - 1 math is technically UB if firstChar is the actual first character of any buffer allocation or string. Fixes: QTCREATORBUG-30044 Change-Id: I76ffba14ece04f24b43efffd17abcb8102497813 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Various plugins: Replace QMap with QHashJarek Kobus2024-01-292-3/+2
| | | | | | | | | | | | | | The key is a pointer, so use QHash. Change-Id: Iad633b9e599d653606d386371b71b002baac6371 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | CppEditor: Also rename function comments for declarationsChristian Kandeler2023-11-291-1/+7
| | | | | | | | | | | | | | | | | | ... that are not definitions. Amends 0a058bb65717cddb3e01a44f3241c029253a1eea. Change-Id: I4ba19f915d653d05570f8cd244ea50ab40d4b9dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* | QuickFix: Fix add definition for templated functionArtem Sokolovskii2023-11-091-43/+49
| | | | | | | | | | | | | | | | | | | | - Fix add definition for templated function in templated class - Fix "inline" placement for templated function Fixes: QTCREATORBUG-29408 Change-Id: I15f7793c9ae1e49d8338c1120135ddd1afbca4ca Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>