Commit Graph

2571 Commits

Author SHA1 Message Date
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
Christian Stenger
09b358cf72 CppTools: Fix compile for gcc 5.3
Change-Id: I4b0da43dc835de1bc523a52be53da05e2237318c
Reviewed-by: hjk <hjk@qt.io>
2019-11-19 14:55:56 +00:00
hjk
0120e462b2 Partial compile fix for current Qt dev and/or Qt 6
This does not cover Utils::MapReduceOption with QVector, and code
that's not compiled on my machine.

Change-Id: Ib63923985c52b1bb74e5ec2068a2bb37469ac618
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-11-12 10:50:51 +00:00
Eike Ziller
177f14b115 TextEditor: Do not change the text format for tool tips
We should not force the tool tip text to HTML when help content is
available or when adding the F1 icon.
Instead add help content and F1 icon into the tool tip layout.

Change-Id: Ibe2d4fa2fb81bcda4e5aeb0d7d86dbf63fcf3ce6
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-11-06 09:43:20 +00:00
Cristian Adam
a1d22fd2f7 CppTools: Fix code model for Clang builds
If you build Qt Creator with CMake version 3.16, you will have
precompile headers which will break code model.

Change-Id: I679936faed39ecfedb9ebb5fb553449a9f5ea29d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-11-01 12:38:29 +00:00
Nikolai Kosjar
32fe77564e CppTools: Simplify
Change-Id: Id10cbcf541d8105265c531e63a64e2fd34e27379
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-01 09:53:45 +00:00
Nikolai Kosjar
90982bf2e2 Clang: Remove duplicated targets arguments
We always set the target explicitly (in a certain way), so exclude the
target arguments coming from the build system and the (possibly manually
specified) platform codegen flags of the toolchain.

Change-Id: I74bbec67f5960f05b50cf9c5aa11875c71a5161f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-22 11:46:56 +00:00
Nikolai Kosjar
8f6eb41cad Clang: Ensure that platform codegen flags get also filtered
Leave the function addExtraCodeModelFlags() around as it's used by
ClangPchManager::ProjectUpdater::toolChainArguments().

This allows us to filter out excess target arguments in a follow-up
change.

Change-Id: I742d713dd1ca6c391ba77c52555dcf4e94cc2ff9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-22 11:46:42 +00:00
Nikolai Kosjar
6156c59c62 Clang: Put clang's resource dir after /usr/local/include
...also on Linux.

That's what clang invoked from the command line does.

Change-Id: I59c48d11fab3b944bb42ca7bb4cd9093a735df60
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-11 13:08:28 +00:00
Nikolai Kosjar
85b45920fb Clang: Simplify regex patterns
...by removing pointless backslashes.

'/' is not meta character, therefore escaping it with a backslash is not
needed.

Change-Id: Ic0bd1f85b3eed721cad67f4b4d616352ea9e098a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-11 12:50:03 +00:00
Nikolai Kosjar
5165c037eb Clang: Avoid consuming gcc internal include paths
Given the (default) include paths of GCC, e.g.

 /usr/include/c++/7
 /usr/include/x86_64-linux-gnu/c++/7
 /usr/include/c++/7/backward
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include

discard gcc-internal paths like /usr/lib/gcc/x86_64-linux-gnu/7/include
as they are not relevant for clang and even confuse it with regard to
 #include_next.

Paths below the gcc install dir are considered as gcc-internal. The
install dir is queried with

  $ gcc -print-search-dirs

Some GCC distributions, like MinGW, ship the standard library headers in
the install dir. Ensure to not discard these.

Fixes: QTCREATORBUG-22898
Change-Id: Ia85258fb01b72ad073e71390e003fe8268e3b01f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-10-11 12:49:06 +00:00
Cristian Adam
93ec10754f CppTools: Make code model on "cl" mode more robust
Unknown command line options starting with / are now transformed
into commands starting with -, which will cause unknown commands
warnings in libclang.

The / commands cause errors because they are treated as missing
files.

Fixes: QTCREATORBUG-22871
Change-Id: I75f7878ab6a7951df24c954ccff1c298ea65f839
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-02 13:43:22 +00:00
Nikolai Kosjar
092bdbc0a1 Clang: Reduce built-in diagnostic configs
Change-Id: Ieb7c712916f0b3ddd08b04cccf97fc0fa1f828d4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-01 14:42:38 +00:00
Nikolai Kosjar
b895dfa382 Clang/ClangTools: Separate custom diagnostic configs
Add a separate pool of custom diagnostic configs for the
ClangTools plugin. That is, the diagnostic configs in

  Menu: Tools > C++ > Code Model

are not shared anymore with the configs at

  Menu: Tools > Analyzer > ClangTools

On plugin initialization of ClangTools, move tidy/clazy related configs
to ClangTools.

Change-Id: Id06087a58b53e466a3d7bbac669550c5fbe9899d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-01 14:10:28 +00:00
Cristian Adam
17270366f3 CppTools: Do not use PCH when build PCH artifacts exist closeby
Clang cannot handle gcc pch files which are close to the forced
include header.

Fixes: QTCREATORBUG-22888
Change-Id: I0d678a889d1fb62bf3c6850277e13271efb91eea
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-30 12:13:25 +00:00
Eike Ziller
b6c2277146 GenericProject: Make dependency on CppTools optional
Especially in the light of the language server, the generic project is
currently the project one can use for language servers that require a
"project workspace".

Makes it possibly to run Qt Creator with
"-noload CppTools" if you still want to use generic
projects with some other language.

Change-Id: Ib9059289a2db4c44c0c1060a02fcdafacb885fbd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-13 06:43:02 +00:00
Eike Ziller
8df0653bf8 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/projectexplorer/gcctoolchain.cpp
	src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp

Change-Id: Iffdf48e782a734107ea170ebb3812e997cea0e7b
2019-09-12 09:08:04 +02:00
Eike Ziller
545552cc13 QtSupport: Remove dependency on CppTools
It was only left for the C++ category for the Qt class generation
settings.

Change-Id: I22d3f198f7b825c4a36d08d4ee28091b9e5b1f43
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 06:37:55 +00:00
Eike Ziller
ed9177f74c CppTools: Move ProjectUpdateInfo to ProjectExplorer
Used for updating project parts, so move it near RawProjectPart.

Change-Id: I77aeffbdbfb3d2ec0de600f61dcf7fbb7a355a98
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 06:37:41 +00:00
Eike Ziller
9cc45fe1fb CppTools: Move RawProjectPart to ProjectExplorer
Doesn't have any dependencies into CppTools anymore, therefore moving it
reduces the dependencies of the project managers to CppTools as well.

Change-Id: Ibe728abe59eb88a8877943dca1f48a85163e27ac
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 06:22:12 +00:00
hjk
e9d8ff21b0 Remove unused QObject parent arguments on options pages
In the new plugin setup scheme they are data members of the
plugin pimpl and never use the parent.

Change-Id: I28fe150393e8159064dcfbd113ce0320af50fd58
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-11 06:03:40 +00:00
Andre Hartmann
d1b997474d CppLocatorFilter: Add highlighting auto-tests
Change-Id: Ibd5b8318040876b46bfb14561c69019abd8dd8b7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-10 09:09:05 +00:00
Andre Hartmann
92daed1f6c CppLocatorFilter: Fix highlighting in extra info column
Given the following example:

  typedef int value;
  void value_test(void) {}
  void test(value v) {}

searching for "value" findes both candidates; and
for the locator filters "m" and "." highlighting
already worked fine.

For the locator filter ":", however, the arguments
are displayed in the extraInfo column. To get proper
highlighting here, we have to repeat the regexp match
in this column.

While fixing that, make sure that full-qualified
searches (separated by "::") are still highlighted
properly.

For the Clang Code Model, there is still a bug not
addressed by this patch:

 Ctrl+K with ". value" -> "value" isn't highlighted yellow.

Change-Id: Idd5eeeedb893151cd5c7f70f6b11397db788b706
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-10 08:05:18 +00:00
Eike Ziller
8452264a18 CppTools: Move QtVersion and BuildTargetType
QtVersion to utils/cpplanguage_details.h which already contains similar
flags.

BuildTargetType to ProjectExplorer, next to BuildTargetInfo (but not in the
same header to not pull that in everywhere).

Removes dependency on ProjectPart from RawProjectPart.

Change-Id: I5791065e4266f20c2657ee4b1b594df04b238a1c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-10 07:31:21 +00:00
Eike Ziller
c7e3bbcd11 CppTools: Remove dependency of RawProjectPart to ProjectFile
The feature to category files to ProjectFiles was used by the qmake
project manager to specify if the file is "active", and by the Qbs
project manager to avoid unnecessary MIME type checking.

Make these two different use-cases explicit in the API.

Change-Id: Ia5a7da37f100149366fc75060fe04687e15f2bd3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-03 13:15:31 +00:00
Sona Kurazyan
8e31932c29 Remove usages of deprecated APIs of QLayout
Replaced:
  QLayout::setMargin() -> QLayout::setContentsMargins()
  QLayout::margin() -> QLayout::getContentsMargins()

Task-number: QTBUG-76491
Change-Id: If28ef6910b3afe5d04e4746b74f9362a3e3b3c8e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-02 13:01:07 +00:00
Marco Bubke
20a304c8e0 CppEditor: Reuse document for search results
Instead of open a document for every entry we do open it only once per
search. For that we sort the entries by file path, so that they are clustered
together and reuse the last document if the path hasn't changed. This can
improve the calculations of the search results drastically.

Change-Id: I9c9c1e387624297d84c6a2ca6edb6130f739d295
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-08-29 07:53:24 +00:00
Leander Schulten
75a065d3d1 DoxygenGenerator: Ignore Q_INVOKABLE in front of function declarations
Otherwise the doxygen generation will not work.

Fixes: QTCREATORBUG-12411
Change-Id: I3e887dfeb5caba727da6e56a056c092c5a2e23f9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-08-27 08:13:35 +00:00
Andre Hartmann
a1db400e65 CppLocatorFilterTest: De-noise
Change-Id: Ie7c8bdb55764a229b24a9acf68d1e93d82f5edef
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-08-25 19:18:57 +00:00
Tobias Hunger
0c062e5827 Locator: Do not consider generated files in the project-related searches
It is unlikely that a user will want to look at generated files --
and if she wants to, there is always file search.

Task-number: QTCREATORBUG-20176
Change-Id: Iefb0aece1dbd6b39aa8892388411c10162319102
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-22 10:34:55 +00:00
Andre Hartmann
3b41b9b24b Locator: Extract MatchLevel and use it in several filters
... that already used index-based prioritising.

There are a few more with two- or three-level priority,
but these still use the old scheme with multiple lists
good/better/bestEntries and converting them would not
gain much.

Change-Id: I21f7cfe07a3ae8183db9cb62311697d03db6e4da
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-15 09:57:46 +00:00
Eike Ziller
857b299356 VcsBase: Make dependency on CppTools optional
The VcsBaseSubmitEditor uses CppModelManager to collect the symbol names
from the affected files for completion in the commit message.

Move the C++ code model code into CppModelManager, register it in the
plugin manager, and call it via QObject means from the submit editor.

This avoids a hard dependency from VcsBase to CppTools.

Change-Id: I2fb34dbef153c1414820d711e7fc5596bcac1691
Reviewed-by: hjk <hjk@qt.io>
2019-08-15 06:27:29 +00:00
Andre Hartmann
56948e75d8 CppLocatorFilter: Simplify priority handling
Change-Id: I612e0cc5e56a50bd6830ae2f25291aaed571ae67
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-31 06:32:03 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00
hjk
7ab6783e24 Standardize on int for line and column values
Recently tons of warnings show up for presumably "problematic"
singned <-> unsigned and size conversions.

The Qt side uses 'int', and that's the biggest 'integration surface'
for us, so instead of establishing some internal boundary between
signed and unsigned areas, push that boundary out of creator core code,
and use 'int' everywhere.

Because it reduces friction further, also do it in libcplusplus.

Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-26 09:23:48 +00:00
hjk
2c0b69cdc5 Core: Use more of Utils::FilePath in locator filters
Change-Id: Ie550691861317f2af6f38170b5dfc6413af5954f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 07:18:17 +00:00
hjk
e23664cc42 TextEditor: Privatize BaseHoverHandler::decorateToolTip()
Never overridden, and does not look safe to invoke more than once.

Change-Id: If5f3830f3fbf26badb6335443defd628c05cf65a
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-07-24 06:50:34 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
Nikolai Kosjar
2778a5adab CppTools: Fix updating pending queue in CppLocatorData
Fix that the invocations

  CppLocatorData::onDocumentUpdated(Document{"bla.cpp", revision=5}),
  CppLocatorData::onDocumentUpdated(Document{"bla.cpp", revision=3}),

would add two entries in m_pendingDocuments. The document from the
latter invocation should be ignored due to its outdated revision.

Change-Id: I5e9eb4de77f59633d5525d808bd60ca1259f894d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-16 14:02:59 +00:00
Tim Jenssen
333b33edbe Merge remote-tracking branch 'origin/4.10'
Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
2019-07-12 15:53:56 +02:00
Christian Kandeler
f7520b7d99 Make the project managers tell the code model about include paths
... from the environment.

Fixes: QTCREATORBUG-17985
Change-Id: I9b54e550121cfcc0684a6e173337d59d235c6107
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-12 09:13:42 +00:00
Nikolai Kosjar
51cd2885ef CppTools: Allow enabling debugging of locator filter tests by environment
Change-Id: I9786b7c6959b77eebb1bc774d2e7bd4c8ed3edeb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-11 14:02:21 +00:00
Joel Smith
8c437362bc C++: Support single quote digit separator in integer literals
C++14 supports the use of single quotes inserted between integer digits
as a separator.  Updates the built-in C++ code model to recognize such
quotes.  This fixes highlighting and indentation issues.

Change-Id: Ic35ce93060b96700a11d108dce1f3cf6c4543632
Fixes: QTCREATORBUG-14939
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-09 08:59:23 +00:00
Nikolai Kosjar
69d8b7f739 Clang: Fix tidy checks
generateClangTidyChecks.py generated funny output as it was not
considering new major categories.

Fixes: QTCREATORBUG-22450
Change-Id: Ibd6d0cc7539c9fb846caacbe936770d0c960f04f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-09 06:54:23 +00:00
hjk
9703f2e948 CppTools: Avoid some deprecation warnings
Change-Id: I0726bbcf9fd3992312e5980bd176ce85903f27a9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-05 12:32:33 +00:00
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
hjk
6a58666f44 More Utils::toSet/toList
... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 12:28:38 +00:00
hjk
b9d6721be8 ProjectExplorer: Reduce ProjectExplorer::configureAsExampleProject()
... to the bits that are actually used.

Change-Id: I39a6ed1f4136d75b776bb89eec6165479097a4ec
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-01 10:05:19 +00:00