summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor
Commit message (Collapse)AuthorAgeFilesLines
* CppEditor: Do not underline leading whitespaceChristian Kandeler2020-06-234-1/+130
| | | | | | | | | ... when visualizing the range of a code model warning. Otherwise, warnings covering multiple lines can get too noisy. Fixes: QTCREATORBUG-18659 Change-Id: Ieff7729d8069e791027f7bdde5fca13f4c7f7163 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Fix build with Qt < 5.14Christian Kandeler2020-06-191-2/+5
| | | | | Change-Id: Ie08a7c0d19fff60b91b1855f7177813776542ef4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Better highlighting for raw string literalsChristian Kandeler2020-06-192-1/+48
| | | | | | | | | | It can be rather difficult to see the actual content of a raw string literal among all the clutter. Let us help the user by highlighting the string differently from the delimiter. Fixes: QTCREATORBUG-19119 Change-Id: I14447d62a686d82a2f2e123786a9b0eec16a0fa2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* CppTools: Also look up definitions for variablesChristian Kandeler2020-06-182-3/+65
| | | | | | | | | ... not just functions. This includes global variables and static members. Fixes: QTCREATORBUG-18828 Change-Id: Iee9f83a4f955a859c6fc4038c61997b30afdaec8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Move InfoBar to UtilsEike Ziller2020-06-184-12/+13
| | | | | | | | | The only reason it was required to be in Core plugin, was its use of Id, which now is available in Utils. Change-Id: I66ce863c24924e6448d339b3422538a7fe167336 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Move Id from Core to UtilsEike Ziller2020-06-181-1/+2
| | | | | | | | | | | | | | | | And add a compatibility wrapper for Core::Id, so we don't have to rename all occurrences from Core::Id to Utils::Id. This allows us to use Id also in Utils, which makes it possible to e.g. move Core::InfoBar to Utils without work arounds. Change-Id: I5555d05b4e52f09d501dbfe5d91252a982a97c61 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CppTool: Avoid a use of QStringRefhjk2020-06-161-1/+1
| | | | | Change-Id: I2a82bad7d91e059915526f0cf7b89f0d8367463a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* TextEditor: Sort indent ranges before applyingChristian Kandeler2020-06-151-0/+34
| | | | | | | | | | It can easily happen that callers insert indent ranges out of order, and without sorting the indentation done earlier in the file is not considered for the later parts, leading to inconsistent results. Fixes: QTCREATORBUG-18929 Change-Id: Ice2abe92d54446bcdd102c6a1f822262a8533543 Reviewed-by: David Schulz <david.schulz@qt.io>
* CPlusPlus: Fix overload resolution involving default argumentsChristian Kandeler2020-06-101-0/+6
| | | | | | | | | | If one of the overloads had additional default arguments, then for each of these, its priority was increased, which does not appear to make any sense. Fixes: QTCREATORBUG-17807 Change-Id: Id5be81ce52c615a424fe4314d2e50385b3fb2b1c Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CppEditor: Fix operator refactoringChristian Kandeler2020-06-102-1/+26
| | | | | | | | | The refactoring option was not triggered if the operator definition had a different amount of whitespace after "operator" than the declaration. Fixes: QTCREATORBUG-6236 Change-Id: Idf6438203e28d3f1effe0a0375d6563f813a9726 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CppEditor: Extend "Add Include" quickfixChristian Kandeler2020-06-053-34/+45
| | | | | | | | ... so it works for all kinds of symbols, not just Qt classes. Fixes: QTCREATORBUG-21 Change-Id: I2d329c09b64cd8f7eef8cce7d9f022aca8586c0d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Do not treat friend declaration as member functionChristian Kandeler2020-06-053-1/+15
| | | | | | | | | | | ... when trying to create definitions from declarations. Instead, we completely ignore friends in this context, arguing that the respective function normally should have a proper declaration somewhere else. Fixes: QTCREATORBUG-7164 Change-Id: I3ddb89cefecbc494f9c7e63600b65fd6288b7169 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CppEditor: Support sorting of outlineChristian Stenger2020-06-052-1/+30
| | | | | Change-Id: Icf31991327800dbcb2c5c2e8076011dfa85d6f2a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CplusPlus: Fix type information for anonymous enumsChristian Kandeler2020-06-041-0/+25
| | | | | | | | | | Variables declared like this: enum { E1, E2 } e; would not get assigned a proper type. Task-number: QTCREATORBUG-7487 Change-Id: I4362f22feb0f2e4e1e754e9c623e5576fa31f4bc Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CPlusPlus: Add missing type information for enum variablesChristian Kandeler2020-06-041-0/+25
| | | | | | | | | | | | | | Consider these two variable declarations: enum EX { EX1, EX2}; EX ex; emum EY { EY1, EY2} ey; The ex variable would correctly get assigned type EX, but the ey variable would not have any type. This is now fixed. Task-number: QTCREATORBUG-7487 Change-Id: I3e09c5766fdb9e6baf3a8d7bc6f2fc581f2d824b Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CppEditor: Fix access to dangling pointerChristian Kandeler2020-06-041-1/+1
| | | | | | | Found by coverity. Change-Id: I4b73af9b22b80953b4ba6c1004884862c9bdd3b8 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Use dialogParent() instead of mainWindow()Eike Ziller2020-06-021-1/+1
| | | | | | | | | | There are very few reasons to use mainWindow() directly. Especially for modal dialogs, using dialogParent() is important, since that guarantees the stacking order in case of other dialogs currently being open. Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6 Reviewed-by: hjk <hjk@qt.io>
* C++: fix built-in code model to work with shared_ptr on MSVC 2017Volodymyr Zibarov2020-05-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | These changes target Find Usages feature to work with shared_ptr. Improve libs/3rdparty/cplusplus and plugins/cplusplus: parse __declspec() attribute, call to variadic function template without specified template arguments, if constexpr, c++11 attributes [[value]], function templates with default parameters, resolve order for function vs template with default parameter, template operator->() with default arguments, template specialization with numeric values, find best partial specialization, fix partial specialization for non-first specialized argument Fixes: QTCREATORBUG-7866 Fixes: QTCREATORBUG-20781 Fixes: QTCREATORBUG-22857 Fixes: QTCREATORBUG-17825 Change-Id: I31a080f7729edfb2ee9650f1aff48daeba5a673b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Nikolai Kosjar <pinaceae.pinus@gmail.com>
* CppEditor: Consider namespaces in "extract function" quickfixChristian Kandeler2020-05-292-1/+34
| | | | | | Fixes: QTCREATORBUG-23256 Change-Id: I99b1271907767c3607e35adb49bd4109f3eca18c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppEditor: Detect changes in a function's exception specificationChristian Kandeler2020-05-281-0/+24
| | | | | | | | | ... so that the light bulb will pop up and let the user change the associated declaration or definition. Fixes: QTCREATORBUG-23895 Change-Id: I71032d81782b6d0bef929ecfa837eda2f5caec09 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppEditor: Add quickfix for creating a forward declarationChristian Kandeler2020-05-274-9/+373
| | | | | | | | | In header files, a forward declaration is often preferable to including another header file, so let's offer this as a quickfix. Fixes: QTCREATORBUG-23444 Change-Id: Ib50550abb5337098e4122e65e2af42a66742d6f6 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* TextEditor: move rename symbol action to text editorDavid Schulz2020-05-124-19/+9
| | | | | | Task-number: QTCREATORBUG-21578 Change-Id: I9a873dcd38bacb2287c45973b6be0091c3eb9480 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.12'Eike Ziller2020-03-302-10/+12
|\ | | | | | | | | | | | | Conflicts: src/tools/qml2puppet/CMakeLists.txt Change-Id: Id6243b0f725a68075d789bf35e771113b742645b
| * ClangTools: Add "Analyze Current File" to Tools menu and context menuEike Ziller2020-03-302-10/+12
| | | | | | | | | | | | | | | | Add the action to "Tools > C++" and the C++ editor context menu. Task-number: QTCREATORBUG-23348 Change-Id: I650e4d10e07ba227c6f89ab660ce7fa81263172e Reviewed-by: David Schulz <david.schulz@qt.io>
* | CppEditor: Quieten moc warnings during CMake buildTobias Hunger2020-03-171-1/+0
|/ | | | | Change-Id: If8791e85d519b4a20ffa7c9d9302000d07ea605e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Globally disable WindowContextHelpButtonHintKai Koehne2020-02-251-2/+0
| | | | | | | | | | | Do set the global application flag AA_DisableWindowContextHelpButton to avoid having to unset the default WindowContextHelpButtonHint in every single dialog. AA_DisableWindowContextHelpButton was added in Qt 5.10. Change-Id: I21fe8bc5ddfa4c01ec7a799b04bfb6ff1c9d6d86 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: Use FancyLineEdit in CppCodeModelInspectorDialogAlessandro Portale2020-01-241-6/+4
| | | | | Change-Id: Ib4688ec1406dafb39059fe3b4ea3277ea8e6fffa Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Use isEmpty() instead of count() or size()Alessandro Portale2020-01-202-2/+2
| | | | | Change-Id: I0a89d2808c6d041da0dc41ea5aea58e6e8759bb4 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Merge remote-tracking branch 'origin/4.11'Eike Ziller2020-01-092-22/+73
|\ | | | | | | Change-Id: I949f4f63abe12e11c4598c98295bfccc82e0ebdb
| * CppEditor: generate valid code via "Convert to Pointer/Stack Variable"David Schulz2020-01-082-22/+73
| | | | | | | | | | | | | | | | | | | | | | | | Adding a "= new <TypeName>" after converting a stack variable without assignment or initializer to pointer. Also remove the assignment when converting from pointer to stack variable as this works better with explicit constructors. Fixes: QTCREATORBUG-23181 Change-Id: I377ec32a1b66cf4b96db14cfcb4b71fb96c80c98 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | TextEditor: Fix typo in a TextDocumentLayout functionNikolai Kosjar2019-12-181-1/+1
| | | | | | | | | | Change-Id: I17153d9bfe9820f3ccc88f54bce1d494a522be33 Reviewed-by: David Schulz <david.schulz@qt.io>
* | Utils: Rename FilePathList to simply FilePathshjk2019-12-182-2/+2
| | | | | | | | | | | | | | The exact storage type does not really matter here. Change-Id: Iefec40f0f5909c8e7ba3415db4a11962694e1b38 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | FileIconProvider: Load icons and create overlay lazilyEike Ziller2019-11-151-6/+6
| | | | | | | | | | | | | | | | | | If the icon is registered via file path, not the icon directly, we can delay loading the icon and creating the overlay to until it is actually needed. Change-Id: Icfdc30ac0b717ff566a1064e4791e4bb23814958 Reviewed-by: hjk <hjk@qt.io>
* | Partial compile fix for current Qt dev and/or Qt 6hjk2019-11-121-1/+1
|/ | | | | | | | This does not cover Utils::MapReduceOption with QVector, and code that's not compiled on my machine. Change-Id: Ib63923985c52b1bb74e5ec2068a2bb37469ac618 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: SimplifyNikolai Kosjar2019-11-013-26/+6
| | | | | | | | bugprone-branch-clone readability-simplify-boolean-expr Change-Id: Id30a155e224370713d23b4b534fb82f5e630f36c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Fix grammarRobert Loehning2019-10-281-1/+1
| | | | | | | Fixes: QTCREATORBUG-23138 Change-Id: Idc874a25a2e3c18a802350d253fbd4908cdfcc93 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Port setMargins to setContentsMarginsLaurent Montel2019-10-162-2/+2
| | | | | Change-Id: Ie6b3f3e4dddbbf4bcc7ea7561ec348ff2c666907 Reviewed-by: hjk <hjk@qt.io>
* Clang: Avoid consuming gcc internal include pathsNikolai Kosjar2019-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the (default) include paths of GCC, e.g. /usr/include/c++/7 /usr/include/x86_64-linux-gnu/c++/7 /usr/include/c++/7/backward /usr/lib/gcc/x86_64-linux-gnu/7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/include discard gcc-internal paths like /usr/lib/gcc/x86_64-linux-gnu/7/include as they are not relevant for clang and even confuse it with regard to #include_next. Paths below the gcc install dir are considered as gcc-internal. The install dir is queried with $ gcc -print-search-dirs Some GCC distributions, like MinGW, ship the standard library headers in the install dir. Ensure to not discard these. Fixes: QTCREATORBUG-22898 Change-Id: Ia85258fb01b72ad073e71390e003fe8268e3b01f Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* C++: Transfer noexcept specifier for refactoring actionsNikolai Kosjar2019-10-082-0/+24
| | | | | | | | | | | | | | This applies for e.g. * "Add Definition..." (on function decl) * "Move Definition..." (on function decl) * "Insert Virtual Functions of Base Class" (on class specifier) Fixes: QTCREATORBUG-11849 Fixes: QTCREATORBUG-19699 Change-Id: I0d259bc1782470f3b3f19617230005a5594a5cca Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Core: Make InfoBar::GlobalSuppressionMode an enum classAndre Hartmann2019-09-121-1/+1
| | | | | Change-Id: I859a727196a887f7699a667fbe07e1bfead4cb2b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Remove usages of deprecated APIs of QLayoutSona Kurazyan2019-09-024-4/+4
| | | | | | | | | | Replaced: QLayout::setMargin() -> QLayout::setContentsMargins() QLayout::margin() -> QLayout::getContentsMargins() Task-number: QTBUG-76491 Change-Id: If28ef6910b3afe5d04e4746b74f9362a3e3b3c8e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: Reuse document for search resultsMarco Bubke2019-08-291-19/+48
| | | | | | | | | | Instead of open a document for every entry we do open it only once per search. For that we sort the entries by file path, so that they are clustered together and reuse the last document if the path hasn't changed. This can improve the calculations of the search results drastically. Change-Id: I9c9c1e387624297d84c6a2ca6edb6130f739d295 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppEditor: Fix reference to temporaryNikolai Kosjar2019-08-011-1/+1
| | | | | Change-Id: I3e2d7cb046e645e03ce5da7f18c48d6ce05fc76a Reviewed-by: hjk <hjk@qt.io>
* Skip pure virtual functions in "Insert Definition From Declaration"Antonio Di Monaco2019-07-291-1/+1
| | | | | | | | | | | | | Pure virtual functions do not need a definition. The issue is that, when the codebase is very huge (hundreds of thousands of files), the match method starts exploring the whole codebase, searching for an already present definition that will never be found, so the QuickFix wastes time for nothing and freezes the UI. Change-Id: Ia17740d740afcb40ec4f1b3237d8b9f5c1e3d54c Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Compile fix with recent Qt devhjk2019-07-293-10/+6
| | | | | | | | | The reasoning in 1b4766e26c6b did not take into account that the scope of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with f70905448f6 in Qt base. Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Standardize on int for line and column valueshjk2019-07-266-19/+19
| | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/4.10'Eike Ziller2019-07-251-1/+0
|\ | | | | | | | | | | | | Conflicts: src/plugins/baremetal/iarewtoolchain.cpp Change-Id: I483e81d7e920e724fb7cde84a8f6fa9bce4cd518
| * CppEditor: Tests: Remove a QEXPECT_FAILNikolai Kosjar2019-07-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | ...since this passes by now: XPASS : CppEditor::Internal::CppEditorPlugin::test_useSelections(macro use 2) '!hasTimedOut' returned TRUE unexpectedly. () Loc: [cppuseselections_test.cpp(105)] Change-Id: I1cf1416831d258319865c5a58a98bae5538ae245 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Avoid warning on empty expressionshjk2019-07-233-3/+3
| | | | | | | | | | | | | | | | For some reason, Q_UNUSED includes already a semicolon, adding one on the user side creates an additional empty statement. Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Merge remote-tracking branch 'origin/4.10'Tim Jenssen2019-07-042-4/+6
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/libs/utils/synchronousprocess.cpp src/plugins/baremetal/iarewtoolchain.cpp src/plugins/cmakeprojectmanager/cmakeproject.cpp tests/unit/unittest/CMakeLists.txt Change-Id: I124ad492df403286751e175d27fe36487ddf6d07