Commit Graph

187 Commits

Author SHA1 Message Date
Marco Bubke
10f3621cf1 ClangRefactoring: Test for non existing client
This can be happen as we shutdown the process.

Change-Id: I69f30ed65ef4456abe6d59b4ea188a67c482efe0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 09:02:10 +00:00
Marco Bubke
2eb4050acb ClangRefactoring: Make the indexer more robust
We check now if the database is busy. This should not be happen but better
be careful.

Change-Id: I8b667ff183368977991974ea1fe7fcde837e968a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 08:59:16 +00:00
Marco Bubke
4526a02e31 ClangRefactoring: Add WAL checkpoint at the end of the symbol storage
Change-Id: I70fde54947a302ae0e45bff083cd5654c86b3891
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 08:59:04 +00:00
Orgad Shaneh
6e6dc32ad0 CMake: Fix build
This amends commit 376aae2711

Change-Id: I63e94c7e720f4f18fcf0f47b6e7af7e471c84df5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-07-08 18:28:58 +00:00
hjk
288ff9a854 ClangRefactor: Avoid warnings
... about unused code by removing it.

Change-Id: I827db7880d5fca8a736b34fa58608328645bf80f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-05 09:56:44 +00:00
Marco Bubke
8c95d44b17 Fix pri file
Change-Id: I277340dbec962e59f090d393967453d058a933a2
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-07-04 15:47:22 +00:00
Marco Bubke
376aae2711 Clang: Remove old code
We maybe bring back the clang query interface but the local rename is
better served by other plugins.

Change-Id: I97bedcb20870632b7dd50977794a65b2b09ededb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-04 08:41:10 +00:00
Marco Bubke
cc87615fcd Clang: Differentiate between user and non user includes for updating
We don't want to recreate a PCH if the include or source is not
contained by a PCH.

Change-Id: If52fc1aed92054b4165cdc634656147fbe8baa47
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-04 08:40:45 +00:00
Cristian Adam
b519dc541a CMake build: Fix building with CMake
Change-Id: Ib1ba9d286a029d20106d105b3db7fb34596badbd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-07-01 07:43:04 +00:00
Marco Bubke
e777ad57c5 Clang: Add reset to ModifiedTimeChecker
We can reset some file once to flag a file dirty if the included file has
changed.

Change-Id: I8763bb80f65882fba4e70057f569234e77097927
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-27 12:32:22 +00:00
Marco Bubke
e031ada154 Clang: Watch only PCH sources
We watched all sources but we do not want to watch the sources of the
project part because they are not used to build a PCH.

Change-Id: I700cd6077fc54230c9be94d620043cf3f10cf9ea
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-27 12:32:12 +00:00
Marco Bubke
cbfd9dc16b Clang: Update ModifiedTimeChecker in SymbolIndexer
If a watched file changed we should update the ModifiedTimeChecker too.

Change-Id: Ie43f5cf5b6dd4ddb1383168a1326add21f6e3e9d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-27 12:32:02 +00:00
Marco Bubke
bbd58ca30b Clang: Watch directories instead of files
Because there a limited resources to watch files we watch now directories.
So we need much less resources.

Change-Id: Iac558832e9521a7a1a67c5ea99b42ad1b0b5129c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-27 12:31:52 +00:00
Marco Bubke
98d7b502ca ClangRefactoring: Clear input files after collecting symbols
Change-Id: Ic4fbaac7ad3b3f80223d6cbb84a34dffa741fc4f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-26 12:21:24 +00:00
Eike Ziller
174b6f7e65 CMake build: Adapt to changes
Change-Id: Ia9cccd8068248ceacb2e4b1d4e182dc009d65497
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-18 09:41:18 +00:00
Cristian Adam
61fcdd0459 Clang build: Fix compilation with MSVC2017
Change-Id: I677614dc8f9de503131d8ac490a723c9fc5f7beb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-17 15:40:39 +00:00
Marco Bubke
300feced20 ClangRefactoring: Activate updating for indexing
Change-Id: I6fb818edfab8ef7d9cfab0520276acedf0597fd3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:50:00 +00:00
Marco Bubke
ee27ae2ef7 ClangRefactoring: Improve indexing
Fix some bugs in the indexing and use the new macro indexer from clang.

Change-Id: I2ba1b28097a8751aea942071851a60d164c6f371
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:49:49 +00:00
Marco Bubke
b213dee013 Clang: Improve updating
If project parts are up to date we send them directly to the indexer, so
the indexer can decide we something needs an update.

Change-Id: I7d4f32794c6b3a861cdefb3653a6dfd4e711f619
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:46:21 +00:00
Marco Bubke
912cb9278f ClangRefactoring: Ensure that database is written to log after indexing
Change-Id: Ic2473d9fe8dc9b41a7da728c9e1b5202524c1a79
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:46:12 +00:00
Marco Bubke
0251d610f1 Clang: Remove DelayedTemplateParsing settings
It will be use the default which should be provide less errors.

Change-Id: I2f5feefe574cbda6cd85f10620dfb75c46a0f7b7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-06-05 13:54:00 +00:00
Tobias Hunger
08025009a6 CMake: Add missing dependencies to clangrefactoringbackend related code
Change-Id: I4c7fa04309f24a5a5143a5e32f0b5200fdcde0b6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-03 09:43:16 +00:00
Tobias Hunger
d70d58b5cc CMake: Add Threads::Threads as public dependency to clangrefactoringbackend library
Change-Id: If7d3d4a7226f034d0e4c66726d3a7beed3480efe
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-03 09:27:51 +00:00
Cristian Adam
f50859e856 CMake build: Add unittest CMake build files
On MinGW 8.1 I get the following after running ctest -j 40

99% tests passed, 35 tests failed out of 2631

Change-Id: I2c3ce7940b036e52ef393feab5837886355e7b5a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-29 13:46:25 +00:00
Orgad Shaneh
1e138fbe10 Remove excess blank lines after namespace
Change-Id: I4e4f83017f2bfc2cf842c4c971ed4b05e0447e6a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-27 06:50:16 +00:00
Tobias Hunger
c1488bbc25 Clang: Sprinkle some overrides over the codebase
This silences several warnings.

Change-Id: I0a15ee833ea4c3de4e6adafb72e530a2c4577b09
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-05-13 10:34:29 +00:00
Orgad Shaneh
fffffad325 ClangRefactoring: Remove redundant std::move
Detected by GCC9.

Change-Id: I12b4de063a736d17fb6a7105d622812df1981a1a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-05-11 17:50:05 +00:00
Marco Bubke
24cadba480 ClangRefactoring: Fix indexing
We moved inside of loop so projectPart was used many times but was empty
after the first iteration.

Change-Id: Ie2441dbdd3bb9de73ae1fd076626255599f5dfea
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-29 12:52:13 +00:00
Marco Bubke
2d520140d0 Clang: Fix system pre include search path
We now get the resource path from creator. The -fPIC case is working now
too.

Change-Id: Id191e89e6d46706748d50440038a06a349972cc9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-29 12:52:05 +00:00
Marco Bubke
eaaff9da7e Clang: Reindex without PCHs if error are occurring
If an occurs we first reindex with the system PCH only and if it is still
occurring we are indexing without any PCH.

Task-number: QTCREATORBUG-22011
Change-Id: I815ee3abe7829aaeb191d985cd045bac35015893
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:09:06 +00:00
Marco Bubke
5a6a9343b5 ClangRefactoring: Move command line generation in worker thread
Because we want to retry to index without the PCH we need to move the
command line generation in the worker thread.

Change-Id: Ifd018be277081ee676e5fa51af9e6ee99bbc6724
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:08:57 +00:00
Marco Bubke
16d5bf0afc ClangRefactoring: Move transaction in fetchPrecompiledHeader
Prepare the move of fetchPrecompiledHeader in the lambda to execute it in
the thread.

Change-Id: I00f906196dabfdb5cd38f4b9752d92678236b849
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:08:50 +00:00
Marco Bubke
3fc8217113 Clang: Refactor fetchPrecompiledHeader
We don't need the other information any more.

Change-Id: Ie34a646df34e336591c124093a15e90307ac88ec
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:08:44 +00:00
Ivan Donchevskii
53c407bc0c Clang: Fix build with clang-8
Clang-Tidy checks and Clazy flags updated.
CLANG-UPGRADE-CHECK done.

Change-Id: I1ca585c5c3c77a7f183719df9c262603150914e8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-17 12:13:36 +00:00
Marco Bubke
56b01f7463 Clang: Minimize reindexing
We optimal indexer is only reindexing if the index would be changed. This
patch is a step in that direction. We only reindex now if the file or
project has changed. It fixes some typos too.

Task-number: QTCREATORBUG-21150
Change-Id: I6ea1c13282fbcd70253b9b2939aed37580dbd160
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-02 13:08:44 +00:00
Marco Bubke
7595c9f305 ClangPchManager: Handle non generated PCHs
Sometimes we start generation of PCHs but not finish it. In that case we
should redo it at the next start of the backend process. So we now
remove the old precompiled header if we add the task to the queue.
If we successfully generated the PCH it will be set again. But if we
did not it will be read from the database and set to false.

Task-number: QTCREATORBUG-22035
Change-Id: Id53c2b4e4f501fc5ef7830558085607baa6a49f1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-02 12:38:12 +00:00
Marco Bubke
6effa1822b Clang: Improve project part updating
The project part ids are now already created very early in the database.
This removes some checks because we can assume that an id already exists.
The project part are now completely persistent, so we can read them from
the database and compare them with new generated from a new creator
session. This should help to not recreate the same PCH again and again.

Task-number: QTCREATORBUG-21151
Change-Id: Iced818ff9f7431eaed3e37978087cc0a43b9afda
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-01 10:31:38 +00:00
Marco Bubke
1a63297d9b Clang: Improve dependency building
We want to use the cached values in the database because it is faster than
to parse the the files again.

Task-number: QTCREATORBUG-22035
Change-Id: I7ada7073887b1d89a06332fdb617701cb69ccd68
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-03-06 11:24:20 +00:00
Marco Bubke
2358415b58 Clang: Move fetchPrecompiledHeader to PrecompiledHeaderStorage
It went for historical reasons in the symbol storage.

Change-Id: If05edb868901884f3951d0eb2f152566e99b4d1a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-03-04 13:40:39 +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
2887f5e5a9 ClangPchManager: Allow errors in pch-s
There are cases when we can't avoid errors when we put all
system includes together. This might lead to not having any
pch-s which makes the indexing useless (too slow).

Change-Id: Icdbfdf916bbd0ed9b6cd18f9c976d3d4efb0e18f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-18 13:50:13 +00:00
Marco Bubke
80cdc99737 ClangRefactoring: Move clang options to BeginInvocation
Change-Id: If4e90aa8e27b961026912bef3f0e81f972fbe0c7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-14 10:09:27 +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
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
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
Ivan Donchevskii
4599d1ad4d Clang: Improve indexing performance on Windows
Do not use delayed template parsing (it's too slow).

Change-Id: I473c92394321920239fd90e6a37f0ce517f94e6a
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-06 12:04:19 +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
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
68bce815ac Clang: Ignore missing includes while indexing
Change-Id: I0319fbbbde132320c06cb8b04f7d31aed9c0e218
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-05 08:35:37 +00:00