Commit Graph

42 Commits

Author SHA1 Message Date
hjk
3bbda8f9da ProjectExplorer: Rename Tool{C,c}hainKitAspect
Change-Id: I74460b6402ab00f972c208023f03fac617982a11
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-27 13:35:28 +00:00
hjk
c28fb1fdbe ProjectExplorer: Rename ToolChain to Toolchain
Change-Id: Ibb520f14ff3e2a6147ca5d419b9351c50c141063
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-11-24 15:18:24 +00:00
hjk
aa25fdcc69 QtSupport: Rename qtkitinformation.{h,cpp} -> qtkitaspect.{h,cpp}
Change-Id: I12229e5e98b468101d32edd35be74bbda0921d89
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 08:59:52 +00:00
hjk
017d7c0e47 ProjectExplorer: Rename kitinformation.{h,cpp} to kitaspects.{h,cpp}
Change-Id: I069bddeb457366210d339edcbb8ffb359a40fab8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 07:31:03 +00:00
Jarek Kobus
16fc0fcf1c CppEditor: Reuse QScopeGuard instead of ExecuteOnDestruction
Change-Id: Ia60c8eab687599dbaa519daeab74e8799c33af95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-07 07:15:44 +00:00
Jarek Kobus
72d9decb87 QEventLoop: Remove unused includes
Change-Id: Ic278aa9b204a3caa17e38125d07a0176a8281422
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-05-15 10:35:29 +00:00
hjk
33cdb052ba FilePathify some testing code
Change-Id: I3739a6eb3c2172078e9519e8186daf94ec74d99a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-13 10:46:13 +00:00
Jarek Kobus
7ef8d8313d ClangDiagnosticConfig: Introduce ClangToolType enum
And reuse it where applicable.

Change-Id: If75f849ac936ef2c67b35c6a78d5bb055fc172d2
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-11 09:14:17 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
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>
2023-01-06 11:15:13 +00:00
Christian Kandeler
8b49b091f7 ClangTools: Run clang-tidy and clazy separately
They are two different tools and should not have been merged into a
single runner in the first place.
People can now actively decide to run clazy if they really want to,
rather than getting confronted with its increasingly irrelevant
complaints by default.
We keep the common settings widget for now.

Change-Id: I3c2b1db8c07ff5c128700d4a1deefd710967568a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-15 14:22:30 +00:00
Eike Ziller
57745407de Clang/C++: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
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>
2022-08-29 09:12:20 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
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>
2022-08-26 12:27:18 +00:00
hjk
2496ffe3ce Code cosmetics
Mostly unused #include's, also sort them or reduce scope.

A few namespaces, ...

Change-Id: I9ee71e07de7157c9942125672addf87dd41e78f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-24 14:44:13 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
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>
2021-09-01 14:53:58 +00:00
Christian Kandeler
33108795d6 CppTools: Turn some classes into pure value types
ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers
to Project and/or Toolchain, even though they were used in contexts
where these pointers were either unsafe to access or not guaranteed to
be valid anymore, which made their use difficult and error-prone.
We turn these classes into pure value types by copying in all relevant
information before the first async operation takes place.

Fixes: QTCREATORBUG-25678
Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-13 12:35:49 +00:00
Alessandro Portale
b2b6c64e6a Don't detach temporary containers
Change-Id: I736cfc61c81995a81b056b3e3e5703ded5912525
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-24 08:27:10 +00:00
Christian Kandeler
e7df6bba18 ClangTools: Further increase the test timeout
The clazy tool in particular can be exceedingly slow on Windows.
Increase the default timeout and also add a hook to set the timeout at
runtime via the environment.

Change-Id: I94c46ce03f8348fb239870df4d5627bf8d545307
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-15 07:54:19 +00:00
Christian Kandeler
34291fb639 ClangTools: Increase timeout for a unit test
This one can take quite some time even outside the CI.

Change-Id: I0d57d536fb23a1fec6d4cc8c0709fb699afdf9a2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-23 09:13:20 +00:00
Christian Stenger
6e798401a0 Fix plugin unit tests when using projects
The ClangTools and the AutoTest plugins use an internal
mechanism to load and configure a project when performing
their integrated unit tests.
Both assumed to have exactly one kit present for these
tests.
Make it possible to have more kits present when starting
with existing settings or if more kits get automatically
generated when starting with clean settings.

Change-Id: If2bc66320c4854f1d34a19d17107e8f0b7d64d39
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-06-17 04:13:30 +00:00
Eike Ziller
7414a47825 C++: Add tool button in editor for "Analyze File"
Adds a button for analyze file to all text editors that have a C++
source file open.

Task-number: QTCREATORBUG-23348
Change-Id: If08f2969304ee0817f00c9ee5ff8c0d4f96f7f72
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-15 11:20:38 +00:00
hjk
3f68292dbe ProjectExplorer: Introduce ToolChainKitAspect::{c,cxx}ToolChain
Special accessors to the repeatedly used C and C++ cases to denoise
and slim down user code.  Plus some code cosmetics nearby.

Change-Id: Iba4662bd4731d8c4256e658529f39d5c995691ce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-19 15:59:12 +00:00
Nikolai Kosjar
ab47d562a1 ClangTools: Provide more information if plugin tests fail
Print the error text we are showing in the info bar. For example:

  QWARN  : ...testProject(simple.pro) Error: Failed to build the project.
  FAIL!  : ...testProject(simple.pro) 'finishedSuccessfully' returned FALSE. ()

Change-Id: I7df91909dc4974a2c3aa9d44cb7511222517198c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-12-04 14:07:36 +00:00
Nikolai Kosjar
dcb35676df Clang: Clean up TidyMode/ClazyMode enumerators
Change-Id: Ie3ff0d629fd3c115df9c527e9ae8d7962fcfa156
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:23:38 +00:00
Nikolai Kosjar
202aa06d7c ClangTools/Debugger: Fix resource name clash
The two plugins plugins added resource files which were referenced with
the same name, namely

    :/unit-tests

Make the names unique.

Change-Id: If63e762663f3f61b15f826d76ffcd2eb66873db7
Reviewed-by: hjk <hjk@qt.io>
2019-11-28 16:05:18 +00:00
Nikolai Kosjar
b6ed781c28 ClangTools: Simplify clazy test
...in order to not run into parse errors in qstring.h involving

  * C++17
  * >= Qt 5.14
  * stdlibc++ of gcc 5.3/5.4

Change-Id: I8c06f90a88a4dd18503a81b68433604eb3bc9556
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-21 14:17:21 +00:00
Nikolai Kosjar
b895dfa382 Clang/ClangTools: Separate custom diagnostic configs
Add a separate pool of custom diagnostic configs for the
ClangTools plugin. That is, the diagnostic configs in

  Menu: Tools > C++ > Code Model

are not shared anymore with the configs at

  Menu: Tools > Analyzer > ClangTools

On plugin initialization of ClangTools, move tidy/clazy related configs
to ClangTools.

Change-Id: Id06087a58b53e466a3d7bbac669550c5fbe9899d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-01 14:10:28 +00:00
Nikolai Kosjar
d2648db914 ClangTools: Clean up plugin tests
We can provide the run settings explicitly instead of writing to the
settings.

Change-Id: Ibb9ef0280c14315ff7ba72be75dfd04c50d84484
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-01 13:51:42 +00:00
Nikolai Kosjar
d5bae3c1eb ClangTools: Merge ClangTidyClazyTool into ClangTool
Change-Id: Ieb6c4994ddcff9339a9cfb25c82e23dd2d2e8912
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-27 11:56:42 +00:00
Nikolai Kosjar
4750969c2b ClangTools: Move run settings to projects mode
Make the global run settings available per project in project mode and
thus remove the diagnostic config selection from the
selectable-files-dialog:

 * Extract the classes RunSettings and RunSettingsWidget instead of
   duplicating stuff.
 * Ensure to pick up the old settings
 * Add some convenience buttons/links in projects mode allowing to
   restore the global settings, to open the global settings and to
   navigate (back) to the analyzer mode.

Change-Id: I1b91b6f8e58a87a025774e4643c46e176b2a8885
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-27 11:46:35 +00:00
Nikolai Kosjar
04f9c41432 ClangTools: Add action for running on current file
Ideally, we would build the particular file before running the analyzer,
but not every project manager supports that.

For now, skip building the project for this action.

Change-Id: Ibc516c41dd0dbeb7b17b44c0ac35ae4b46ae801d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 13:35:43 +00:00
Nikolai Kosjar
abadd0f198 ClangTools: Tests: Fix tidy checks
Explicitly remove any by default enabled checks (e.g. static analyzer)
otherwise we get more diagnostics than expected.

Change-Id: I53e63a10001be8027e880dac01000bdca4a8f920
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-08-23 13:07:27 +00:00
Nikolai Kosjar
44e3e1a43c ClangTools: Sanitize ClangToolsUnitTests
This fixes the currently failing tests

	ClangToolsUnitTests::testProject(simple.qbs)
	ClangToolsUnitTests::testProject(simple.pro)

which produce more diagnostics now due to the upgrade to clang 8.

Sanitize the test by specifying exactly the tidy/clazy checks we are interested
in. This should avoid maintenance on clang upgraded (pulling in new checks that
will fail the test).

While at it, fix writing the settings for the tests, which worked by accident
so far.

Change-Id: If8bf5076ad7141faa93eced611334ac609f0cf92
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-10 06:46:48 +00:00
Christian Kandeler
83dd031960 ProjectExplorer: Rename KitInformation to KitAspect
The name "KitInformation" does not properly convey the fact that it
represents a certain *aspect* of a kit. The same goes for
"KitConfigWidget", which in addition was inconsistent with
"KitInformation".
We now use "KitAspect" and "KitAspectWidget".

Change-Id: I9804ee4cedc4d61fad533ea1dd4e4720e67fde97
Reviewed-by: hjk <hjk@qt.io>
2019-02-11 11:55:01 +00:00
Alessandro Portale
672bee2ed1 Don't detach temporaries
[-Wclazy-detaching-temporary]

Change-Id: I278873fff8592249f0c4519a4e4a6faff2dff6e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-02-06 12:28:10 +00:00
Nikolai Kosjar
b52251099d ClangTools: Fix plugin tests for clang 7
Change-Id: I52e7a822b03a989f9a01c6e19237d195781562e2
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-06 12:52:33 +00:00
Ivan Donchevskii
344cbb3a1b Clang: Move clang paths helper functions to Core plugin
These functions require core plugin so they can't go
to utils library. At the same time to use them in
ProjectExplorer plugin there are not too many choices
where to put them without introducing new dependencies.

Change-Id: I3cccccffaae8ac4bbce924fd809b5423da5dc503
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-06 12:38:52 +00:00
Ivan Donchevskii
bc458c7b5f Clang: Use the tree instead of the list for Clang-Tidy settings
List of checks does not give enough flexibility to
select/unselect specific checks. The tree fixes that.

Also remove Clang-Tidy checks line edit because it is
now integrated into the tree mode as an alternative way
of providing checks by pressing "Plain text edit" button.

'cpptools_clangtidychecks.h' is generated using python
script 'generateClangTidyChecks.py' and clang-tidy
from our LLVM/Clang 6.0 build.

Change-Id: I2ed1738cb2cbbf8dac6aba563469f06f69b11593
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-05-25 09:59:20 +00:00
Nikolai Kosjar
23df884f4a ClangTools: Remove clang static analyzer
...since it's superseded by the tidy integration.

Change-Id: Idafa5e1fb5129b1af8e42231a664684d4b90821f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:17:55 +00:00
Nikolai Kosjar
1bc605d050 ClangTools: Prompt for files to analyze
If the run button is clicked, the user is prompted to select the files
for analysis.

Change-Id: I21e4ee6b7c14392a8c1a901ac7aa1c9c16e30f0d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 10:48:53 +00:00
Ivan Donchevskii
52ac74b61c ClangTools: Remove clang executable settings
We use custom clang executable and it does not make
sense anymore to give a choice of changing it.

Change-Id: Icf86042ac3fcd08c320ef2bbdaabef1102b023b5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-04 09:58:37 +00:00
Ivan Donchevskii
c36f1f7f34 ClangTools: Add unit-test for standalone ClangTidy+Clazy tool
Use simple project with only few ClangTidy and Clazy warnings.

Change-Id: Idfbbeb653c5f610bda502c3ec23e7497f503f8a9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-04 07:06:09 +00:00
Ivan Donchevskii
43072e82d2 ClangTools: Generalize unit tests
Add an option to run different tools.

Change-Id: Iaf5c928663a888526eba9ee9d1fcea59e6083488
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-03 09:03:57 +00:00