Commit Graph

2618 Commits

Author SHA1 Message Date
Christian Kandeler
ce3103194f CppTools: Fix code model with clang and precompiled headers
Amends a1d22fd2f7.

Fixes: QTCREATORBUG-22897
Change-Id: Iaadf72d78e11279c8dd553860e00be9d29135752
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-03-09 11:31:42 +00: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
aeef7137a2 CppTools: Work around a endl warning
And drop some foreach use.

Change-Id: I2ba4762cf6c5c8de7262a47044f65624d585e21a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-25 09:27:56 +00:00
Cristian Adam
b7bfcc3786 CppTools: Do not reindex all sources on project update
When CMake was run it would cause an update, which would have a
cancelAndWaitForFinished on the future interface.

The CppTools would have the future interface added on all updates, and
even though an indexing job would be finished, it would be picked up as
active and cancelled, which would be interpreted as action from the user
to cancel the indexing and cause a full reindex.

This patch makes sure that if an indexing job has finished, it doesn't
register as active, and only the jobs that actually do some work, and
will be finished will wait for the cancel signal.

Change-Id: If8a4db2a4a7a5707a360db84affe794ab0678d38
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-02-20 13:53:36 +00:00
Eike Ziller
d43f1662d0 Make TextEditor setup more flexible
So far it was only possible to combine TextEditorFactory, BaseTextEditor
and TextEditorWidget directly.
That TextEditorWidget is also directly a QPlainTextEdit made it
impossible to "decorate" the text editor widget with something else
without a lot of effort.

Make it possible to create a text editor factory that returns an
arbitrary widget, as long as it can be "cast" to a TextEditorWidget with
either qobject_cast or Aggregation::query. That way the TextEditorWidget
instance can be attached to the editor widget via Aggregation.

Adapt other code that accesses TextEditorWidget from editors
accordingly. Introduce a common method how to do that.

Change-Id: I72b8721f3a8a8d8281c39af75253e9c80cbe1250
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-02-12 10:28:31 +00:00
hjk
ede1d31a3f CppTools: Make CppCodeStyleSettingsPage a plugin pimpl member
Change-Id: I75f90ddbb3cb1f2dbded16c8b6eb6d6c9bbc9f50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-06 17:00:22 +00:00
hjk
7e326657e9 CppTools: Use a plugin pimpl data member for CppToolsSettings
Change-Id: I05c2f8f34b88973fc916115f71c0557675396366
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-06 16:27:52 +00:00
Christian Kandeler
cd9571b4f7 CppTools: Optionally move raw project parts creation into thread
... by letting callers pass in a generator function.
This takes some load off the UI thread for larger projects.
For now only used by the QbsProjectManager, which can provide a thread-
safe generator function due to the project data existing in "value"
form.

Task-number: QTCREATORBUG-18533
Change-Id: I525dea36a4c4079bd1bd5a4fff844617547d56f1
Reviewed-by: hjk <hjk@qt.io>
2020-02-06 15:53:46 +00:00
hjk
e3e6cece89 CppTools: Use a normal plugin pimpl member for CppModelManager
Change-Id: Id2c4b098084808070ef91de13c8338184e52141d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-06 12:24:21 +00:00
hjk
fd5461b93d CppTools: Use a normal plugin pimpl member for StringTable
Change-Id: I2804b623b7ec03f6f4375452c9a422604468aafa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-06 09:51:40 +00:00
hjk
582b0216c6 CppTools: Remove yet another flag initialization with nullptr
Change-Id: I35b1033f8b69b5564fcf86a6406c486be0e90bbf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-06 07:52:13 +00:00
hjk
ea6da69e8b CppTools: Move CppFilesSettingsPage closer to new setup
Including some drive-by cosmetics.

Change-Id: Id9cdba68545907b099a70944c83fe17ad3c0b2a0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-05 12:42:42 +00:00
Igor Sidorov
a9e40ad14c Add final specifies to classes
Warning -Wfinal-dtor-non-final-class in clang trunk

Change-Id: I2bf17064bf8898eab10b82b69583a283157766d0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-05 09:33:55 +00:00
hjk
36f23df6c3 CppTools: Use unshared object for CppCodeModelSettings
There's nothing shared here, only ever one copy. Ideally, this
should be const outside CppToolsPlugin, but some settings
are modified directly.

Change-Id: I775b9151a244b3cc44d28bc992a041c42d234a18
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-04 07:55:01 +00:00
Christian Kandeler
cc32cabd4f CppTools: Give early warning if kit has no compilers
We keep getting bug reports from users who forgot to set a compiler in
their kit and then get confused by (misleading) warnings from the code
model.
Improve the situation by detecting the condition that a C/C++ project's
current kit does not have a C/C++ compiler and showing a warning for
that in the issues pane.

Task-number: QTCREATORBUG-23247
Change-Id: I10164e85ad595f3a386340e7813d1f3e40fbecb5
Reviewed-by: hjk <hjk@qt.io>
2020-01-31 15:13:47 +00:00
hjk
c3f7ef5340 Several SettingsPages: Code cosmetics
De-Q_OBJECT-ify, remove unnecessary #includes, final-ize, etc.

Change-Id: I461d3e73400dacac90c22e7c84a40e3ea1718b6e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-30 15:04:58 +00:00
hjk
2c865a771c TextEditor: De-noise ICodeStylePreferences setup a bit
Change-Id: I6c3fcbb6ef17c7ca5771326b1444f057cc150e3d
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-01-29 06:30:48 +00:00
hjk
811f4a38da Use less nullptr for empty flags
Change-Id: Ic4eafdc8f204a432a752a97593380609a408a7de
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-21 13:28:26 +00:00
Alessandro Portale
8c6e6d1dbd Don't initialize QFlags unnecessarily
And if needed, do it with {} instead of with nullptr or 0.

Change-Id: Iae80253cd334494cfe1d69ec1552d710f2a31ad2
Reviewed-by: hjk <hjk@qt.io>
2020-01-21 10:07:22 +00:00
Alessandro Portale
24a25eed14 Use isEmpty() instead of count() or size()
Change-Id: I0a89d2808c6d041da0dc41ea5aea58e6e8759bb4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-20 20:56:57 +00:00
hjk
7e19d1af7c Use even less nullptr for default flags
Change-Id: I5ec30de3e41dfc1c7bf6d5f5e36991eadcbbfb72
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-20 10:09:23 +00:00
hjk
57c41edf54 CppTools: Apply new SettingsPage patterns
Change-Id: Id7410041d5813dc3df9aeb650074f961e394cd2d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-17 14:47:00 +00:00
hjk
d43b793dd8 Core: Introduce a IOptionsPage::setCategoryIconPath
Less noise on the user side.

Change-Id: I34dea09e8a3c8639f5a7db89b22f8b825b946395
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-16 09:53:45 +00:00
Nikolai Kosjar
1b4de8d769 ClangTools: Add help context menu entry
...that opens the documentation page for the current diagnostic.

Change-Id: I398fdc82bb118a80536acbb12420a9bac84e66c9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-13 14:33:55 +00:00
Christian Stenger
2f5365bf61 CppTools: Fix compile due to ambiguous namespace
Change-Id: Ie1bfac86253e5152f65ab8e8de720be3b1dde8ea
Reviewed-by: hjk <hjk@qt.io>
2020-01-09 10:31:02 +00:00
Eike Ziller
69bcf7ca60 Merge remote-tracking branch 'origin/4.11'
Change-Id: Ica0d173a08ff3f0296e875aa324d5bb6974bd90f
2020-01-08 07:13:32 +01:00
Christian Kandeler
c5473762ed Move ProjectExplorer::WarningFlags to a more suitable location
No need to waste a (badly named) header file on that one type.
Also fix typo in enum value.

Change-Id: I0cd4e3cda9383c3ab197ae6788666324a1dce43d
Reviewed-by: hjk <hjk@qt.io>
2020-01-07 14:27:01 +00:00
Jarek Kobus
f6659f24df Fix layout of the code style settings editor
Fixes: QTCREATORBUG-23227
Change-Id: I1ae650ba1e66c9444ef0d7fe17d003e5d6662b77
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-06 10:54:13 +00:00
Alessandro Portale
8a1daa15fa ClangTools: Use Utils::InfoLabel in ClangDiagnosticConfigsWidget
Task-number: QTCREATORBUG-23346
Change-Id: I39016adae451c5212643e412d5700b89915cb2e4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-03 12:28:32 +00:00
Eike Ziller
92546d0983 Merge remote-tracking branch 'origin/4.11'
Change-Id: I0657cee6b87eea7b3178548bebed85d5ac824519
2020-01-03 08:57:33 +01:00
Nikolai Kosjar
26693e8212 Revert "Clang: Stop enabling exceptions explicitly"
This reverts commit b114f77d8a as
"--driver-mode=cl" apparently still disables exceptions.

Task-number: QTCREATORBUG-23000
Change-Id: I9c49d971fafda5e1aca8445f8921e50f323d368f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-20 22:46:02 +00:00
Nikolai Kosjar
4fdd944617 Clang: Fix removing gcc internal include paths
Amends 5165c037eb.

Gentoo has the standard library headers installed in e.g.
<installdir>/include/g++-v8 and we excluded those. MinGW with the
standard library headers in <installdir>/include/c++ was whitelisted.

Instead of whitelistening more dirs that could contain standard library
headers, regard

  <installdir>/include
  <installdir>/include-fixed

as gcc internal include paths to remove. These seem to be stable across
distributions.

Task-number: QTCREATORBUG-23330
Change-Id: I44965d2030b4ea5a9dd269400faf19c3df89f5a6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-20 22:45:31 +00:00
Nikolai Kosjar
2de52cffb1 Clang: Fix c++98-compat warnings for MSVC toolchain
Clang invoked with --driver-mode=cl will map "-Wall" to "-Weverything",
thus enabling -Wc++98-compat-pedantic and way more options.

Fix this by escaping "-Wall" in the cl mode, effectively passing in
"/clang:-Wall" instead of "-Wall".

This fixes what 5675169e56 addressed also
for ClangTools.

Change-Id: Ideb7bab923d0359e8039b61e9d53c8765de79c29
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-12-19 12:04:56 +00:00
Nikolai Kosjar
548e798885 TextEditor: Fix typo in a TextDocumentLayout function
Change-Id: I17153d9bfe9820f3ccc88f54bce1d494a522be33
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-12-18 10:15:50 +00:00
hjk
e109b731ad Utils: Rename FilePathList to simply FilePaths
The exact storage type does not really matter here.

Change-Id: Iefec40f0f5909c8e7ba3415db4a11962694e1b38
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-18 08:43:18 +00:00
Eike Ziller
267946d100 Merge remote-tracking branch 'origin/4.11'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/boot2qt/qdbrunconfiguration.cpp
	src/plugins/boot2qt/qdbrunconfiguration.h
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
	src/plugins/qnx/qnxrunconfiguration.cpp
	src/plugins/remotelinux/remotelinuxrunconfiguration.h

Change-Id: I17c8e1bf300bb75d7317ccf7749dd3cc07709c21
2019-12-16 16:19:44 +01:00
Cristian Adam
5675169e56 CppTools: Suppress the c++98-compatibility warnings
Fixes: QTCREATORBUG-23118
Change-Id: I3c29faa05cb77841b22201dce01b341e565ca32d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-12-13 14:45:48 +00:00
Alessandro Portale
116451ba1b CppTools: Update clang-tidy documentation URL
8.0.0 -> 8.0.1

Change-Id: Ic58777d2e97711e12e208c1b2a709bb0a9279e41
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-12-11 05:48:50 +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
dcb35676df Clang: Clean up TidyMode/ClazyMode enumerators
Change-Id: Ie3ff0d629fd3c115df9c527e9ae8d7962fcfa156
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:23:38 +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
Nikolai Kosjar
0d7a30cdfe ClangTools: Query the tools for supported checks
...instead of hardcoding them for a particular version of
clang-tidy/clazy.

While at it, move also the tidy/clazy widgets to ClangTools as this
simplifies feeding data to them.

Reduce also the built-in configs to a single one using clang-tidy's and
clazy's default checks as they look very reasonable and saves us some
porting effort. Also, our previous built-in configs were just too
numerous.

Change-Id: Ib9297acb7810a940b86a23a8695530506a570394
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:23:13 +00:00
Nikolai Kosjar
3090e744c2 ClangTools: Polish ClangDiagnosticConfigsWidget
* Improve distinction between built-in and custom configs by introducing
  corresponding parent nodes
* Add button to rename a config
* Make closing the dialog apply the selected config.
* Adapt also the related ClangDiagnosticConfigsSelectionWidget showing a
  combo box of the diagnostic configs and a "Manage..." button: Remove
  the combo box and show the current config as the button text.

Change-Id: Ic015df37f2532f84bd7da6cd20bfce07799a97b8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-03 13:22:28 +00:00
Nikolai Kosjar
62791a61fc Clang: Improve tab names
Change-Id: I24f963cfdf6c7a10fcaef96cf622c156b421d2b4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-11-29 09:31:37 +00:00
Christian Stenger
ea88ded352 CppTools: Simplify compile fix
Partially reverts 3f53db12bb.

Change-Id: I7a291550306235430ad460cdba4e0343445aa0ba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-11-29 08:07:12 +00:00
Nikolai Kosjar
5e4f6a9bb3 Clang: Use toolchain macros for IAR toolchain
...or if requested with QTC_CLANG_USE_TOOLCHAIN_MACROS=1.

Change-Id: I6d2f35b69393a7039271cc651aa514cdb686522e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-11-28 15:26:33 +00:00
Christian Stenger
3f53db12bb CppTools: Fix compile
Change-Id: I08ceaa94d9f18b671cee23f226dcdd7db1da0429
Reviewed-by: hjk <hjk@qt.io>
2019-11-28 10:27:23 +00:00
Eike Ziller
6fc85b49fa Merge remote-tracking branch 'origin/4.11'
Conflicts:
	src/plugins/designer/codemodelhelpers.cpp

Change-Id: I78906f2fbbfd27d254589a272ebca423b0b80699
2019-11-28 08:24:10 +01:00
Nikolai Kosjar
818f2d0c5c CppTools: Fix race condition when opening projects for tests
The ClangTools plugin tests open a project and immediately trigger a
build afterwards. We checked whether CppModelManager got already data
from the project manager, but this alone was racy for the mentioned use
case as e.g. the QbsProjectManager might still be in parsing mode and
thus the build was not triggerable. Check for the parsing state, too.

While at it, simplify the code by using QTest::qWaitFor(), which also
takes care of posted events.

Change-Id: Id298695b2e67578def42275bac4ea31f4a39edf2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-22 06:50:42 +00:00
Eike Ziller
4e6142c932 Merge remote-tracking branch 'origin/4.11'
Conflicts:
	src/plugins/autotest/testresultspane.cpp
	src/plugins/cmakeprojectmanager/cmaketool.cpp

Change-Id: Iade695ac9cab8bf3e3a1abd6e2c71f4a19132ac0
2019-11-21 22:18:35 +02:00