Commit Graph

10 Commits

Author SHA1 Message Date
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Christian Kandeler
7dc2c6b3b3 ClangCodeModel: Rename via LSP facilities
Contrary to our original expectation, clangd's textDocument/rename does
not necessarily yield the same locations as /references. Instead, it can
find fewer or more occurrences, depending on server-side logic about what
constitutes a reference vs what should be renamed. Therefore, we need to
use /rename for proper behavior.

Fixes: QTCREATORBUG-27978
Fixes: QTCREATORBUG-28109
Change-Id: I27d092e807a4aa59dc0674111429c77ca13010e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-06 11:09:57 +00:00
Jarek Kobus
95e54055ef Clang: Limit the usage of qMakePair and std::make_pair
Change-Id: Ida094760023047ecb8ba29e60d5e81f766981b65
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-04 08:45:28 +00:00
Christian Kandeler
a522215840 CppEditor: Move renameFilesForSymbol() to ProjectExplorer
We'd like to use it outside of CppEditor in the future.

Change-Id: Ie7553a17aa1d86fb898eaa315a1613ac0ff6b452
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-22 07:09:38 +00:00
Christian Kandeler
d696f3380c ClangCodeModel: Add missing check in ClangdFindLocalReferences
When trying to find out whether a symbol refers to a local variable, we
first look up its definition. Afterwards, we need to check whether that
definition is located in the same file. This was forgotten, which lead to
seemingly random weirdness when trying to rename non-local symbols.

Change-Id: I505675a784fc69dc4f01105033608116fc7720c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-21 07:44:32 +00:00
Christian Kandeler
42121845cb ClangCodeModel: Add missing notification after symbol renaming
Task-number: QTCREATORBUG-26521
Change-Id: I3f3e25f4c28bc454f66bbd730e172833be8f87e4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-14 07:44:25 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Christian Kandeler
364208d202 ClangCodeModel: Move finding local references to a dedicated class
Change-Id: I5be08b58f4481df462f0ec664687a2c9f141f8b6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 11:44:19 +00:00
Christian Kandeler
2b8ac45071 ClangCodeModel: Move "find references" into its own class
Change-Id: If4dc9f7cb56b7f2e03e3d4622e616fb8486ddc92
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-02 11:48:22 +00:00