Commit Graph

57 Commits

Author SHA1 Message Date
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
Nikolai Kosjar
d6a6d356bb ClangTools: Add errors as errors to issues pane
Fixes: QTCREATORBUG-19047
Change-Id: I4aca248d1ccb625fef77632bf35b554d7441e5cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-11 15:05:11 +00:00
Nikolai Kosjar
cc81284db6 ClangTools: Clear entries from issues pane when starting
Change-Id: I3e192c539236b80bf99431fa9d0b0232213a5372
Fixes: QTCREATORBUG-19049
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-11 15:04: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
Nikolai Kosjar
b9d3055e72 Clang: Allow to forward warnings flags from build system
Change-Id: I47ebb1ce4f3b5544408eb1d0f891ed5090394282
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-05 11:36:55 +00:00
Nikolai Kosjar
46fc8c4144 ClangTools: Show also diagnostics from project's header files
Fixes: QTCREATORBUG-21452
Change-Id: I73c85224e142f4f1d08c9ada75fe8359ebf0f984
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-25 14:32:01 +00:00
Ivan Donchevskii
0679c2ff25 Clang: Never use toolchain defines
The known cases provide enough flags not to require
toolchain defines.

Change-Id: Ia7e08a90eca6ea9474db40683ac1e63236f8643d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-16 12:18:55 +00:00
Nikolai Kosjar
f6b8302efd Clang: Stop forwarding toolchain macros
...for clang code model and clang tools use case.

This means that compiler detection code will see clang now instead of
the toolchain that is configured in the kit. While providing the
toolchain macros worked fine for the general case, it always was
problematic for compiler detection code.

By not providing the toolchain macros we are more close to the real
clang compiler invocation. That is, rely on clang to do the right thing.

Allow to go back to old behavior with QTC_CLANG_USE_TOOLCHAIN_MACROS=1
as this will be useful checking differences for debugging.

Fixes: QTCREATORBUG-19543
Change-Id: I23ffd761d83f35ca1a22269c3ef07a2dc62358bd
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-10 10:25:22 +00:00
Nikolai Kosjar
c7c800a73e CppTools: Split CppTools::UseBuiltin in two options
...for clarity.

No behavior change.

Change-Id: Id0334bc79b97a8ff53b37089e337530c9a01b1d4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-04 14:57:20 +00:00
Nikolai Kosjar
273157c2a1 Clang: Unify CompilerOptionsBuilder options
No behavior change.

Sometimes we use "SkipX, sometimes "UseX". Unify to "UseX" as this is
more natural to read.

Change-Id: Ib08bdb4cde93ed55fdb9c855566b10a3933cae37
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-03 15:19:03 +00:00
Nikolai Kosjar
0c38e3aea7 Clang: Clean up CompilerOptionsBuilder
No behavior change.

* Remove virtual from methods that are not overridden
* Move constant member functions that do no access any members into
  source file as static functions
* Remove QLatin1String where possible
* Make variable names a bit more consistent
* Other minor stuff

Change-Id: I34a582d5a468489e11365507b283e9aee157664f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-03 12:58:31 +00:00
Alessandro Portale
c4b07bf730 ClangTools: Modernize
modernize-use-nullptr
modernize-use-override
modernize-use-equals-default

Change-Id: I14a840c6f2972f57763cdfd4bb4483df1ec261d4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-08 11:40:57 +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
Marco Bubke
77b5907c57 Don't remove __cplusplus
For the indexing we need all tool chain macros. Originally it was a fix
because the C++ version of the project part and __cplusplus could be
different but now they should be the same. They will be now removed in the
compiler options builder.

Change-Id: I7ae8721a29632473e76ecedb411a6c9001e5e199
Task-number: QTCREATORBUG-21265
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-10 12:25:30 +00:00
Ivan Donchevskii
eeece5b5ad Clang: Skip built-in includes when exporting the compilation database
We don't want to have compiler-specific paths there.

Change-Id: If26434ea3760d4f2ca4c25bbcf0340f4ea781072
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-17 13:13:16 +00:00
Ivan Donchevskii
1b4f5c0670 Clang: Fix include paths order
C++ include paths should come before Clang include
folder. Therefore parse all options for include/c++/v1,
include/c++/{version}, include/g++ and /usr/local/include.

Task-number: QTCREATORBUG-20231
Change-Id: I22c41f07d241e1e564069bb192d4fe637ff05e87
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-27 11:35:02 +00:00
hjk
263cf4c608 ProjectExplorer: Remove RunWorker::setDisplayName
It has been an obsolete alias for setId for a while and downstream
uses have been adapted.

Change-Id: I467370aa67054599c7771e8275d28e62ddc461fa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-08-21 08:02:22 +00:00
Ivan Donchevskii
81d5d99db8 ClangTools: Do not spam the warning pane with long messages
The user does not usually need the whole command line.

Task-number: QTCREATORBUG-20707
Change-Id: I30cd395cd85eb0a3dd19b9d5f1b34a1c7a4b95a5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-20 09:50:21 +00:00
Orgad Shaneh
9e27c865f5 Clang: Fix usage of QString args
Change-Id: I49f1a79b9dfd27d896b296d65d375a05879bdc8f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-08-18 18:04:21 +00:00
Ivan Donchevskii
62e776aa8e Clang: Provide include directory only for libclang
Only libclang has issues with the include directory
search therefore undefining include folders makes sense
only for libclang options builder.

Change-Id: Ie3f62f5f3a89503e6e0ab59e18889e92425c3abc
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-08 14:07:13 +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
Robert Loehning
aaec887b15 ClangTools: Remove HTML from translated string
Change-Id: I74ab16ebebd00354a0821853f5a061e97b0c4f8b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-07-31 10:39:45 +00:00
Robert Loehning
0471ea1f94 ClangTools: Use proper argument for toolName
Change-Id: I9f258e97b5ef1bfd06909d2f12b644c145501a54
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-07-25 08:08:48 +00:00
Ivan Donchevskii
75cda95039 Clang: Add option 'Build before analysis' to project settings
Diagnostic configuration Id was already there but
not the checkbox whether to build project or not.

Change-Id: Icb5fc15bda5eed5e375cd90df1a96060b30bf57e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-15 12:14:44 +00:00
Nikolai Kosjar
bb6c02a443 ClangTools: Remove dead code
Change-Id: I5db111402902e81099489dc5ab4b0b929c574969
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-06-05 10:36:21 +00:00
Nikolai Kosjar
b81e5cb3b2 ClangTools: Remove temporary dirs
...when a new run is triggered instead of on Qt Creator shutdown.

There is no reason to keep them around for longer than needed.

Change-Id: Ida7698843cc2f8822ffd662679cf5da2c4ece05c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-06-05 10:36:03 +00:00
Ivan Donchevskii
87678e9a07 ClangTools: Remove huge "log files" after we've read them
Serialized diagnostics consume quite a lot of space.
Remove these files after they are read by QtC.

Change-Id: I4b257e44ee182484726ebd808069198443992016
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-05 09:00:08 +00:00