Commit Graph

708 Commits

Author SHA1 Message Date
Marco Bubke
f009dad9ef ClangPchManager: Show extra progress for dependency building
Task-number: QTCREATORBUG-21956
Change-Id: Id244c9ef9fc7825489daa143b21fcca78164d8c7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-22 12:09:09 +00:00
Marco Bubke
8c781f7e6a Clang: Fix progress bar
Sometimes the messages are not send immediately, so we force it.

Task-number: QTCREATORBUG-21957
Change-Id: I9526cb4b4e3dd8b7a02e15f77bffdc51917d47c8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-22 12:09:00 +00:00
Nikolai Kosjar
61775a844e Clang: Build clangformat only if clang/Format/Format.h exists
...in the LLVM_INSTALL_DIR.

Change-Id: I974f32759bca7fb467524bf61ff7967098748f0e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-21 09:10:03 +00:00
Nikolai Kosjar
56584b1dde Clang: Fix unit test build without QTC_ENABLE_CLANG_LIBTOOLING
Change-Id: Ifa6588d1427489e8ae98ea8093d5d94049c270ee
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-20 13:20:56 +00:00
Ivan Donchevskii
2c6bda5950 ClangRefactoring: Map unsaved files with non-native paths in ClangTool
Otherwise the ClangTool complains that it does not see them.

Change-Id: Ib616058584f8f95229213224cec98fa6b6f7522b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-20 13:20:31 +00:00
Ivan Donchevskii
d3ceb9ce62 Unit-tests: Fix the debug build with MSVC
Change-Id: I99fd6db6406b088cab0538b07cd20ca1427a5f71
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-19 15:22:04 +00:00
Nikolai Kosjar
0f8612f20f Clang: Move unexported classes to Internal
Change-Id: I3ea197b734f146d4b11431aaf927aed9be7d8756
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-19 14:09:43 +00:00
Ivan Donchevskii
be65a57935 ClangFormat: Fix unit-tests
Amends dcf763c7ee.
Change the logic in empty lines modification to properly
indent all empty lines.

Change-Id: Id945cf66915dfd192216660543594a7905426761
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-19 12:47:22 +00:00
Ivan Donchevskii
29492ecf24 ClangPchManager: Do not build pch and index inactive project parts
Some project parts should not be built as well as some files
can be inactive inside project part.
We should not try to build pch-s or index them.

Change-Id: I8e62365b817a424ae38a0df94b6703820a4cde9d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-19 07:34:19 +00:00
Ivan Donchevskii
7f461b2e22 ClangFormat: Clean up some code and and few unit-tests
Check the context related stuff and remove the restriction
to format after the stream operator.

Change-Id: Iaa2d32c9bffe7a0eeb7e8ade39f109b529e1eab0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-19 07:33:20 +00:00
Ivan Donchevskii
9bcc871ece ClangFormat: Format multiple text ranges at once
'reformat' function in LibFormat accepts mutilple ranges.
Let's provide the ranges for the same file together when
formatting on save and formatting after fix-its.

Change-Id: I27789da83a1efc27beb57acf238508a191562bb9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-19 07:33:13 +00:00
Marco Bubke
337155a648 CppTools: Add project directory filter to HeaderPathFilter
For the indexer we want to filter every not builtin include search path to
as system include search path which is not inside of the project or build
directory.

Change-Id: I33663a1f3eb53ec39d5b16a8ca64b57d1b57bd9c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-18 14:30:02 +00:00
Marco Bubke
35c9e65d3e Clang: Disable min and max macros
Change-Id: I75f930053ca514dbd32366c628e7e4916ba8550a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-18 12:42:00 +00:00
Marco Bubke
2bd0c7c276 ClangPchManager: Don't watch generated files
Task-number: QTCREATORBUG-21983
Change-Id: I80af39278140c48c8740c83af85596d3ee9bf2da
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-18 12:41:40 +00:00
Marco Bubke
3154002fb6 ClangPchManager: Fix PchTaskMerger
We forgot to remove the duplicates for used macros.

Task-number: QTCREATORBUG-21955
Change-Id: I051b8199ba5dd0a173d80c9e526bf745d3bcd777
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-18 12:41:28 +00:00
Marco Bubke
716a96a55b ClangPchManager: Add dependency building to progress counter
Task-number: QTCREATORBUG-21950
Change-Id: I409b03d53b374c5bf66ba6c7c9e50e98a7b239c4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-18 12:40:58 +00:00
Ivan Donchevskii
29758d8364 ClangFormat: Add missing .clang-format file for tests
Change-Id: Ia15b4d7c4546be2375807b1d59b5e3d65b06ab4f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-18 12:26:50 +00:00
Marco Bubke
a33bce9e91 Clang: Fix command line builder
Add "-nostdinc++" only for C++.

Change-Id: I21228fca80045b040877328f41ca0edb4f227fcc
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-14 10:09:38 +00:00
Christian Stenger
5e1167facd Tests: Fix contradicting declarations
Change-Id: I684bad06ff0f1dbc6375da96457135d6f7287120
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-13 13:58:40 +00:00
Marco Bubke
44d5e10185 ClangRefactoring: Fix progress counter
We use threads now and the code had to be adapted.

Task-number: QTCREATORBUG-21950
Change-Id: Ie96c5bea1fa045588d0c5a8b18bfd1ccb5d9fdd9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-12 14:02:12 +00:00
Marco Bubke
97ec6b9ad2 ClangRefactoring: Don't update the database if something went wrong
We can get an compile error. In that case we should not update the
database. In the future we should have a mechanism to report about the
database state.

Task-number: QTCREATORBUG-21949
Change-Id: I203346d536b007171f7bf255047409431c44a85a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-12 14:02:02 +00:00
Marco Bubke
c52c531c3f UnitTests: Move symbolscollector data to sub directory
Change-Id: Id1a123f745a0f092aeff9589aa146feb49d31661
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-12 14:01:50 +00:00
Marco Bubke
ffa043fb99 Clang: Improve performance by reducing parsing
We generate one big file per project part so the preprocessor is skipping
the recurring includes.

This generated many errors about missing macros but we don't care
much about them during dependency collection step so we just
silence these errors with ignoring diagnostics consumer.

Change-Id: I5581d623b5d5f9995496252735577ea6b54790d9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-11 15:23:26 +00:00
Ivan Donchevskii
7fe65851d9 Clang: Extend ClangTool and CommandLineBuilder
We now support source file and not only header files and the file path is
now automatically added to the end. This removes quite some clutter.

Change-Id: I74eabd262e6c7e5f4d523e3a3cd194bd3efe1ef3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-11 15:22:58 +00:00
Ivan Donchevskii
dd778bcb23 Clang: Use full paths in compilation database for symbol collector
We we FilePath and NativeFilePath so that compiler warns us if we mix them
up.

Change-Id: I33d7abc7e4e724dff2a9b2b9b23deea8b358ccfd
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-07 15:03:39 +00:00
Marco Bubke
4da11c355f ClangPchManager: Don't generate a PCH header file any more
We used an extra process to generate the PCH but now we use clang tooling
so we can utilize the in memory file system.

Task-number: QTCREATORBUG-21933
Change-Id: I1c1d39248e9513c87269d854c35d38b373b0f515
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-07 12:51:00 +00:00
Ivan Donchevskii
7d64c9e3ec Clang: Fix some issues with running indexer over Qt Creator
- fix qDebug channels on Windows
 - fix the number of perameters in the sql statement
 - fix nullptr access
 - speed up preprocessor a little bit

Change-Id: Ic9b32fbcc6b409c4064c4f522b94391cbff8654e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-07 07:45:24 +00:00
Eike Ziller
f369556dca Merge remote-tracking branch 'origin/master' into 4.9
Change-Id: I0768e59f13f2fae0bdf13047431de9fac870bf74
2019-02-07 07:43:26 +01:00
Nikolai Kosjar
b9d3055e72 Clang: Allow to forward warnings flags from build system
Change-Id: I47ebb1ce4f3b5544408eb1d0f891ed5090394282
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-05 11:36:55 +00:00
Marco Bubke
0082a82fc6 ClangPchManager: Merge system pch tasks
The merging of the include search paths is quite heuristic but we could
provide an option to disable pch merging so users can decide themselves.
Maybe we could give user feedback why we cannot merge but this is quite
advanced.

Task-number: QTCREATORBUG-21381
Change-Id: Iac6af0c587b631d2151f63d6d97215ed6919819f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-05 11:07:14 +00:00
Marco Bubke
14a44948d8 ClangPchManager: Fix deferred project parts
Change-Id: Ie760c0dd269c643a147d7edf3f1b812cd27fe4c4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-05 10:16:47 +00:00
Marco Bubke
cd868e8a7b Clang: Fix crash on exit
There were threads running but the instances they called were already
deleted. Now we delete the scheduler first which is the thread holder and
which is waiting that all threads are finished.

Task-number: QTCREATORBUG-21882
Change-Id: I2e9f4d8381d79fab9a93346cef6598ab8e8f7850
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-05 10:16:14 +00:00
Ivan Donchevskii
536b733f29 ClangFormat: Format more code while typing
With the extra option "Format while typing" checked try to format
text before the current position without breaking the current input.
To accomplish that we make proper choices which replacements to apply.

The advantage of this change is to decrease the need to manually
format code which is just written.

Some minor bugs are fixed during the testing of this change.

Change-Id: Ibed569042e6c46a881e7a83b1882cf2bb23b3626
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-05 08:36:06 +00:00
Marco Bubke
1c77d7e1a7 ClangPchManager: Update ClangPathWatcher after PCH creation
If the PCH creation was successful we want to watch the PCH to update the
PCH.

Task-number: QTCREATORBUG-21800
Change-Id: Ic84901bde23f60ce2f4e2781ddd1e4f895354ab1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-28 11:19:50 +00:00
Marco Bubke
197f2b5f2a ClangSupport: Fix CommandLineBuilder
Forgot to add macros.

Change-Id: I4a5ab969a6b99c110b3ffd9e8f2b59560ccfc8b9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-24 12:54:09 +00:00
Marco Bubke
df8653dda9 PchManager: Fix generated file handling in PchCreator
Task-number: QTCREATORBUG-21843
Change-Id: I0517b87725117b7db7db14d32b737a0a6f2b3c35
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-24 12:48:02 +00:00
Marco Bubke
693c896e5a PchManager: Use Generated Files in BuildDependencyCollector
Task-number: QTCREATORBUG-21843
Change-Id: I33c29d50943a914313a4c2e577b0210460f663d8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-24 12:47:30 +00:00
Marco Bubke
a179030a02 ClangRefactoring: Adapt project part in the database
Extend ProjectPartArtefact and use CommandLineBuilder everywhere.

Task-number: QTCREATORBUG-21842
Change-Id: Ibc78849bc543512eccec8a558a1c3f57fec33fa2
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-24 12:10:27 +00:00
Ivan Donchevskii
020d1aab0a ClangFormat: Add unit-tests
Test reported cases from bugreports.

Change-Id: I9aeb42dc476cbfe98abb837f2e941d8e2685235a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-24 08:35:51 +00:00
Marco Bubke
4ee5d68b33 PchManager: Update only after generated files have been updated
Task-number: QTCREATORBUG-21843
Change-Id: I881e86dac4074438880d657a07f2e473489ab42d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-23 13:10:20 +00:00
Marco Bubke
36edaf9380 PchManager: Ensure that the build dependency collector is cleared
Change-Id: I7c09117673e34a88f4711a99d8e89406683246f2
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-23 13:10:03 +00:00
Ivan Donchevskii
093673e9cf Clang: Fix how tweaked header paths work
We need to provide built-in includes only when we use tweaked headers.
Also let's require Clang resource directory because it has to be
placed on the specific position inside the built-in header paths.

Change-Id: Id581238660c680725201de759216cf33f69f6cc7
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-23 12:04:40 +00:00
Ivan Donchevskii
d7058e1afe ClangFormat: Refactor indenter to allow ClangFormat unit-tests
We do not build texteditor files in unit-tests so some tricks
were required to make ClangFormatIndenter available.

First simple unit-test proofs it builds and runs.

Change-Id: I81d5ea099bd27fd1c1ed8b5b7877299dcc62a67f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-22 09:52:15 +00:00
Marco Bubke
dd366b68de PchManager: Split pch tasks in project and system pch tasks
Like you can see in the task numbers this patch is touching many different
areas. So I will only touch the main parts. It is using a clang action
instead of an extra process which will be enabling the handling of
generated files in PCHs. The flags from the project part are now not
anymore transformed in a command line but they are saved in the container
semantically aware so that they can later be merged. Most of this patch is
simply polishing of other patches.

Task-number: QTCREATORBUG-21346
Task-number: QTCREATORBUG-21380
Task-number: QTCREATORBUG-21382
Task-number: QTCREATORBUG-21383
Task-number: QTCREATORBUG-21693
Task-number: QTCREATORBUG-21778
Change-Id: I9b0c02d8149b554254e819448fbc61eeaa5b7494
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-21 15:27:10 +00:00
Ivan Donchevskii
ca24877c93 Clang: Improve anonymous cursors support
With the recent libclang fix the anonymous cursors
are reported properly. So we can use that information
instead of some of our workarounds.

Change-Id: I94401f33e671e6dd08ac7d850c8d5c3dbdd062cc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-18 09:09:58 +00:00
Ivan Donchevskii
0679c2ff25 Clang: Never use toolchain defines
The known cases provide enough flags not to require
toolchain defines.

Change-Id: Ia7e08a90eca6ea9474db40683ac1e63236f8643d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-16 12:18:55 +00:00
Ivan Donchevskii
0348009e0e Clang: Support MSVC style of compiler flags
Clang has MSVC compatible mode which works with MSVC style command line
flags.

When possible use the same flags (-I, -D, -U, etc.) and in other cases
either replace by MSVC analog (for example use /FI instead of -include)
or pass the argument with '/clang:' prefix (requires
https://reviews.llvm.org/D53457).

Change-Id: I95f33bed5dc8d9493895ed8d4359cdd70fc774b8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-16 12:17:31 +00:00
Nikolai Kosjar
4c0c3f5a64 Clang: Forward compiler options for gcc/clang
Rely on clang to do the "right thing" with them.

Change-Id: I44adf2cd5c61549896da3fc9b7c35c2fb0142060
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-16 11:47:29 +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
7109e8f050 Clang: Minor cleanups in CompilerOptionsBuilder
Change-Id: Iaf5af70136bceed52d19622c01d9d7147e5abeea
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-11 07:20:52 +00:00