Commit Graph

71 Commits

Author SHA1 Message Date
Marco Bubke
7785a3a651 Sqlite: Move result count to class declaration
It move the magic number of column results to the sql statement
and improves the mock a little bit.

Change-Id: I101067444cf27ec5dea0c72de7fd484a7e8710f0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-26 12:24:37 +00:00
Marco Bubke
c174eb378a Clang: Reduce database accesses
If we prefetch data from the database to the caches we reduce the database
transaction calls which are quite expensive.

Change-Id: I617a0d886807402e0a94291a913a77f989970b55
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:53:32 +00:00
Marco Bubke
1e703a6901 ClangRefactoring: Remove file status collection
It is not needed anymore. If we need it again we can reintroduce it.

Change-Id: If8897ddb404daaf52b249ddd3763deb685c35fe5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:49:31 +00:00
Marco Bubke
cdda564946 Clang: Set indexing time stamp by dependent sources
Instead of using the time stamp from clang we simply set one time stamp
for all dependent sources.

Change-Id: I0adbe59d46c88ddd1ac491a7f7db568bcf2ac540
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:48:54 +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
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
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
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
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
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
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
Marco Bubke
3bd653416a Clang: Add global preincludes search path
Some header like windows.h adds dangerous defines which are not used but
break the indexing like "small". We now preinclude them and undefine the
dangerous the defines. This can be used for speed up the indexing as we
could provide stripped headers.

Change-Id: I2a89a4719ada7591e0e7a1ecc411b2e0ffd40d9a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:08:25 +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
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
e7fd132d47 Clang: Disable warnings in CommandLineBuilder
Change-Id: I7597d57a0bb97facefb08c9c1bbe6e909c146080
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-03-06 11:24:45 +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
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
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
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
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
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
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
Marco Bubke
ce9f503691 ClangPchManager: Add UsedMacroFilter
The compiler macros are filtered in system and project macros. Not used
ones are removed. The original order of the macros is retained.

Task-number: QTCREATORBUG-21548
Change-Id: Ic9265866bde033e6a9600f9e6439b1697ab73422
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-03 12:51:25 +00:00
Orgad Shaneh
5170dd0858 Merge remote-tracking branch 'origin/4.8'
Change-Id: Ia8bf92c8effdee0e1085730cb975ff88c8ad85fc
2018-11-20 19:13:13 +02:00
Marco Bubke
64a3a130ac Clang: Add BuildDependencyCollector
IncludeCollector is renamed to BuildDependencyCollector. It is now
returning a BuildDependency instead of individual getter. The test coverage
is improved too.

Task-number: QTCREATORBUG-21379
Change-Id: Ifc2d1c40c85772cf498c21968de526f4408b6023
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-20 14:24:03 +00:00
Eike Ziller
3666e3aaeb Merge remote-tracking branch 'origin/4.8'
Conflicts:
	tests/unit/unittest/unittest.pro

Change-Id: I4f0ab05f96ee60900a3a35fad4c7331238367593
2018-11-09 13:30:40 +01:00
Marco Bubke
9b1e7e440a Clang: Add BuildDependenciesStorage
Task-number: QTCREATORBUG-21378
Change-Id: Ibcb90239d240653b21f12a7b96a7775e5b0b4319
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 14:34:02 +00:00
Marco Bubke
6eb620238b Clang: Refactor FilePathId
We don't need the directory id any more. It's not used widely any way.

Task-number: QTCREATORBUG-21443
Change-Id: Ia95ea4c72fe9530ac56262f61f17faca04d313ba
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 12:51:15 +00:00
Eike Ziller
95db30bd3a Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/debugger/debuggeritem.cpp
	tests/unit/unittest/unittest.pro

Change-Id: Id2e4e9c2bc87b2556d7c2845aea3fe2fa11b630b
2018-10-22 09:53:54 +02:00
Marco Bubke
2c885fa3d4 Clang: Split symbol storage
We need UsedMacros and source related statements in the PCH manager too,
so we have to split that class.

Task-number: QTCREATORBUG-21289
Change-Id: Ie27d4b518b3d6d9174e93fcb243fdb55a09ddf51
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-16 08:57:00 +00:00
Marco Bubke
391cfab5d7 Clang: Add progress bars for creating PCHs and indexing
Task-number: QTCREATORBUG-21112
Change-Id: Ie0c00a58f479a2fe7cbc7322490808509733ff0f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 08:20:22 +00:00
Marco Bubke
4e6d09d8e1 Clang: Reuse thread based pipeline for pch creation
The pch creation so far used signal and slots but there was no explicit
pipeline. This patch is introducing the same architecture like the
refactoring plugin. It is filtering out older project parts from the
pipeline.

Change-Id: Iaa6bd2ca1272231b97ebe1f5f7b2ce8e43bc590c
Task-number: QTCREATORBUG-21111
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-24 14:33:05 +00:00
Marco Bubke
0aced361bf Clang: Cleanup symbol indexer
Change-Id: I1a7bcc807bf222ae0d8f622bca512c47489bfb79
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-12 10:34:46 +00:00
Marco Bubke
2a30f0e5d6 Clang: Improve generated files handling
Generated files are referenced by the system collector directly to set the
unsaved files.

Change-Id: I24be3ee544b7824b8b0e518eafd409f32bd002ab
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-06 11:26:00 +00:00
Marco Bubke
a86867eb8a Clang: Introduce parallel indexing
Change-Id: I522cb18e6d24b7dbed5d5dfa3a732e5b3b5113bb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-03 12:13:10 +00:00
Marco Bubke
4b0bcbdcb6 Clang: Locator filter for the symbol database
There are no symbol queries for the locator filters. The signature
generation is still not implemented but for simple cases it should work.

Change-Id: Ic6b04fbe1e7e057892f194ac139615c47d6ec33f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-12 13:12:24 +00:00
hjk
cf4dbb4bb6 ClangSupport: Use simpler structures in some cases
The patch is mostly mechanical, but contains also a few spurious changes
from values references for some local variables, foreach -> ranged for
etc that I coulnd't resist.

Change-Id: I58f0bd972546895eb318607cbfbd7ac35caf3f23
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-06 12:55:23 +00:00
Marco Bubke
de4f6301e6 Clang: Process SymbolKind and SymbolTags with the indexer
We add the infrastructure to compute the SymbolKind and SymbolTags in the
indexer. Later we have to add more for templates, virtual functions etc..

Change-Id: I9203c5cfbfffed3065337292010de5fce5736453
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-27 14:45:58 +00:00
Marco Bubke
53454b0f79 Clang: Use PCHs for indexing
As generating the AST is quite expensive it would be very useful to cache
the not changed include. So we generate PCHs for include outside of a
project part. With this change this PCHs are used by the indexer.

For that they are save to the symbol database by the PCH manager and when
fetched by the symbol indexer.

Change-Id: I7a5b07cfb32d72d50dc52d2b108cd41727a7bfc7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-22 13:26:24 +00:00
Marco Bubke
73963cc9c7 Clang: Add time stamp based filtering for project parts
The source ids are now filtered by the modified time. If the modified time
in the database is older than the modified time of the file it will be
parsed. If it is not newer it will be not parsed.

Change-Id: I4ade3443dd66573ac88053a2cafa600e54cfe973
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-22 10:24:59 +00:00