Commit Graph

26 Commits

Author SHA1 Message Date
Nikolai Kosjar
d122049aee ClangTools: Fix order of ExplainingStepItems
We sorted by line/column/text, but we should not change the order for
these items as the original order is crucial to understand the
diagnostics. For example, the clang static analyzer diagnostics provide
step by step notes to explain the main diagnostics and these does not
match the line/column order.

Change-Id: I1e7235b37eb5713b0b7135aab46124f590a1443a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-07 12:52:25 +00:00
Nikolai Kosjar
f5867d0fff ClangTools: Fix showing location for ExplainingStepItem
In case the ExplainingStepItem refers to another file than the main
diagnostic, display the file name too.

Change-Id: I1df2781766dc0c7a58b451e3c96b78574d574e54
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-07 12:23:32 +00:00
Nikolai Kosjar
8d9d24bc65 ClangTools: Fix copy action
* Location of the main diagnostic was not included.
* No actual message/text of an ExplainingStepItem ended up in the
  tooltip.
* Copy file path for FilePathItem
* Copy location and text for ExplainingStepItem

Change-Id: I47b890f77f5ff680ce82a75b51b598681a481385
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-07 12:23:19 +00:00
Nikolai Kosjar
9cfc4a68db ClangTools: Hide file path items without diagnostics
...in case diagnostics are filtered out.

Change-Id: I8a78f8873577ca80fe5a3d4123f64a9432c0fb7f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-07 12:22:27 +00:00
Nikolai Kosjar
c35977ce7b ClangTools: Make fixit items more user-friendly
...by providing an icon and a text describing what will be done.

Change-Id: I923c4d593314c903adcbd831028fef5e69d28783
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-31 10:34:53 +00:00
Nikolai Kosjar
26a6cf3bb3 ClangTools: Organize diagnostics by file path
* Introduce the file path as a top level node.
* Remove the location column.
  * Encode the line/column information in the DisplayRole, as for the
    Clang Code Model tooltips.
  * Double click on a diagnostic opens the editor.

Change-Id: I4c263537cc04c3c4feb6ccd5c395d60d8bee0bc3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-31 10:34:44 +00:00
Nikolai Kosjar
0299e66c05 ClangTools: Pimp child diagnostics
* Remove the artificial numbering
 * Use a nicer icon for notes as we mostly get these

Change-Id: Ic1022e3e2eec8512a1e80638d092c8be886aa6da
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-29 09:15:02 +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
Nikolai Kosjar
9ec8deb55e ClangTools: Add clear button to toolbar
Change-Id: I0caeb3fa118b57084f7df7a22952f3057ca601e0
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-25 14:31:48 +00:00
Ivan Donchevskii
5761caff9e ClangTools: Improve fix-its handling
Two areas are touched:
1. Select multiple diagnostics if they have the same set
   of fix-its.
2. Watch the files and invalidate diagnostics if corresponding
   file was edited.

Change-Id: If4487ba91f45c25d1aed1a98990dd9b6df9d7fe2
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-12 06:40:25 +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
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
Ivan Donchevskii
2d97b5950c Clang: Add checkbox for fix-its column header
Make possible to select or deselect all fix-its.

Change-Id: I2ff88afb0c451092752ee2cd7c9f083e24033500
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-06-21 13:10:40 +00:00
Nikolai Kosjar
c6f12991b0 ClangTools: Avoid freezing UI for many items
...if new items are added to the model or if filter is used.

When items were added, we have called
ClangToolsDiagnosticModel::diagnostics() two times:
 * from DiagnosticFilterModel::filterAcceptsRow()
 * from ClangTidyClazyTool::handleStateUpdate()

However, this does not scale since diagnostics() creates a temporary.

Fix this by accessing the diagnostics or the count directly from the
tree.

Change-Id: I4c6a32e0076c1b4228ed1b1ff9222c9918f92c5c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-29 12:51:51 +00:00
Nikolai Kosjar
bae61e08ea ClangTools: Fix applying fixits one by one
If a file had multiple fixits and only a subset was applied, the
remaining fixits in that file were invalidated. Fix this by adjusting
the locations of the not yet applied fixits.

Change-Id: I2c190412e871e9011c4d4a62ed938e76ad4cdf72
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-28 13:54:54 +00:00
Nikolai Kosjar
72aac9573d ClangTools: Avoid horizontal scrolling in the diagnostics view
Also, show the diagnostic text in the tooltip because the text might be
elided in the view now.

Change-Id: I7f38acacf72d68d7e4b696a01c7a0d1a76b4ed98
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-23 10:47:56 +00:00
Nikolai Kosjar
595f6980b7 ClangTools: Reflect state of fixits
...in the fixit column to avoid confusion.

As a side effect, add some error handling.

Change-Id: Ia30e9c9782f3c8021aedd2be7c682853a26d3f39
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-23 10:47:47 +00:00
Nikolai Kosjar
f452896308 Debugger: Remove DetailedErrorDelegate
Change-Id: I08cd9af5e11e705378a53075c7fade44fc3246ce
Reviewed-by: hjk <hjk@qt.io>
2018-05-22 06:26:23 +00:00
Nikolai Kosjar
73d908bf2b ClangTools: Disable fixits checkboxes for diagnostics without fixits
Change-Id: Ie65fad3acd2a84bbb7ecb40e05d3a43cf89be11f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-18 06:28:12 +00:00
Nikolai Kosjar
f083293c31 ClangTools: Adapt button state to checked fixits
"Apply Fixits" is disabled by default and enabled as soon as some fixits
are checked by the user.

Change-Id: I7e1345512b206f52d1e8628705c81c6b34dfb9ba
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-18 06:28:07 +00:00
Nikolai Kosjar
26b09af277 ClangTools: Allow applying fixits
Add a new column to the view that allows to check diagnostics with
fixits. The checked fixits can then be applied with the also new "Apply
Fixits" button in the toolbar.

Some corner cases are not yet handled:
 * File is open in editor
 * File changed in the mean time

Change-Id: I3d3f353a4150699a0d082f2a4348e331a4213bcf
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-16 07:10:39 +00:00
Nikolai Kosjar
887a0538cd CppTools: Allow filtering issues with line edit
...matching diagnostic text/description. Child items are excluded.

Change-Id: Ie7c50af59e0836f60b2ca3bbe50b11eb19398c61
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-15 13:29:53 +00:00
Nikolai Kosjar
a10cd337c7 ClangTools: Rename some classes and files
...to some more generic names since they are not anymore specific to the
clang static analyzer.

 * ClangStaticAnalyzerDiagnosticView --> DiagnosticView
 * ClangStaticAnalyzerDiagnosticFilterModel --> DiagnosticFilterModel
 * ClangStaticAnalyzerPreconfiguredSesssionTest -->
    PreconfiguredSessionTests
 * clangstaticanalyzerprojectsettingswidget.* -->
   clangtoolsdiagnosticwidget.*

Change-Id: Ifd34f207d31dc24d6a97654aca76ff27b5025547
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:20 +00:00
Nikolai Kosjar
de751e5b69 ClangTools: Move CSA's project settings into ClangToolsProjectSettings
Change-Id: I830c280e718aae416cd487eb5d02caf1e873f7c1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:02 +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
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