Commit Graph

39 Commits

Author SHA1 Message Date
Jarek Kobus
64b9728a68 ClangToolsUtils: Add isVFSOverlaySupported()
Remove ClangToolRunner::supportsVFSOverlay().
Move check for modified document and vfsOverlay into
runner creator method, as it's called in the same cycle just
before the runner is about to be started.

Change-Id: I7a5df71bfa73c350862e4c7f9eae49773b6206b7
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-12 09:24:50 +00:00
Jarek Kobus
c4882a5a7a ClangToolsUtils: Reuse ClangToolType enum
Change-Id: Iee95a014d634a99c6e10582f8e942a12ebf1bd74
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-11 09:15:05 +00:00
Jarek Kobus
0ba3dbf1be ClangToolsSettings: Reuse ClangToolType enum
Change-Id: I24d7bde71ccf3fc3ea33b78e0ed629fa0ce90c04
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-11 09:14:31 +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
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Jarek Kobus
95e54055ef Clang: Limit the usage of qMakePair and std::make_pair
Change-Id: Ida094760023047ecb8ba29e60d5e81f766981b65
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-04 08:45:28 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +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
Christian Kandeler
685c3ee4cb ClangTools: Support doc urls for pre-relase clang-tidy
Change-Id: I9c28b5846d576d0b17c2e36f790d59b6bb005f6b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-16 14:04:55 +00:00
Christian Kandeler
4c9860d582 ClangTools: Adapt to new clang-tidy documentation URL pattern
See https://github.com/llvm/llvm-project/commit/
6e566bc5523f743bc34a7e26f050f1f2b4d699a8

Change-Id: Ifbb7bc1c09a890aef02611a8d0ae10b8217773d7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-12 08:31:57 +00:00
hjk
072489829d Utils: Make port.h slimmer
Fix the fallout. Also make comparisons hidden friends.

Change-Id: Ib16a294391f5732f94f9f411a48220b497691de2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-27 12:07:59 +00:00
Eike Ziller
3d4d7c7e14 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/clangtools/clangtoolssettings.cpp
	src/plugins/clangtools/executableinfo.cpp
	src/plugins/clangtools/executableinfo.h

Change-Id: Id8caf63e3e594792467d3447870086bd2d8f73b9
2021-09-13 17:03:55 +02:00
Christian Kandeler
3d64cf0d82 ClangTools: Fix clazy documentation URL
There is no patch version in the URL.
Amends 1b1e18a869.

Change-Id: I8d17b6aea3283e9a78744a28ad9a98e1c7c087e8
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-08 11:18:53 +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
hjk
09ae643153 ClangTools/CppTools: Code cosmetics
Mostly namespaces.

Change-Id: Ife8bbcb128344cf56d444da8f9d76b1204b9fe34
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 14:13:03 +00:00
hjk
04235535a5 ClangTools: Simplify Internal::fullPath()
Change-Id: I3b546acdd64c40899c98893c42e9827db2d99b27
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-18 12:02:54 +00:00
hjk
f29bc8c787 ClangTools: Proliferate use of FilePath
Change-Id: I3eb16546a729ab01c10e37572adac9aef83f5cd4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 11:43:30 +00:00
Christian Kandeler
1b1e18a869 ClangTools: Make sure clazy doc URL corresponds to tool version
Note that this will only work with clazy >= 1.10. For earlier versions,
we fall back to the master branch documentation, as before.

Fixes: QTCREATORBUG-25869
Change-Id: I7a8188eda15c4e0548bfaa63aa90f721aa44d6c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-29 09:28:05 +00:00
Christian Kandeler
74385cc10c ClangTools: Make sure URL for clang-tidy checks is always correct
Fixes: QTCREATORBUG-25902
Change-Id: Ifadb6c90cf9a86fc4efb734d6105217b70f9419d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-29 06:58:58 +00:00
David Schulz
0cfe27a53d Debugger: filepathify DiagnosticLocation
Change-Id: Ibbbf137231b313ec10e3d57c0230217b0c1e0a6c
Reviewed-by: hjk <hjk@qt.io>
2021-06-09 06:57:42 +00:00
hjk
7cb7e221bd ClangTools: Avoid one use of mutable ProcessArgs::iterator
splitArgs() is more compact and sufficient here.

Change-Id: I789b9ee37899b3d26bd4fabea7ab1756a6d8ac2b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-11 10:00:25 +00:00
hjk
f2f40efa03 Utils: Move process arguments class out of QtcProcess
The main QtcProcess interface is nowadays a CommandLine, with no
explicit references left to QtcProcess::Arguments and related static
helper functions, so it only clutters the QtcProcess class interface

So move these items out of QtcProcess, later potentially to a separate
file pair.

Change-Id: I45c300b656f5b30e2e2717232c855fdd97c2d1d7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-11 09:45:24 +00:00
hjk
c23cdd9262 Utils: Merge {synchronous,qtc}process.{h,cpp} file pairs
Mechanical to prepare merging the actual classes.
Adapting #includes.

Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 09:47:51 +00:00
Christian Kandeler
5066ddd908 ClangTools: Add documentation for current diagnostic to tooltip
Fixes: QTCREATORBUG-25163
Change-Id: I284c50c0b9b73c74ba328624c5238368de05839d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-20 10:01:29 +00:00
Christian Kandeler
ab91e547da ClangTools: Allow to disable a specific type of diagnostic
... from the results list.
This is much more convenient for the user than having to locate the
diagnostic in the settings first.
This patch deals with the global settings. We plan to offer the same for
project-level settings in a follow-up patch.

Task-number: QTCREATORBUG-24852
Change-Id: I7a97189c393048b98b9c2cdb6f21861a34670e8f
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-17 12:40:58 +00:00
David Schulz
e176958da1 ClangTools: Add automatic clang tool runner for open documents
Fixes: QTCREATORBUG-23349
Change-Id: I81197180c9d69c7df6184f8fcbf05f2256eaf7f6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-08-28 07:20:32 +00:00
David Schulz
7f562c4d33 ClangTools: Add diagnostic mark class
These marks can now be disabled.
This greys out the annotation color and the icon of the mark.

Change-Id: I5af4591db4baaaef55c986252f77d5d977427b56
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-08-28 07:20:19 +00:00
Alessandro Portale
0be309bcf1 Various places: performance-for-range-copy
Change-Id: I475990d32a5211d31a77782667a2dfedba134137
Reviewed-by: hjk <hjk@qt.io>
2020-06-15 05:58:46 +00:00
Nikolai Kosjar
9fc2fda07e ClangTools: Remove dependency to libclang and custom clang binary
Before this change, we've invoked a custom clang binary that had clazy
statically compiled into it. The invocation also ensured that the
diagnostics were serialized to a file, so that libclang could be used
afterwards to read them.

As the clazy-standalone executable supports exporting diagnostics to a
YAML file now (just as clang-tidy) and Qt Creator ships it already, rely
on that executable alone instead of the clang/libclang combo.

While we do not depend on any clang header or library at build-time now,
the CompilerOptionsBuilder constructor still needs the CLANG_VERSION and
CLANG_RESOURCE_DIR pieces from llvm-config. This dependency should be
removed as next.

Change-Id: I4fa5753ab09008fd24bc5247b28c4836b5e8ca45
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-05-19 12:28:49 +00:00
Nikolai Kosjar
1b4de8d769 ClangTools: Add help context menu entry
...that opens the documentation page for the current diagnostic.

Change-Id: I398fdc82bb118a80536acbb12420a9bac84e66c9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-13 14:33:55 +00:00
Nikolai Kosjar
fbd350f31f ClangTools: Introduce an info bar
...displaying status information and errors.

Change-Id: I4f86b440b28e82786299700dee572e77de7334f3
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:24:24 +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
0d7a30cdfe ClangTools: Query the tools for supported checks
...instead of hardcoding them for a particular version of
clang-tidy/clazy.

While at it, move also the tidy/clazy widgets to ClangTools as this
simplifies feeding data to them.

Reduce also the built-in configs to a single one using clang-tidy's and
clazy's default checks as they look very reasonable and saves us some
porting effort. Also, our previous built-in configs were just too
numerous.

Change-Id: Ib9297acb7810a940b86a23a8695530506a570394
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:23:13 +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
fc37ea4276 ClangTools: Add UI for specifying executables
Add a new group box "Executables" for this. Hide the UI for
clazy-standalone unless QTC_USE_CLAZY_STANDALONE_PATH is set as there is
no released version with the needed -export-fixes option.

Rename the previous group box from "General" to "Run Options".

Change-Id: Ia9daf66c40d3a7eea98b31d9c086886d29466490
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 13:35:01 +00:00
Nikolai Kosjar
f223c094a1 ClangTools: Show hint when disabling "Build the project before analysis."
Show also the same hint as a tooltip.

Fixes: QTCREATORBUG-22382
Change-Id: If1b594994cea387d6727775ce4c28c21d51f2d86
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-06-26 08:55:10 +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
e9c462391e ClangTools: Split generic part from static analyzer tool
To reuse it for other clang-based tools.

Change-Id: I6c0d8e9eee543fa08faf3bf93c9fac33e43c6820
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-04-13 12:34:53 +00:00