Commit Graph

2649 Commits

Author SHA1 Message Date
Christian Kandeler
b9413bcec7 Cpp: Fix leaks in ClangCodeModel tests
Change-Id: I19d4dc445d82fd24361f1eb752d9f35ccadd3efb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-19 11:19:42 +00:00
Christian Kandeler
a0764603d0 CppTools: Also look up definitions for variables
... not just functions.
This includes global variables and static members.

Fixes: QTCREATORBUG-18828
Change-Id: Iee9f83a4f955a859c6fc4038c61997b30afdaec8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-18 12:02:00 +00:00
hjk
1c81a3b3e8 All: Use Utils::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 05:55:25 +00:00
Christian Stenger
6e798401a0 Fix plugin unit tests when using projects
The ClangTools and the AutoTest plugins use an internal
mechanism to load and configure a project when performing
their integrated unit tests.
Both assumed to have exactly one kit present for these
tests.
Make it possible to have more kits present when starting
with existing settings or if more kits get automatically
generated when starting with clean settings.

Change-Id: If2bc66320c4854f1d34a19d17107e8f0b7d64d39
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-06-17 04:13:30 +00:00
Christian Kandeler
8a697cde64 Fix Qt 5.15 deprecation warnings for QString::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: I03ee6811df4346754bbd652f2c3c97477f9cdb7e
Reviewed-by: hjk <hjk@qt.io>
2020-06-16 16:00:22 +00:00
hjk
328c0cf809 CppTool: Avoid a use of QStringRef
Change-Id: I2a82bad7d91e059915526f0cf7b89f0d8367463a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-06-16 11:57:07 +00:00
hjk
361b80cb9b ExtensionSystem: Remove PluginSpec::isHiddenByDefault
Not used anymore.

Change-Id: Ic73ba3024b9e6157ff044cb23450fc9dad3c4c02
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-16 09:08:36 +00:00
Christian Kandeler
48be20cf48 Fix clang warnings about copies in range-for constructs
Change-Id: If50553964483626e72a816b1d23fa81b45ed9ca7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-06-15 12:38:17 +00:00
Alessandro Portale
0be309bcf1 Various places: performance-for-range-copy
Change-Id: I475990d32a5211d31a77782667a2dfedba134137
Reviewed-by: hjk <hjk@qt.io>
2020-06-15 05:58:46 +00:00
Christian Kandeler
02f2841a41 CppTools: Fix formatting for new-style function declaration
Fixes: QTCREATORBUG-23502
Change-Id: Ie80fe9aa77ffbf0b9ecc531841e78f2bd80de37e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 07:21:39 +00:00
Eike Ziller
aa2aa9bf2a Merge remote-tracking branch 'origin/4.12'
Change-Id: Id1c063ae716c3acf5e6201c15663637040aa9a35
2020-06-03 12:22:18 +02:00
Christian Kandeler
c5ce38f046 CppTools: Add missing serialization
... for ClangDiagnosticConfig::useBuildSystemWarnings().

Fixes: QTCREATORBUG-24084
Change-Id: Id06cc44f1aa690ea0ae5a808a3b8c95f83c62950
Reviewed-by: Nikolai Kosjar <pinaceae.pinus@gmail.com>
2020-05-29 14:46:58 +00:00
Volodymyr Zibarov
9ee693ee22 C++: fix built-in code model to work with shared_ptr on MSVC 2017
These changes target Find Usages feature to work with shared_ptr.
Improve libs/3rdparty/cplusplus and plugins/cplusplus:
parse __declspec() attribute,
call to variadic function template without specified template arguments,
if constexpr,
c++11 attributes [[value]],
function templates with default parameters,
resolve order for function vs template with default parameter,
template operator->() with default arguments,
template specialization with numeric values,
find best partial specialization,
fix partial specialization for non-first specialized argument

Fixes: QTCREATORBUG-7866
Fixes: QTCREATORBUG-20781
Fixes: QTCREATORBUG-22857
Fixes: QTCREATORBUG-17825
Change-Id: I31a080f7729edfb2ee9650f1aff48daeba5a673b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Nikolai Kosjar <pinaceae.pinus@gmail.com>
2020-05-29 12:39:28 +00:00
Nikolai Kosjar
9dafc323b5 CppTools/ClangTools: Fix saving diagnostic configs for code model
As ClangDiagnosticConfig() has tidy and clazy enabled by default now,
the ClangTools' importDiagnosticConfigsFromCodeModel() takes diagnostic
configs on start up away from CppCodeModelSettings.

Ensure that built-in configs do not have tidy/clazy enabled by default.
Also, when importing, look at the actually enabled checks.

Fixes: QTCREATORBUG-23717
Change-Id: Id8370ae2fff2392fc94aa957fd33c1954aff5594
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-28 09:20:06 +00:00
Christian Kandeler
949bb0e67b ClangCodeModel: Show value in tool tips, if possible
When hovering over a constant expression, it's probably helpful
to show that value to the user.
Requires clang 11 to fully work. For now, it only shows the value for
variable initializations.

Fixes: QTCREATORBUG-23967
Change-Id: I6b844231bac50993c2fa2fa82c552ad9cef590df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-26 08:50:58 +00:00
Eike Ziller
227904d4a6 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ic39945a0e3e140a9467b4b4f572929257ff3a324
2020-05-26 09:00:05 +02:00
Christian Kandeler
4ecb87f2f9 C++: Do not mis-align function arguments that are initializer lists
Fixes: QTCREATORBUG-24035
Change-Id: I93598ff64fc6fd74008c942b8755da5e481c63c7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-25 09:22:30 +00:00
Christian Kandeler
d4c31cef74 C++: Fix wrong formatting
... when using a shift operator inside an initializer list.

Fixes: QTCREATORBUG-16977
Change-Id: I8992162c05345b713c665e3601ae593af5007211
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-25 08:54:47 +00:00
hjk
036e8611eb CppTools: Fix license file path persistence
Broke with ea6da69e8.

Fixes: QTCREATORBUG-24024
Change-Id: If097c4bc824c1a6b6c005bcf32aef09229804be2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-22 08:49:44 +00:00
David Schulz
309702d945 Find: Add additional replace widget setter
Allows adding arbitrary widgets in front of the replace button

Change-Id: I0a9a16ca1e06c217639f458dd7946db8a43f98b1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-05-19 09:16:27 +00:00
Eike Ziller
20ef5c6de3 Merge remote-tracking branch 'origin/4.12'
Change-Id: Ibbf9f16677a58bdcdd3ce63701ffa34db6f44916
2020-05-11 11:36:22 +02:00
Eike Ziller
fe1d758943 CppTools: Fix crash when loading pre 4.11 settings
If pre 4.11 settings are present, this might lead to updated settings
being written at startup.
The code that writes settings indirectly uses the CppToolsPluginPrivate
instance via the "d" member of CppToolsPlugin. So this code path crashes
if triggered in the constructor of CppToolsPluginPrivate, since at that
point "d" cannot be assigned yet. Separate construction and
initialization to avoid this.

Fixes: QTCREATORBUG-23916
Change-Id: I0cb8a08bd9aa051679b71b06f569c44d2faab5a8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-06 12:44:10 +00:00
Eike Ziller
e9661e43cb Merge remote-tracking branch 'origin/4.12'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp

Change-Id: If6963d1ef7b5a1ea6343f68c8e7ce6fb5f482f21
2020-04-28 15:48:36 +02:00
Leander Schulten
794f3a5f55 DoxygenGenerator: Ignore attributes in declarations
Otherwise the doxygen generation will not work.

Change-Id: I07889d84c179ec0ad931d9790f9270ebbd6d259d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-04-28 09:41:49 +00:00
hjk
68c539bb9d Utils: Replace FileChooser::path() by filePath().toString()
Keep the old method for now to ease downstream porting.

The change is kept mechanical, there's a lot of cleanup possible now
on the user code side.

Change-Id: I936baedd45b7ba057f1c789a1bec896886f48eff
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-04-09 17:45:06 +00:00
Federico Guerinoni
3b995f7623 Remove export for class as TODO
Change-Id: I6ffe7b291a63d4f191528185505b02da6c0c9901
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-30 07:13:39 +00:00
Eike Ziller
c8a2ea5433 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp

Change-Id: I2a0ccb84560174c5170d5baaff526c0e095f0ba0
2020-03-19 09:35:50 +01:00
Leena Miettinen
dd91e8e062 CppTools: Fix UI text according to the guidelines
https://doc.qt.io/qtcreator-extending/qtcreator-ui-text.html

Task-number: QTCREATORBUG-23683
Change-Id: I35a1782f62514dfb6ea7e1e3cf334c8a5615fd74
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-16 08:28:53 +00:00
Eike Ziller
95d41fa23e Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/qmldesigner/designmodewidget.cpp

Change-Id: I94a94a15df433d6caa8922fccaa69918b5e4e365
2020-03-11 07:29:47 +01:00
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
Eike Ziller
995ba78fae Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/cmakeprojectmanager/tealeafreader.cpp
	src/plugins/cmakeprojectmanager/tealeafreader.h
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: I88d85be3903f57a55fddb7901e771a4822db1b85
2020-03-04 08:15:50 +01: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
Christian Kandeler
bcc2b5e08d "New Class" wizard: Try to find a base class header
If the project has a header file whose name suggests that it might
declare the base class, then add an include statement for it.
While we cannot guarantee that the include statement is resolvable as-
is, it's at least a basis for the user to adapt accordingly, while
without any include statement the class will definitely not compile.

Fixes: QTCREATORBUG-3855
Change-Id: I55ec43d58a9a13b9b59a5bbe6415a457b974b654
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-27 13:28:23 +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