Commit Graph

30 Commits

Author SHA1 Message Date
Björn Schäpers
0b215ea822 clang-tidy: Fix parameters for call
This amends 8987996500.

Change-Id: Ia3559826a8a66e3ab977ca65a1712a2e499be6f1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-01-25 13:15:08 +00:00
Christian Kandeler
1a09f816a3 ClangTools: Support clang-tidy check options
Fixes: QTCREATORBUG-24977
Change-Id: I33ea247ba98788245ae1264262f60d084b73778c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-01-06 12:39:41 +00:00
Björn Schäpers
8987996500 clang-tidy: Suppress clang warnings
Those warnings should be printed via the clang code model, which can be
fine tuned to (de-)activate warnings. The clang-diagnostic-* warnings
from clang-tidy are not shown in the dialog an thus can not be
selectivly activated by the user.

Change-Id: I80b2cad227a9fd8fa0de253c73c40abfa8076be6
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-12-15 19:38:30 +00:00
David Schulz
7bbbdeac52 ClangTools: use VFSoverlay if the clang tool supports it
check the help output of a clang tool whether virtual file
system overlay is supported. Prepares for the vfso support
of clazy-standalone.

Change-Id: I157c94de1dda41c83945c9bc8a4c2e132b2e6551
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-04 09:48:44 +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
Christian Kandeler
7b5481f75c clang-tidy: Override "WarningsAsErrors" from config file
If WarningsAsErrors is enabled in the config file, any issues that are
found will make Qt Creator believe that clang-tidy has failed. So we
never want this in our analyzing.

Fixes: QTCREATORBUG-23423
Change-Id: I38f15588a9a02e25e0cf2f56c176c95639b97432
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-27 07:54:22 +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
Eike Ziller
92546d0983 Merge remote-tracking branch 'origin/4.11'
Change-Id: I0657cee6b87eea7b3178548bebed85d5ac824519
2020-01-03 08:57:33 +01:00
Nikolai Kosjar
2de52cffb1 Clang: Fix c++98-compat warnings for MSVC toolchain
Clang invoked with --driver-mode=cl will map "-Wall" to "-Weverything",
thus enabling -Wc++98-compat-pedantic and way more options.

Fix this by escaping "-Wall" in the cl mode, effectively passing in
"/clang:-Wall" instead of "-Wall".

This fixes what 5675169e56 addressed also
for ClangTools.

Change-Id: Ideb7bab923d0359e8039b61e9d53c8765de79c29
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-12-19 12:04:56 +00:00
Nikolai Kosjar
962ea69a1f ClangTools: Fix invocation for plugin runner
This was forgotten when the new default clang-tidy and clazy diagnostic
config was introduced.

Change-Id: Ic8a82ec2b06178a623ac1d1e50dcbc2b3d0174da
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-18 13:54:39 +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
e0af519d1a ClangTools: Fix clazy plugin invocation with recent clazy II
The enable-all-fixits option was also removed:

    05c9ccade0

Change-Id: Ide64e80a7ed8ee828fe4973fbf74bbaa8d3a09b8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-11-25 06:24:02 +00:00
Nikolai Kosjar
668cd2091a ClangTools: Fix clazy plugin invocation with recent clazy
As the no-autowrite-fixits option was removed with

  c5d0a2d016

our clazy invocation is incorrect and results in the usage being
printed.

Change-Id: I104273da8722f00c3df0d69d2b57c68fc9d3c1e6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-11-22 09:35:28 +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
342679292c ClangTools: Clean up ClangToolRunner
Change-Id: Icf0b8910ed236e48cfa775983e181491e6e9b6b0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 13:36:01 +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
74688679b2 ClangTools: Allow invoking clazy-standalone instead of clang
...this is for testing and debugging purposes so far.

Eventually, we want to switch to clazy-standalone. But as of now there
is no released clazy version supporting the required "-export-fixes="
option. It's in clazy's master branch only.

Change-Id: If09941dc387658bbc17646a9140f4ee8fad4d6b3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-09-12 10:51:48 +00:00
Nikolai Kosjar
a8f00d147c ClangTools: Invoke clang-tidy instead of clang
Change-Id: Ibcc53cf8cb8bbaf262757bec52f15936506dad50
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 10:24:30 +00:00
Nikolai Kosjar
9f868c44ce ClangTools: Use separate runners for tidy and clazy
For a file to analyze, start one process for tidy and one for clazy.

No functional change.

Change-Id: I049faed5ddbe306e4690ec6831fad19de0de35f6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 10:23:50 +00:00
Nikolai Kosjar
217332a48f ClangTools: Prepare for more ClangToolRunners
Change-Id: I6bbdbff496c0604367896d279df1a197f8a041bd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 08:47:07 +00:00
Ivan Donchevskii
53c407bc0c Clang: Fix build with clang-8
Clang-Tidy checks and Clazy flags updated.
CLANG-UPGRADE-CHECK done.

Change-Id: I1ca585c5c3c77a7f183719df9c262603150914e8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-17 12:13:36 +00:00
Ivan Donchevskii
0348009e0e Clang: Support MSVC style of compiler flags
Clang has MSVC compatible mode which works with MSVC style command line
flags.

When possible use the same flags (-I, -D, -U, etc.) and in other cases
either replace by MSVC analog (for example use /FI instead of -include)
or pass the argument with '/clang:' prefix (requires
https://reviews.llvm.org/D53457).

Change-Id: I95f33bed5dc8d9493895ed8d4359cdd70fc774b8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-16 12:17:31 +00:00
Nikolai Kosjar
b52fab502c ClangTools: Fix using clang options of diagnostic config
Task-number: QTCREATORBUG-21273
Change-Id: I2e03954ff2fc866a1f1d00ff250627bee0bbdb7e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 13:03:38 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Nikolai Kosjar
a809462c91 ClangTools: Avoid warnings from Q_OBJECT, too
Change-Id: I4540c1e2d9123af12e9f96976d6e37fe25aaf728
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-23 10:48:06 +00:00
Nikolai Kosjar
9b74948a61 ClangTools: Allow selecting diagnostic config for project
When starting the Clazy/Tidy tool, allow to select the diagnostic
configuration for the run.

As a side effect, fix a race condition where the runner could end up
with no diagnostic config (removed during run) - copy the diagnostic
config instead of referencing/querying it by the id.

Change-Id: Iedafa8f31a3bbd233d65818fe8de16add1e4d443
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-15 07:26:22 +00:00
Ivan Donchevskii
5288f35523 Clang: Enable Clazy fix-its
Only extra command-line options were required.

Change-Id: Id67b0cb29db4539ebec7facd07b53942f5900099
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-14 13:31:52 +00:00
Ivan Donchevskii
92fdbdc404 ClangTools: Use separate diagnostic settings for ClangTools
Share diagnostic configuration profiles between
ClangTools and ClangCodeModel but keep the unique
configuration index for each of them.

Change-Id: I86d95f7f220e929d60a53f3633167adfcd62a2da
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-14 07:03:04 +00:00
Ivan Donchevskii
219e23332e ClangTools: Add tool that runs clang-tidy and clazy
... over the whole project.
Generate and read serialized files to get diagnostics.

Change-Id: Iafc25fc70443107a040a995efc038aed35102bbf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-26 13:02:19 +00:00