Commit Graph

234 Commits

Author SHA1 Message Date
hjk
509f40825a ProjectExplorer: Pass device to ToolChain::autodetect
Currently unused, will be useful to detect toolchains in docker
containers.

Change-Id: I0fd7643969ab02c05839332a436147ffb242635d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-28 07:59:45 +00:00
Alessandro Portale
afc2fda8a9 ProjectExplorer: Use qAsConst w/ non-const Qt containers in range-loops
Change-Id: I6422b3e40a6925504a231be2d47b3214d86c6e06
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-17 11:19:21 +00:00
hjk
5d5a4ffbf8 ProjectExplorer: Provide a ToolChain::isValid() base implementation
It checks for an executable compilerCommand(). This was used in Gcc,
Clang and Nim before. MSVC still overrides with a different test.

The formerly unconditional 'return true' for Keil/IAR/Sdcc uses that
check now, too.

Change-Id: I433a5ac6784277dc77129b2671c28af6913327a7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-01-06 13:45:41 +00:00
hjk
c60c642fe5 ProjectExplorer: Consolidate *ToolChain::compilerCommand() implementations
All ToolChains had an compiler command member one way or the other, so have
one in the base class and drop all others.

ClangClToolChain is quirky insofar as it diverts the compilerCommand()
to the additional m_clangPath member. This is left for a later patch.

Change-Id: Ic8b5da17a4b7050966d0c37573edb0706fac2ecf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-13 11:25:25 +00:00
hjk
ba2262a870 ProjectExplorer: Consolidate *ToolChain::target() implementations
All ToolChains had an Abi member one way or the other, so have
one in the base class and drop all others.

Change-Id: Ic4ed47b77f51c2c53d5692c66e6103c6bb23277e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-11 15:40:34 +00:00
hjk
6baf09bf91 ProjectExplorer: Remove toolchain settings compatibility with <= 4.3
As data point: Ubuntu 18.04 has Qt Creator 4.5.

Change-Id: I2794197e511666b3931fb8efc2669a574e6f1ac9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-06 14:59:15 +00:00
Nikolai Kosjar
888ea6bbbb CppTools: Take "-include" files into account
Fixes: QTCREATORBUG-20602
Change-Id: Ibfc518fc64ed75f93265db800558ec1d2e424bb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-05 08:49:24 +00:00
hjk
d4c7dee48a ProjectExplorer: Use QList instead of QSet for language ids
There's no point in keeping ~2 items in a set and convert that
to a list every now and then.

Change-Id: I214b1049fb458e3d159478c47f55b97aacaac75a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-18 10:56:34 +00:00
Christian Kandeler
90a18fe7fa ProjectExplorer: Fix ToolChain::isAutoDetected()
Amends d116559cd8.

Fixes: QTCREATORBUG-24545
Change-Id: I3a6c198a6ef2db91c4c3eb75721657e0c491e665
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-09-09 08:30:17 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
hjk
2b7fab1668 ProjectExplorer: Promote CMakeToolChainData to a global structure
... and use it in ToolChainFactory::detectForImport() overloads.

Change-Id: I107b9d5e185580b8fbef4c6e0233fdae5d253506
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 10:34:58 +00:00
hjk
0715917414 ProjectExplorer: Rename one ToolChainFactory::autoDetect overload
... to detectForImport(). The overloads have different purposes,
sharing the name makes reasoning about them hard.

Change-Id: I57bfbbc1aa06ef85251e39c404bdbe5584a2ea41
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-02 13:03:31 +00:00
hjk
d56fa44964 ProjectExplorer: Use data member for ToolChain::typeDisplayName
Change-Id: Ia78ea3f8628b759706c5b024d687d917b203ec4d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-20 12:15:04 +00:00
hjk
bf83926372 ProjectExplorer: Add a central ToolChainFactory::createToolChain(type)
This is meant to be the only function directly creating tool chain
objects in the long run (and also the only one setting ids, removing
the need to spell them out in the individual constructors).

Change-Id: Idef242612a5a3f7012628b4080a03d6ee70e5ba0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-14 13:44:05 +00:00
Alessandro Portale
a38c3ac08e Remove ToolChain::suggestedDebugger()
And inline it in AndroidConfigurations, which is the only place that
made use of suggestedDebugger()

Change-Id: I87f135b5d115adb7e46b0f009c5853221e9a3daa
Reviewed-by: hjk <hjk@qt.io>
2019-06-12 12:54:43 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
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>
2019-05-28 12:23:26 +00:00
hjk
cc877949ca ProjectExplorer: (Re-)start using strings for mkspecs
Even if this is part of a directory name it is naturally closer to a
"string" id than a file path.

Change-Id: If66f930526744379ce86e2b18bd9eac7fabfe773
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 11:12:00 +00:00
hjk
2b1c8aa877 ProjectExplorer: Introduce a alias for QList<Tasks>
Change-Id: I91391ad22b420926b0f512cac23cfe009048b218
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 05:51:40 +00:00
hjk
2ac89cba92 ProjectExplorer: Use an alias for QList<Abi>
Change-Id: I69231c5974620ae30296bfc4e0ab41c900d95a3c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-27 09:35:53 +00:00
hjk
2226c1b87b ProjectExplorer: Use ToolChainFactories to clone ToolChains
Centrally.

Change-Id: Ie832c5ad0eb282192440d9d4d058d082d9513cc2
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-16 10:38:25 +00:00
hjk
b997214abb ProjectExplorer: Use a member for ToolChainFactory::canCreate
... in all but one case (ClangCL, which is special).

Change-Id: I6429f2f37b18524c29b6be78801ea0e5517cad4c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-13 14:55:15 +00:00
hjk
728010a705 ProjectExplorer: Use functor for ToolChain creation in ToolChainFactory
Change-Id: I935eecab2f16618a2a5b34d31a79672db82c3398
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-13 12:13:21 +00:00
Christian Kandeler
175018abe7 ProjectExplorer: Remove Toolchain::AutoDetectionFromSettings
It's unclear why auto-detected toolchains should be treated differently
after a restart of Qt Creator.

Change-Id: I0ba3787adccfb070ce0b36135e8fe94d6e4e4628
Reviewed-by: hjk <hjk@qt.io>
2019-05-13 11:42:13 +00:00
hjk
d116559cd8 ProjectExplorer: Drop Detection argument from ToolChain constructor
This was used wildly inconsistently. Use a setter instead in
circumstances where the context is reasonably clear.

The assumption is that this will always be done at some time in all
code paths.

Use a new 'Uninitialized' value to avoid triggering the first update.

Change-Id: I82c38cb9da3ccdbd8fbae8beefcbfa0e559ff794
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-10 14:38:45 +00:00
hjk
a421ff2265 ProjectExplorer: Remove ToolChain::canClone()
Was returning true in all cases.

Change-Id: Iafbafbf44a0b631b83e768c75f963e1bb7821a25
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-05-10 05:55:17 +00:00
hjk
3ec78efb58 ProjectExplorer: Simplify ToolChainFactory::create() signature
Change-Id: I9d579898387609fa7374f43633711a978bb36d93
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-09 15:12:54 +00:00
hjk
881b59c36e ProjectExplorer: Replace ToolChainFactory::supportedLanguange
... by a member-based approach.

Change-Id: I5c7fef196df6c37fd26c60a58c774426eca562a0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-09 14:43:23 +00:00
hjk
78fd99f5d3 ProjectExplorer: Replace ToolChainFactory::canRestore
... by a member-based check.

Change-Id: Id7d19e488695e76ea17cf2d02c7b6eb2cd0246cc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-09 14:36:41 +00:00
hjk
a659cbc680 ProjectExplorer: Consolidate macro and header path cache handling
All except Nim and the test tool chain were referencing the cache,
so move it to the base.

This removes also toolChainUpdated() overloads, including the
MsvcToolChain one that missed to call the base implementation
and the ClangClToolChain one that worked around that.

Change-Id: I8a99734aa3c697c635809a3648673a10ca14a2d8
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-05-09 13:08:47 +00:00
Ivan Donchevskii
ce0b671d0a ProjectExplorer: Fix Clang toolchain setup on Windows
Clang toolchain in gcc mode requires mingw sysroot and target
in order to be used properly on Windows.
Requires Qt >= 5.12 to work properly (it has the required mkspec).

Change-Id: I4e5a734c699ac98740c0d50560aa7b69751ae58c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-21 11:51:30 +00:00
Marco Bubke
5dbaf387ba Utils: Move C++ language details from ProjectExplorer to Utils
We want to use them in the backend processes too so it's nice to share them
in Utils. A concrete size was added too because they should be serialized.

Change-Id: Id5eb8f46643d5159f034fc9559f68a08d7e5847a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-15 10:37:03 +00:00
Nikolai Kosjar
dd5c6c73d0 ToolChain: QTC_CHECK() conversion of __cplusplus macro
Change-Id: I80a6cc4ea9a7dcb10614638f534259e02ed4c10e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-27 07:34:33 +00:00
Marco Bubke
77b5907c57 Don't remove __cplusplus
For the indexing we need all tool chain macros. Originally it was a fix
because the C++ version of the project part and __cplusplus could be
different but now they should be the same. They will be now removed in the
compiler options builder.

Change-Id: I7ae8721a29632473e76ecedb411a6c9001e5e199
Task-number: QTCREATORBUG-21265
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-10 12:25:30 +00:00
Nikolai Kosjar
04caf7594e ProjectExplorer: Use intervals for detecting language version
...to fix running into unknown __cplusplus values from compilers with
incomplete language support.

This amends

    Toolchains: Detect unspecified language version
    commit 5900766ecb

Change-Id: I88cca71ae66cc5d49b644e88658aaa5806862fba
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-10 06:49:30 +00:00
Nikolai Kosjar
6aa11eb75e CppTools/ProjectExplorer: Remove enum duplication
... between CppTools::ProjectPart and ProjectExplorer::ToolChain.

Change-Id: I8b448747e454adbed77547460383b8515462cc81
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 12:34:57 +00:00
Nikolai Kosjar
5900766ecb Toolchains: Detect unspecified language version
We checked the command line from the project manager for "-std=X" and
friends to figure out the language version to use. However, if such a
flag was not provided, we assumed the latest version we support. This
could conflict with the actual version of the compiler and its
predefined macros.

Figure out the version by inspecting __cplusplus/__STDC_VERSION__ in the
predefined macros of the toolchain. The MSVC compiler is an exception to
this, as it does not seem to properly set the value - check for
_MSVC_LANG if possible, otherwise simply assume some versions as before.

While at it, add also support for C17/C18 and the upcoming C++2a.

Task-number: QTCREATORBUG-20884
Task-number: QTCREATORBUG-21188
Change-Id: I464ffcd52d2120c0208275a050e82efda44fae1c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 09:07:56 +00:00
Tobias Hunger
80c2ce118d ProjectExplorer: Modernize even more
Use unique_ptr for all *Private classes, except for those
in singletons.

Change-Id: Ib56c31ddedc6e9cf321f15de1f1e697a27ad4089
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-07-24 09:04:54 +00:00
Alessandro Portale
8d19333075 ProjectExplorer: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
modernize-use-transparent-functors

Change-Id: Iebed22caa2e733d292f334e956e3d16b844e14e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-16 10:01:53 +00:00
hjk
cc88302309 De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per
"interesting" type.

Current situation:
  - The global object pool does not scale well for looking up
    objects, as iteration plus qobject_cast typically iterates
    over all pooled objects.
  - User code that can use typed results from the object
    pool need to have access to the full type definition anyway,
    i.e.  depend on the plugin of the target class anyway.

The patch here solves the scaling problem is to have local
type-specific pools to which objects register in their
constructors and deregister in their destructors.

This patch here does *not* change the ownership model of the
pooled objects, however, it opens the possibility to change
the ownership model per type (e.g. by not putting things into
the global pool at all anymore and make the local pool 'owning')
and the intent is to handle that in later patchs.

Even without the follow-up patches this here is a performance
improvement for the cases that access the local pools instead
the global one, i.e. "practically all".

Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-12-15 07:08:05 +00:00
Orgad Shaneh
1e1253b5a7 ProjectExplorer: Fix language for previously auto-detected toolchains
Change-Id: I02138a07d45a2169b9d667a56fc88e3f11db942a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-05-29 11:03:03 +00:00
Tobias Hunger
6f0a31166d ToolChains: Write compatibility information for QtC 4.2
This avoids turning all toolchains into C++ when going from Qt Creator 4.3
to Qt Creator 4.2 and back.

Change-Id: I607606f76d958c634ab27cb6db3bf35a1236b2b6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-03-14 15:56:03 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +00:00
Tobias Hunger
578af1e701 ProjectExplorer: Enable factories to autodetect a specific toolchain
This is necessary to auto-detect the toolchain e.g. found in an existing
cmake or qbs build directory.

Change-Id: I1405d1337855d55fa0145e8b50a5864ff0d4231b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-09 09:53:39 +00:00
Tobias Hunger
5d53289f12 ProjectExplorer: Simplify Language Ids
Language ids are exposed via the MacroExpander to the user. So remove the
prefix and only leave the bare essential (C and Cxx), so that
%{Compiler::Executable:Cxx} continues to work.

Add code to transition kits and toolchains to the new Ids.

Change-Id: I012e5fd405b09032418c90d2517aede21cfa1b47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2017-01-24 16:11:14 +00:00
Filippo Cucchetto
4b1f8f3609 ProjectExplorer: Added support for registering custom languages
Change-Id: I728a2ed1ef7d9f44d7c2b59d27d6e23444cd3bb5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-23 11:19:11 +00:00
Orgad Shaneh
1d6d799d22 ToolChain: Compare also by language
Otherwise C/C++ with the same ABI are detected as duplicates.

Change-Id: I99090b4cc776047b1ecb958242d0b4f5ecec5f0a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-31 08:52:36 +00:00
Orgad Shaneh
c01d7a7540 Merge remote-tracking branch 'origin/4.1'
Change-Id: Ieaddc6093d10c08a54acb9b57cbbfe022bc3c038
2016-09-22 11:01:16 +03:00
Vikas Pachdha
1b7ea8437d iOS: Fixes false warnings about iOS kit and Qt version
iOS Qt version complains about missing compilers and the corresponding kit
complains about unsupported device

Task-number: QTCREATORBUG-16472
Change-Id: Ie2185e33ec5043de0230a325b48b21dc1a25109e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-09-21 08:25:34 +00:00
Tobias Hunger
ebfdac357c ToolChain: Change languageId for C++
"C++" might end up clashing with Orgad's work to make variable substitution
more powerful. Use a pure-ASCII-string name (Cxx) instead.

No conversion code since the impact can't be big so far, considering how
new the code is.

Change-Id: Iab1c91cd89d6c11dfaad80472a312e619abb6d97
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 09:17:14 +00:00
Jochen Becher
dfda517a1e Kits: Fix compilation error
Change-Id: I63089089bd59c5ce594ff6268075e3bb52caeb43
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 08:46:08 +00:00