Commit Graph

32 Commits

Author SHA1 Message Date
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
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
c639964f92 ClangTools: Add expand/collapse button
Change-Id: I0981aeb4dad001eb561a4e83201ab21f3510b3e5
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-29 10:18:13 +00:00
Nikolai Kosjar
3f31dc6cef ClangTools: Simplify/clarify labels in toolbar
Change-Id: I64b8fdb4484bf920944d86ad01675dbda516d6c4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-29 09:15:12 +00:00
Nikolai Kosjar
954d9f85f8 ClangTools: Make diagnostic view sortable
Fixes: QTCREATORBUG-20660
Change-Id: I57ed5c4071d7db8143e9e1e31d8b86a4d59d33ff
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-25 14:32:27 +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
171f3aec26 ClangTools: Clean up
Remove pointless classes and members.

Change-Id: I0f65934191c9db8b273aff85b70d45d510413cdb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-25 14:31:54 +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
Tim Jenssen
a78e3e5dd5 use initializer lists
Change-Id: I82b04601f1db52197b3dc625b6b7e0f143c1c8b6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-21 15:10:54 +00:00
Ivan Donchevskii
97d3858720 ClangTools: Apply indention/formatting after fix-its
Fix-its do not follow the current formatting style therefore
apply indention/formatting by using indenter.

This change will work best when ClangFormat plugin is
enabled to not only reindent line but also format it.

Task-number: QTCREATORBUG-21448
Change-Id: I8bcafcf49f3118aff7840326547e7a24052469b2
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-21 08:04:56 +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
hjk
32d2a4c985 Shift perspective ownership to plugins
Change-Id: Id146ca771b4dc92f35cf156efbabae154f2d940f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-08-21 15:38:22 +00:00
hjk
3b5ecac238 Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.

The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.

Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.

Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.

The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.

There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.

The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.

There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.

Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-08-17 12:35:15 +00:00
hjk
1567679b81 Debugger: Tighten Perspective interface
Pass id in constructor, so it can be const.

Change-Id: Id33fe19c4416109af8aa05a3ed0a09918eeb5cdf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-13 08:42:52 +00:00
hjk
f45f1a8cef Debugger: Make perspective toolbar items part of the perspective
This simplifies the toolbar setup and removes the need for the
stack of toolbar widgets.

The actions themselves have been owned by the plugin already,
so nothing changed in this respect.

Change-Id: I44754e16c8fc2acc53633dd9d560b1e732eece27
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-06 11:12:44 +00:00
hjk
e9eb1a6437 Debugger/Perspectives: Go back to QPointer<QObject>
Lifetime of the pointed-to object may end before that of
the plugin, so unique_ptr is the wrong choice.

This amends 01f2b982a2.

Change-Id: I76b9ac78348d2ae1e7eff0693b091dbe8475ab93
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-02 08:56:20 +00:00
hjk
01f2b982a2 Debugger: Move ownership of perspective dock widgets to plugins
Similar to the previous patch, but affecting more plugins: with dynamic
perspectives lifetime is better managed close to the code that knows how
to (re-)construct the items.

Change-Id: I0e7bfcf769d198ec2afa88b972be900baa1b6a46
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-01 11:27:21 +00:00
Ivan Donchevskii
be3e848c0f Clang: Don't analyze same file multiple times
Diagnostics do not depend much on project parts. But
having the same file twice can result in duplicated
diagnostics which later can cause the same fix-it
being applied twice and getting corrupted code.

Change-Id: Ie2809af7a54034b05df9383875f7c3123aea58e8
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-28 12:50:34 +00:00
Ivan Donchevskii
e99d09f846 Clang: Properly apply fix-its from header files
Diagnostic may also include fix-its for the header
which require different handling.

Task-number: QTCREATORBUG-20517
Change-Id: I3e745622801be3fa2856d968b0c7a2a2aeb89b50
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-28 09:11:49 +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
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
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
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
Nikolai Kosjar
5b5ff37b6f ClangTools: Add next/back buttons also for tidy/clazy
...copy/pasted from the static analyzer tool, which will vanish soon.

Change-Id: I33b6fb8519f9b84d0af3b5ca12c33d66d510c6bb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:27 +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
92ea3c93af ClangTools: Allow suppressing diagnostics for tidy/clazy
...copy/pasted from the static analyzer tool, which will vanish soon.

Change-Id: Ibbdd402b66af35b268896eff420bd1c6597d9ced
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:10 +00:00
Nikolai Kosjar
1bc605d050 ClangTools: Prompt for files to analyze
If the run button is clicked, the user is prompted to select the files
for analysis.

Change-Id: I21e4ee6b7c14392a8c1a901ac7aa1c9c16e30f0d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 10:48:53 +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