aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* CppEditor: Move ClangdSettings into a dedicated set of filesChristian Kandeler2024-03-281-0/+1
| | | | | | | | | | They were originally put alongside the CppCodeModelSettings for simplicity, but there is no coupling (anymore?) between these two classes. Change-Id: Ic24df109b74a5b5c39de073c938c6de12f4aa319 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Mark some tests as XFAIL when running with clangdChristian Kandeler2024-02-281-0/+7
| | | | | | | | These are fuzzy decl/def switches, where clangd does not fail, but returns the original location. Change-Id: I86814c2dc5e1b8ec9085fd1486c0120e2f98a3b6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Fix running tests with clangdChristian Kandeler2024-02-281-1/+3
| | | | | | | | | | Try harder to find a suitable kit: - Pick one without warnings. - Pick one with a Qt, as otherwise configureAsExampleProject() will fail. Change-Id: I5a38e86bd81840c6794de365980618c904936d3a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Move CppHeaderSource implementation and test to same fileshjk2024-01-261-3/+0
| | | | | | | ... and remove the now-empty cppeditorplugin.h Change-Id: Ia28b180c280ba7b10ce0f2826f2ac69d128a453c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Remove some CppEditorPlugin member functionshjk2024-01-261-1/+1
| | | | | | | | | Inline renameSymbolUnderCursor() and switchDeclarationDefinition() implementation on the caller side. Also use the widget that's known there instead of the currentCppEditorWidget(). Change-Id: I158bef34234ce199accf25861062c97491bea381 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Un-skip some tests in clangd modeChristian Kandeler2023-11-301-15/+13
| | | | | | | | | These are passing now. Change-Id: Iec784b9e85a0f06266efff2f301f82891d343d50 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>
* CppEditor: Allow tests to run with ClangCodeModel enabledChristian Kandeler2023-11-291-2/+0
| | | | | | | | | | So that in the CI we can simply run: $ qtcreator -test CppEditor -load ClangCodeModel There are some failures left, which we will tackle one by one in follow- up patches. Change-Id: Ic4ebcb82f6439b344ae055889a6a16d56b2e3206 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Tr: Fix some source textsJarek Kobus2023-10-191-1/+1
| | | | | | Change-Id: I06458b177af2691a362368faed2b6bea3883a2f5 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* CppEditor: Add context object into connectionsJarek Kobus2023-08-031-1/+1
| | | | | | Change-Id: I1a74f62b0a42ea4971b14fb82213f662b5fe4736 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Various Plugins: Simplify return QList statementsJarek Kobus2023-08-021-1/+1
| | | | | | | Change-Id: I36633128e061d0544e4752a65804b460371283f7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppEditor: Make a few CppModelManager functions statichjk2023-07-121-1/+1
| | | | | | | ... to simplify code using it. Change-Id: Ib2bfbb5a17a1d48088a9cf4973d4c3f006cd34e4 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Editor: Adjust remaining usages of BaseTextEditor:convertPositionDavid Schulz2023-05-301-0/+1
| | | | | | | | amends 9bb126c0d6ff46bd00950261eb3eb9205f1d3879 Change-Id: I42b96f1f7364f75da88eccd7a86fc25b9cd1499d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* ClangCodeModel: Fix initial processor stateDavid Schulz2023-02-071-1/+1
| | | | | | | | | It is expected that the processor that is created by the provider is not running. Fixes: QTCREATORBUG-28769 Change-Id: Icef270c5f9255b97aa04fc3d0ea0cf872787bd24 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: Convert parts of ModelManagerInterface to FilePathhjk2022-11-291-2/+1
| | | | | Change-Id: If7503b6d6732e1735eb8d48ece6e80886d10c647 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Proliferate FilePath usehjk2022-11-221-7/+8
| | | | | | | | | | | | | | | | | | | 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>
* Editor: move ownership of assist interface to processorDavid Schulz2022-11-171-6/+6
| | | | | | | | | | This way the base class can manage the lifetime of the interface object and it doesn't need to be done in each implementation of perform. Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Editor: unify assist processor handlingDavid Schulz2022-11-141-3/+5
| | | | | | | | | | | Define the run type of the processor by its implementation instead of a enum value of the provider. The execution of a processor inside the assist now follows a unified procedure. Change-Id: Ibe9fab324c6072e77702c2663946d7a9f562a085 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang/C++: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*Eike Ziller2022-08-291-1/+2
| | | | | | | | | | | | And instead of qgetenv. Takes Qt Creator's setting at "Environment > System > Environment" into account, which makes it easier on some platforms to set them (e.g. macOS), can be configured differently in different settings paths, and potentially can be changed at runtime (depending on usage). Change-Id: I7678b8e429b5eff79f87eb637f6f2131be43d904 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | 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>
* CppEditor: Remove foreach / Q_FOREACH usage part 3Artem Sokolovskii2022-05-121-5/+5
| | | | | | | | Task-number: QTCREATORBUG-27464 Change-Id: Icbe620a83b6c2cf6b6166b76d01ca5f3c65ea87a Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* ClangCodeModel: Remove libclang fallback for "follow symbol"Christian Kandeler2022-04-281-3/+2
| | | | | | | | | | | | ... and "switch between declaration/definition". It's either clangd or built-in code model now. Use the opportunity to dissolve the pointless FollowSymbolInterface class hierarchy, which introduced a confusing parallel inheritance chain. Change-Id: I792ad55656c5dd9f10c6b4db7c5c36cf7be45125 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Fix testingChristian Kandeler2022-02-041-2/+2
| | | | | | | | | Now that clangd is enabled by default, we must explicitly turn it off to test the built-in follow symbol functionality. Change-Id: Ib275893a920145868b314ce02e9dd80f656bade4 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangCodeModel: Adjust cursor for following destructor symbolsChristian Kandeler2022-01-281-4/+4
| | | | | | | | | | | ... with clangd. More specifically, for the case where we switch between declaration and definition of a destructor. Since clangd expects the cursor before the "~" character, we move it there. Fixes: QTCREATORBUG-26809 Change-Id: I8ea6a060bea3545c963cb8ebbe2d3ae3a18da2d5 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Make some qHash and comparison operators overloads hidden friendshjk2021-12-061-6/+8
| | | | | | | Restricts lookup scope more to necessary bits. Change-Id: Ia42c95aaa70534843b7f6a90bfc56d2a1202c612 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Editor: pass AssistInterface to createProcessorDavid Schulz2021-09-161-2/+2
| | | | | | | | | The interface can be used for checking the context of a codeassist request to determine the correct processor that has to be created. Change-Id: I47ddb05c46399566e27bae21711f11a3a4132c3f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppEditor: Merge the four TestDocument classesChristian Kandeler2021-09-081-74/+27
| | | | | | Change-Id: Ie3d5a4ac2b8e3beee92f5abb88583c845056842e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Merge two TestCase classesChristian Kandeler2021-09-081-1/+1
| | | | | Change-Id: I53c7db9cda0a82706bee898d091f128c2c4bf32f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Remove unneeded CppEditorWidgetInterfaceChristian Kandeler2021-09-071-1/+1
| | | | | | | Removes a pseudo-abstraction and simplifies ClangdClient. Change-Id: I5161d069371ff92a517866bb7500517cab6781b7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Remove class CppEditorChristian Kandeler2021-09-031-6/+6
| | | | | | | | It's not needed, and conflicts with the namespace of the same name in some contexts. Change-Id: I281025abbfad0feb602f006e3b997a8b9c308b48 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-19/+17
| | | | | | | | | | | | | | | | 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: Move FollowSymbolTest into the Tests namespaceChristian Kandeler2021-08-301-9/+5
| | | | | | | | This is now possible, as there is no ambiguity anymore regarding the TestDocument class. Change-Id: I6f736a5790d2eab1c82f5429a9292aa9d7bcda56 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools/CppEditor: Rename the TestDocument classesChristian Kandeler2021-08-301-33/+33
| | | | | | | | | It was not helpful that we had four different classes with the same name. Note that they look suspiciously similar and could possibly be merged into a single class at some point. Change-Id: I7d4c10a09408226037bc0d276940bca39dc5f576 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Use test objects to group related test functionsChristian Kandeler2021-08-271-36/+49
| | | | | Change-Id: I65089f2a00d8d168f123becf160f82bfcca4c68c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ProjectExplorer: Use FilePath in ProjectExplorer::openProject{,s}()hjk2021-07-271-1/+3
| | | | | Change-Id: Ibfb7ab5ef7226b85452bd37b840408708935453b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clangd: Add per-project settingsChristian Kandeler2021-06-301-3/+3
| | | | | | | Users might want to use clangd for certain project, but not for others. Change-Id: Id29ce3349f0acd359cf7c824ece073b147ed2280 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Add dedicated settings and settings page for clangdChristian Kandeler2021-06-281-5/+4
| | | | | | | | We plan to add more clangd settings, and it makes sense to have a dedicated place for them both in the code and the UI. Change-Id: Ideb92935b7a5a6a98e07980f4011736fb82042d1 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Implement declaration/definition switch via clangdChristian Kandeler2021-06-181-6/+126
| | | | | Change-Id: I522a415d76fbc5332e5cc1fdfd2d7ab19cb9ed64 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Do not include base declaration in virtual overridesChristian Kandeler2021-06-171-1/+0
| | | | | | | ... if the cursor was on it. Change-Id: Ie0d6981e9f0d23a57c430f3aa33448e8f9002ee9 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Tighten the check for qualified member function callChristian Kandeler2021-06-161-5/+6
| | | | | | | Just checking for the base cast is not enough. Change-Id: I455533b7da31cf5c52d8c1b9dd93b3bb2fb58929 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Fix providing virtual override listChristian Kandeler2021-06-141-6/+0
| | | | | | | | ... when the cursor is right before the opening parenthesis of a member function call. The clang AST is different then. Change-Id: Ibb75c15d2e28c2004b5ab2dd8fd3db0a2da88e56 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Keep base declaration on topChristian Kandeler2021-06-141-2/+0
| | | | | | | | ... when presenting the list of virtual overrides, as we do in the built-in code model. Change-Id: I2598438f78cd9d9a7ddc1620391cea51d7e2da42 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Fix links for virtual overridesChristian Kandeler2021-06-111-7/+1
| | | | | | | | | For some reason, clangd returns the declaration instead of the definition position in the "Goto Implementation" result, so we have to do another look-up for each override. Change-Id: I2a99eb0dacdea07d5882087445dc2b2d61b24e58 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Do the "Go to Implementation" requests recursivelyChristian Kandeler2021-06-111-16/+11
| | | | | | | clangd reports only the first level of overrides. Change-Id: I4aef7ca548a7a06fc7461994c3b750f9372aa738 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Run test cases for virtual functions also with clangdChristian Kandeler2021-06-081-14/+77
| | | | | | | | This uncovered some bugs, of which we fixed the ones that we could do something about. Change-Id: Id8494793bec4d25635bf920133d9f9331bd36228 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Tweak test infrastructureChristian Kandeler2021-06-021-15/+106
| | | | | | | | | | | | | | ... so we can re-use the "follow symbol" test cases with clangd. Call Creator like this (clangd needs to be version 12 or later): $ QTC_CLANGD=<path to clangd> qtcreator -test 'CppEditor,*Follow*,*Switch*' -test 'ClangCodeModel,*dummy*' During testing, some invalid code in the test cases was uncovered and fixed. Change-Id: I9dc650fdba2a27600e6a550420ee873f6fb31d23 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Support decl/def switch for conversion operatorsChristian Kandeler2020-11-231-0/+13
| | | | | | Fixes: QTCREATORBUG-21168 Change-Id: I515fe146a679e007c96fa8d23f1457dadf07db3c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: More consistent fuzzy matching behaviorChristian Kandeler2020-08-141-4/+72
| | | | | | | | | | | | | | | | | | | | | | | | | There were annoying inconsistencies, for instance: - A not fully matching declaration was found from the definition, but not vice versa. - An implementation MyClass::foo(int) would fall back to a declaration foo(), but an implementation MyClass::foo() would not fall back to a declaration foo(int). These cases behave consistently now. To this end, the clang code model now forwards to the built-in code model if a function lookup has failed. Fuzzy matching for free functions has been limited, as the cons appear to outweigh the pros. For instance: void foo(int); void foo(double) {} Following the definition would lead to the non-matching declaration, which the user most likely does not want. As a side effect, redundant code has been removed in the SymbolFinder class. Fixes: QTCREATORBUG-20279 Change-Id: Ib97d6710c7e12fb0fdbc30b51a0067e09bfc2190 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Fix following signals/slots in old-style connectsChristian Kandeler2020-08-101-0/+20
| | | | | | | | | ... if the first argument is a call to a function returning a pointer to QObject. Fixes: QTCREATORBUG-13265 Change-Id: I12c2d07331a0c6dca56ad55c518240fd74be3dca Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Find implementations for pure virtual declarationChristian Kandeler2020-07-211-0/+25
| | | | | | | | | | Clearly, if a user presses F2 on the declaration of an (unimplemented) pure virtual function, they want to go to an implementation in a derived class. Fixes: QTCREATORBUG-10160 Change-Id: Ie8c4ff0001ab2c98a2d0e2ebc8d954cc928578c0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>