summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppelementevaluator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-757/+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>
* Utils: filepathify LinkDavid Schulz2021-05-251-2/+2
| | | | | Change-Id: Ie62500bde139158e776f9698ee0ea00c2a113f93 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Check if the document ptr is not nullJarek Kobus2021-01-271-0/+5
| | | | | | | | | Avoid a crash when double click in hierarchy view after the session has been changed or when the filename changed. Change-Id: Iebd7a99c220737262c79ade43c4ee8d11dcc037f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Refactor CppElementEvaluatorJarek Kobus2021-01-131-200/+272
| | | | | | | | | | | | | Separate the use of CppElementEvaluator for CppHoverHandler from the use for CppTypeHierarchyWidget. They are in fact much different things. Fix CppHoverHandler (enabled when ClangCodeModel plugin is disabled) showing tooltips for symbols other than class or template. Fix CppHoverHandler showing full template arguments for typedefs. Change-Id: I5c44016014749d0d958b91a9a1ee9b35d3ea5eaa Reviewed-by: hjk <hjk@qt.io>
* Show type hierarchy also for typedefsJarek Kobus2021-01-131-2/+12
| | | | | | | | | Make it possible to show type hierarchy for typedefs and unsings. Before, no type hierarchy was shown. Change-Id: I63ffa9c544072d66c42de8edf306c898d2fa90cb Reviewed-by: hjk <hjk@qt.io>
* Properly annotate templates with full scope in type hierarchyJarek Kobus2021-01-071-3/+22
| | | | | | | Fix activation of template classes. Change-Id: I811f505c1c01fa95d74847cb91dd1cf37476534b Reviewed-by: hjk <hjk@qt.io>
* Open type hierarchy from Type Hierarchy editorJarek Kobus2021-01-041-17/+76
| | | | | | | | | | | | | | | | | Make it possible to open type hierarchy for different class selected from Type Hierarchy editor. Make it available under context menu or on double click on class name (single click opens the class in cpp editor window as before). Double click doesn't expand / collapse items anymore (expanding available when pressing the visual arrow). Make navigation to editor more up to date - e.g. when linked location changed in meantime (source file was edited), it tries to find linked symbol quickly again (we introduce a small delay, up to 100-200 ms, depending on source file). Change-Id: Ifb4fd58e853589a17cd14be465b3a7695fa48193 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Make buildDerivedTypeHierarchy() a static methodJarek Kobus2020-12-171-8/+8
| | | | | | | | | Drop CppTools namespace when being in this namespace. Move a call to filesDependingOn() into buildDerived(). Make filesDependingOn() a static method. Change-Id: I6139f87597286bddf8298b06f8cf492066c8bedd Reviewed-by: hjk <hjk@qt.io>
* Don't leak memory when canceling Type HierarchyJarek Kobus2020-12-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | Add QFutureSynchronizer for collecting all running futures (including those already canceled, but not finished yet). It could happen, that we cancel the future, while the associated task still needs some time in order to catch the cancel request. When a d'tor of synchronizer is run it cancels and waits for all pending futures to be finished. Add extra check for isCanceled() after a call to updateDependencyTable(). In case the cancel was detected inside updateDependencyTable(), we should return immediately. Don't leak CppClass object inside handleLookupItemMatch() when the task was canceled. Amends: c400923308f5c4df4e8d96a04d12dc54322f7ade Change-Id: I709e14a0c8b563d522a8e8c32b087e5f83310b24 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make canceling of Type Hierarchy evaluation more responsiveJarek Kobus2020-12-071-0/+1
| | | | | | | | | | | | | | | | | | 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>
* Modernize Type HierarchyJarek Kobus2020-12-071-46/+121
| | | | | | | | | | | | | | Don't freeze UI on request for show Type Hierarchy. Move the lookup code into a separate thread. Don't clear tree hierarchy when waiting for new one. Show progress indicator on top of old hierarchy instead. Add a task to ProgressManager when working on a new hierarchy. Handle canceling the process of showing Type Hierarchy. Implement simple progress reporting for this process. Optimize a bit DerivedHierarchyVisitor. Change-Id: I3894ac6ed3f4834831831f083f718f8385ca346f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Standardize on int for line and column valueshjk2019-07-261-3/+3
| | | | | | | | | | | | | | | Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-1/+1
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Move Help item from text editor to coreEike Ziller2019-01-251-9/+9
| | | | | | | The functionality is not text editor specific. Change-Id: Iee531572f14673e75129f4bfbb64a1437899d31e Reviewed-by: David Schulz <david.schulz@qt.io>
* 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>
* Utils: Adjust column numbers affected by convertPosition changeIvan Donchevskii2018-11-091-1/+1
| | | | | | | | | | | | | | convertPosition change was introduced in 931ec39f64a. It changed 0-based column to 1-based which is how it naturally is in Qt Creator. This fixed some usages but broke many more. This is an attempt to fix the remaining use cases. Fixes CppEditor auto-tests. Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.6'Eike Ziller2018-03-131-0/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/cmakeprojectmanager/cmakeproject.h src/plugins/debugger/debuggerplugin.cpp src/plugins/ios/iosrunfactories.cpp src/plugins/nim/project/nimproject.h src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp src/plugins/qmlprojectmanager/qmlproject.h src/plugins/qnx/qnxrunconfigurationfactory.cpp src/plugins/qtsupport/exampleslistmodel.cpp src/plugins/winrt/winrtrunfactories.cpp Change-Id: Ib029fdbaa65270426332f5edd6e90264be5fb539
| * Fix C++ type hierarchyEike Ziller2018-03-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Dynamic casts between library boundaries tend to fail. Add an "explicit cast" to CppClass via virtual functions as a quickfix. This is a recurring issue, e.g. d2769f30037aa, 3f11ef92167ba and 2ffd0e2d0da5d to name just a few... This was introduced in 5e861d2be6729 Task-number: QTCREATORBUG-20001 Change-Id: Ie5a89a028d587e4e9d1ecec920a7c7d17497dbde Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* | CPlusPlus: Add toLink method to the SymbolIvan Donchevskii2018-02-071-1/+1
|/ | | | | | | | Basically move it from CppTools to CPlusPlus to be able to use it there. Change-Id: I0af80f93bdc029824397ceafdf940cb86c4382b0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Move some decls from header to sourceNikolai Kosjar2018-01-221-230/+263
| | | | | | | ...as there is no client using them. Change-Id: I2fbbe247e6f4bad537644a9574ddcc0606bfa13e Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: Move CppHoverHandler to CppToolsNikolai Kosjar2018-01-161-0/+473
This is in preparation for clang code model to provide its own hover handler. Change-Id: Ifbdd96f427989bd5d1fbc4badb9c38108485c2f2 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>