... to applicable analyzers.
Rather than inventing separate shortcut categories for all the
analyzers, we make use of the fact that only one analyzer view is active
at any given time, and make them use the same shortcuts for consistency.
Fixes: QTCREATORBUG-20659
Change-Id: Ifa60080def0e6b32395854cff588ab3af9ea33b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Usable nowadays since the action also opens the diagnostic location.
Change-Id: I24a0df606fec5d7e84a2f3450317864f62a4e118
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
The coreplugin/id.h header is kept for downstream for now.
Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Prefer source files from contexts where we know that they actually get
built and thus should have includes and compiler flags properly set up.
Also fix the qmake and qbs project managers to not mislabel any non-
application products as libraries.
Fixes: QTCREATORBUG-23394
Change-Id: I0d122c7b58e12d14d68a1ca7337df83074299cd7
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.
Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
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>
Adds a button for analyze file to all text editors that have a C++
source file open.
Task-number: QTCREATORBUG-23348
Change-Id: If08f2969304ee0817f00c9ee5ff8c0d4f96f7f72
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Address a nullptr dereference of m_runWorker in
ClangTool::updateForCurrentState() for the case described as (C2) below,
reproducible with "./qtcreator -test ClangTools".
Two use cases are connected to this:
(C1) Run the analyzer twice with clearing app output pane in-between
(C2) Run the analyzer twice without clearing app output pane in-between
Relevant observations in this context are:
(O1) Closing the app output pane destroys the RunControl/RunWorker.
(O2) Running the analyzer a second time will first create a new
RunControl/RunWorker, then destroy the old one.
Now, the change
ClangTools: Avoid accessing deleted run worker
This reverts commit d02f5664e5.
fixed a use-after-free-crash for (C1), but introduced a
nullptr-deref-crash for (C2) as it resets m_runWorker to nullptr on
RunControl destruction, which conflicts with the order mentioned in
(O2).
To fix both use cases, revert the mentioned change and access
m_runWorker only when we know that it exists for sure - right after
signal emission.
Change-Id: I034f0905d635b15c0c6bbe499648b62d5a058c04
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This enforces a linear pass through
[static] ProjectExplorerPlugin::updateRunActions
ProjectExplorerPluginPrivate::doUpdateRunAction
[emit] ProjectExplorerPluginPrivate::runActionsUpdated
instead of the previous direct emission of the signal from
user code and connecting also the internal update to it.
This is meant to simplify reasoning about execution order and
maybe to help elimimating double executation.
Change-Id: Id8cc41a46d9dec06afb5514855f2ae80560f3695
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
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>
...that opens the documentation page for the current diagnostic.
Change-Id: I398fdc82bb118a80536acbb12420a9bac84e66c9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
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>
Replace the filter line edit in the toolbar by a tool button that pop
ups a dialog. In the dialog, the available checkers can be
selectd/unselected to filter the diagnostic view. Also, the diagnostic
view can be limited to diagnostics with fixits so that these can be
selected and applied as the next step.
For convience, add also some context menu entries to modify the filter
with regard to the current diagnostic.
Change-Id: Ifba3028805840658d72a39516c2b02da9864d4a6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Avoid the following issues with the diagnostic view's header:
* Clicking on the header to reverse the sorting is somewhat pointless as
there is only one column.
* It takes vertical space.
* The checkbox to select/unselect all fixits for application is hacky,
not drawn nicely on Windows and macOS and its position is somewhat
problematic as on hover the dock widgets handles are popping up.
* To check the check box, one needs to click within the check box
rectangle, which is a pretty small area of the screen.
Instead, add a proper checkbox with a label to the toolbar (apparently
this needs some adaptions to our ManhattenStyle). By positioning it
before the "Apply Fixits" button, we can streamline the work flow.
Change-Id: I4ff40c3641487428feb1cd8305470dc5219d048c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
With the introduction of the "Analyze Current File" action the widget to
configure the diagnostic config was moved to the project panel (Project
mode > Project Settings > Clang Tools).
As not too many users are aware of the project settings there and
navigating there involves more user interation now (mode switch, looking
for the "Clang Tools" item), add a toolbar button as a shortcut.
Change-Id: I4c864045ef41ff501d925d3175ce604def213f29
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Disable the button when (re-)running an analysis.
* Ensure the button stays disabled when a file is saved.
Change-Id: I1140dd3938de554ea83d33c5bb490be3468d7db0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Allow filtering for open and edited documents.
Add also search functionality (triggerable by e.g. Ctrl+F).
Change-Id: Ib41400abfd3b81371afddd56b88ff1b9bf8b9bcd
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
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>
We can provide the run settings explicitly instead of writing to the
settings.
Change-Id: Ibb9ef0280c14315ff7ba72be75dfd04c50d84484
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
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>
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>
The tests expected diagnostics from source files only, but provided also
the ones from the header.
FAIL! : ClangTools::Internal::ClangToolsUnitTests::testProject(qt-widgets-app.qbs) Compared values are not the same
Actual (tool->diagnostics().count()): 4
Expected (expectedDiagCount) : 1
Loc: [/d1/creator/4.9/source/src/plugins/clangtools/clangtoolsunittests.cpp(133)]
FAIL! : ClangTools::Internal::ClangToolsUnitTests::testProject(qt-widgets-app.pro) Compared values are not the same
Actual (tool->diagnostics().count()): 4
Expected (expectedDiagCount) : 1
Loc: [/d1/creator/4.9/source/src/plugins/clangtools/clangtoolsunittests.cpp(133)]
Change-Id: I9270ba8cb554af3a3254e21d55656e73bcae71dd
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
...for the qmake project manager.
When parsing the project files, remember whether a file was discovered
by the exact or cumulative parse. Only files that were discovered by the
exact parse are considered "active" and thus part of the build
configuration. The others are not offered for selection.
Fixes: QTCREATORBUG-16016
Started-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I7a28b4de15e048975d7f0cd737dd8c11f744315b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
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>
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>
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>
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>
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>