Commit Graph

22 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
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
Jarek Kobus
1d67bf597f DocumentClangToolRunner: Remove no-op call to disconnect
A call to disconnect() prior to object destruction is no-op.

Change-Id: I719d84d5fde43038c80bd2fc164ffe5e0aab1fec
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-20 07:52:48 +00:00
Jarek Kobus
f1ff0a90e0 DocumentClangToolRunner: Delete later the old runner on runNext()
Don't delete the old ClangToolRunner directly from its signal
handler when calling runNext().

Change-Id: I55e72c1cced9ecbce492d00896d6fa161df02fd0
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-17 10:17:55 +00:00
hjk
d76458a8b6 Utils: Replace Environment::size() check by some isValid() function
More descriptive, and later implementable without full expansion.

Change-Id: Ic3b17ea0b07273f292827a7b63e7695b4bd1cf23
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-03 09:42:26 +00:00
hjk
99c37ab7b7 ProjectExplorer: Remove RunControl::buildType()
Apparently unused.

Change-Id: I3aac506750735a465d787efeb9ea6a6de6e2c6a1
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-30 12:41:13 +00:00
Cristian Adam
60fca0596a ClangTools: Add header files to the list of files to be analyzed
Now that the CMakeProjectManager is reporting the header files as
source files, it makes sense to analyze the headers as source files.

Note that the header type needs to change to source type since the
"cxx-header" argument that will be send if the Kind is CxxHeader is
handled by the compiler as an argument to produce a precompiled
header, which is not what we want.

Fixes: QTCREATORBUG-21452
Fixes: QTCREATORBUG-25644
Fixes: QTCREATORBUG-25782
Change-Id: Icd674962ff8312b8fbfa46491938eb721edd761d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-10-04 16:43:53 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00
Christian Kandeler
a952500e90 CppTools: Use only const pointers for ProjectInfo and ProjectPart
All members were already const, but this makes it clear at all points of
use that these data structures are immutable.

Change-Id: Iea615c090bde462c445d15223caccc561b0c713d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-27 10:53:54 +00:00
hjk
09ae643153 ClangTools/CppTools: Code cosmetics
Mostly namespaces.

Change-Id: Ife8bbcb128344cf56d444da8f9d76b1204b9fe34
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 14:13:03 +00:00
hjk
f29bc8c787 ClangTools: Proliferate use of FilePath
Change-Id: I3eb16546a729ab01c10e37572adac9aef83f5cd4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 11:43:30 +00:00
Christian Kandeler
33108795d6 CppTools: Turn some classes into pure value types
ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers
to Project and/or Toolchain, even though they were used in contexts
where these pointers were either unsafe to access or not guaranteed to
be valid anymore, which made their use difficult and error-prone.
We turn these classes into pure value types by copying in all relevant
information before the first async operation takes place.

Fixes: QTCREATORBUG-25678
Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-13 12:35:49 +00:00
David Schulz
0cfe27a53d Debugger: filepathify DiagnosticLocation
Change-Id: Ibbbf137231b313ec10e3d57c0230217b0c1e0a6c
Reviewed-by: hjk <hjk@qt.io>
2021-06-09 06:57:42 +00:00
Alessandro Portale
e4f260d544 ClangTools: Use qAsConst with non-const Qt containers in range-loops
Change-Id: Id9df0a27c4bcba57ee76574e32ca53cb6c28a43d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-17 11:19:15 +00:00
David Schulz
be3677c02e ClangTools: Avoid assert when no tool executable is configured
The assert is in ClangToolRunner::run.

Change-Id: I195db04631548e6b7ae9d5360827933889433b9d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-01-07 05:31:55 +00:00
David Schulz
786c131beb ClangTools: compare file names host os case sensitive
Change-Id: I31b889ca5e722bd565bde9b742e24da39151e8bc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-26 08:02:16 +00:00
David Schulz
b40dcf6d29 ClangTools: Fix crash in document tool runner
Prevent removing refactor markers from already destroyed widgets.

Fixes: QTCREATORBUG-24982
Change-Id: Icf8950f8f8407fa8733a1ef30d05abb4a2b44dd4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-26 07:58:53 +00:00
David Schulz
d7ab6210af ClangTools: Do not show text marks for suppressed diagnostics
Do not generate marks for automatic runs
and hide them for the explicitly invoked analyzes.

Change-Id: Ic48e7b13c424c51e7e1759c588c94bbd45e6d1bb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-27 08:50:09 +00:00
David Schulz
ef10f3b937 ClangTools: Add QuickFixes to the editor
Change-Id: I9862231f0aa8e8274e8529e57e80eac5ececded9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-09-04 10:14:39 +00:00
David Schulz
7bbbdeac52 ClangTools: use VFSoverlay if the clang tool supports it
check the help output of a clang tool whether virtual file
system overlay is supported. Prepares for the vfso support
of clazy-standalone.

Change-Id: I157c94de1dda41c83945c9bc8a4c2e132b2e6551
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-04 09:48:44 +00:00
David Schulz
472cae1823 ClangTools: Fix soft assert when no clang tool can be detected
When no clang include dir or version can be detected the runner
does not contain a valid executable so skip that runner.

Change-Id: Ia1b664b65ac4a9d80042d77dfb5b8842ec06dcea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-08-28 09:16:34 +00:00
David Schulz
e176958da1 ClangTools: Add automatic clang tool runner for open documents
Fixes: QTCREATORBUG-23349
Change-Id: I81197180c9d69c7df6184f8fcbf05f2256eaf7f6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-08-28 07:20:32 +00:00