Commit Graph

83 Commits

Author SHA1 Message Date
Robert Löhning
cd0a140bde Improve translatable strings
Change-Id: I0104209bb0f865a48f9ca2524f62457f7524bba9
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-03-25 16:53:40 +00:00
Alessandro Portale
e4f260d544 ClangTools: Use qAsConst with non-const Qt containers in range-loops
Change-Id: Id9df0a27c4bcba57ee76574e32ca53cb6c28a43d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-17 11:19:15 +00:00
David Schulz
8f4be88eea ClangTools: prevent creating duplicated diagnostic marks
If we already have marks from the analysis for the open file we do not
need to create marks for the explicit analysis.

Fixes: QTCREATORBUG-24955
Change-Id: Id550566c6e9a2dbd4e4eb3e9b9460a7778e39a50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-24 12:48:31 +00:00
Jarek Kobus
6b588d7227 Remove unused variables
Mark some of them with Q_UNUSED, since it looks like
sometimes the copy is done on purpose, to force detach
or used for some hack with memory management.
In one case make unused variable used again.

Change-Id: I3825cd3399fa63bf6e12173c64509287d4a125e5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-11-20 13:58:46 +00:00
Christian Kandeler
7b6ab79f3e ClangTools: Do not include our wrapped Qt headers
These are only necessary for the code model and can prevent clazy from
finding certain issues.

Fixes: QTCREATORBUG-24845
Change-Id: I04ba6703812918c39ebbde1dbac5af85fe18622d
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-10-28 12:44:34 +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
d65ef60ea2 clang: Fix include/resource dir confusion
The getClangResourceDirAndVersion() function in ClangTools could return
the actual resource dir or the include dir, depending on the input. This
mistake happened because of misleading names spread all around the code.
Now the function returns what it says, and the other names are accurate
as well.

Change-Id: I0a8600857ee7b9fafb16256e0d1ad203ac3273d2
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-08-24 10:18:30 +00:00
Nikolai Kosjar
8cb74f88f9 ClangTools: Use resource dir from tool instead of hard-coded one
This makes it more likely that using other clang-tidy and clazy binaries
than the ones shipped with Qt Creator will work.

Done-with: Nikolai Kosjar
Fixes: QTCREATORBUG-23672
Change-Id: I8c44e037ca8d50505fe10032034edaf4f408d52c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-19 13:11:53 +00:00
Eike Ziller
227904d4a6 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ic39945a0e3e140a9467b4b4f572929257ff3a324
2020-05-26 09:00:05 +02:00
Nikolai Kosjar
aa1caac270 ClangTools: Fix referencing wrong counter for summary text
Fixes: QTCREATORBUG-23585
Change-Id: Icb3002434a728bd0d157190b7079b35bb639d0df
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-22 08:42:30 +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
995ba78fae Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/cmakeprojectmanager/tealeafreader.cpp
	src/plugins/cmakeprojectmanager/tealeafreader.h
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: I88d85be3903f57a55fddb7901e771a4822db1b85
2020-03-04 08:15:50 +01:00
Andre Hartmann
d76a2f4fcd Deduplicate elapsed time formatting
While it's nice to see my code spreading,
I still prefer to have it at one place.

Change-Id: I7bdb13c47ed7e96227deeb14b0a8070aa40148de
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-29 18:21:47 +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
Christian Kandeler
5cebf2a79a ProjectExplorer: Move some build-related code to BuildManager
The projectexplorer.cpp file is a huge mixed bag, which could use some
cleaning up. The queue() function is very much related to the
BuildManager, so move it there.

Change-Id: Ibc6425cc27d44514803a5e7c6139f83ddd760382
Reviewed-by: hjk <hjk@qt.io>
2019-12-19 17:35:46 +00:00
Nikolai Kosjar
07490e76de ClangTools: Print elapsed time on finish
...as this is useful to know for some bigger runs.

Change-Id: Ib4cc68ea4a3bed21ac7e632213e92e26be03d978
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-04 14:08:33 +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
ccc81cc760 ClangTools: Clean up handling of output files
Do not remove the output files after the runner invocation since they
will be removed later anyway due to the use of a temporary dir.

For debugging, allow to prevent deleting the temporary dir. This allows
easier inspection of the actually generated output files and also
enables us to import the diagnostics again without actually running the
tools.

Change-Id: I39e04d6debc2ffa5c15e836729a4b7c7d8a3798c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:24:35 +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
7bb333f15a CppTools: Add convenience functions to ClangDiagnosticConfig
Change-Id: Iebf01e1ab71dc3500cc6e492c525735f300272ca
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:24:11 +00:00
Nikolai Kosjar
7d851c12ed ClangTools: Remove pointless "Disable" setting for clang-tidy
...as unchecking the root item in the tree has the same effect.

Change-Id: I960ea2c09a71dad3b0ba3dfb38a19055653354cd
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:23:26 +00:00
Tim Jenssen
0be200e44e improve code
Change-Id: I06c7274c39f7e369d4cd9bed0c1ef77e4bc08b35
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-12 12:22:15 +00:00
Nikolai Kosjar
abb0babc58 ClangTools: Fix using correct run settings
Change-Id: Ibf545719bb67857c3ecaaedf2435caa15d592e03
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-31 14:07:53 +00:00
Leena Miettinen
3ffee8213d Clang Tools: Fix UI text
Change-Id: Ib2f6f548bbd778e585385315174f5fecb60b7f5a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-28 15:21:09 +00:00
Nikolai Kosjar
9fd4b25638 ClangTools: State diagnostic config on start
...in application output pane.

Change-Id: I3c630494b3e1283a2455d241cda048a89a02e9ab
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-10-01 14:40:56 +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
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
hjk
bcaeb73e68 ProjectExplorer: Store parts of active build config in runcontrol
... on runcontrol creation to prevent later access. Adapt some users.
There are more to come.

Change-Id: I2a3fe5eea0ada4eff7d08b79a6f49694e6962c8a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-09-24 11:20:51 +00:00
Nikolai Kosjar
1e0523423a ClangTools: Fix saving files before analyzing
...in current file mode.

Change-Id: Iae2ca9dc0ba5325f485943deb7fd93b3e9b419fe
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 13:37:19 +00:00
Nikolai Kosjar
1fad60153e ClangTools: Remove BasicSettingsWidget
This removes the

  [ ] Build the project before Analysis

from the run dialog as it seems unlikely that this option is useful per
project.

Change-Id: I65f2ae8d1e936883f27c360d5b7b518fd31cdf07
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 13:36:57 +00:00
Nikolai Kosjar
58a724b489 ClangTools: Merge ClangTidyClazyRunControl into ClangToolsRunControl
Change-Id: I162bbb9374fda0bbfc7f3db8fa245f3b5d6e73ad
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 13:36:33 +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
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
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
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
hjk
a4022c6156 ClangTools: Simplify a few signatures
A runWorker's project and target cannot change and are obtainable via
the runControl.

Change-Id: I9ce62e94a964dde9b29abf0d1f05eddcd4b87c14
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-11 08:32:33 +00:00
hjk
cd6b37d905 ClangTools: Rename *RunControls to *RunWorkers
That's what they are.

Change-Id: Icc167e87678f5888090d737325ac0067e6b3ea92
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-11 07:01:51 +00:00
Nikolai Kosjar
c9c214057e ClangTools: Generalize run control for multiple runners
No functional change at this point.

Change-Id: I537f9d8c9eed0b48056918809358a0a179b42eaa
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-09-05 13:20:15 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c 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>
2019-07-29 08:54:18 +00:00
Nikolai Kosjar
bf98bea4ad ClangTools: Sanitize parameter order
The path to the serialized diagnostics log is the main parameter, so put
it first.

Change-Id: I8865aad302b0e5d3008dab606ab774167cebda3c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-26 09:54:13 +00:00
Nikolai Kosjar
f240a9a947 ClangTools: Add using for QList<Diagnostics>
Change-Id: Ie7978fc33386d083b786ad75b3b6700125b11fec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-25 12:18:49 +00:00
Tim Jenssen
333b33edbe Merge remote-tracking branch 'origin/4.10'
Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
2019-07-12 15:53:56 +02:00
Nikolai Kosjar
b6346369eb ClangTools: Fix showing diagnostics outside the project root dir
Accept diagnostics from files that are known to the project
(Project::files()) instead of checking whether they are below the
project root directory (Project::projectDirectory()).

Fixes: QTCREATORBUG-22213
Change-Id: I2f96374d6de3f53b1bd42be875dfe44b25a55fb1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-10 07:56:57 +00:00
Eike Ziller
10098b2508 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	CMakeLists.txt
	tests/unit/unittest/unittest.pro

Change-Id: I64296ad31502d9b35012da129a28e9277e9fcf8e
2019-06-28 12:50:03 +02:00
Nikolai Kosjar
83bf414c85 ClangTools: Hint to "Build the project before starting" option
...if the analysis ends with errors.

Task-number: QTCREATORBUG-22382
Change-Id: I59f99947e80f7f4d0e2cac4df2e00f68e385ee01
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-06-25 08:16:47 +00:00
hjk
309c644466 ClangTool: Sanitize style
The string is passed further on as char * anyway, no need for
templates here.

Change-Id: I9305225f96111c0e9228d372e1231846099a9ecc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-06-12 06:55:05 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
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>
2019-05-28 12:23:26 +00:00
Orgad Shaneh
6fc532f812 Merge remote-tracking branch 'origin/4.9'
Change-Id: If4e8f52fc94c4e5fd9ec69c9000436d4ded913ff
2019-02-15 13:42:44 +02:00