Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
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
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
96eb407266 ClangPchManager: Introduce PchTasksMerger
So far no merging is happening but we will add it after the rest of the
pipeline is in shape.

Task-number: QTCREATORBUG-21381
Change-Id: I610c243eabcb305843ad6339fdc636b0c3966fc1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-10 17:09:02 +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
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
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
0bef7610a1 ClangRefactoring: Move generated files to own messages
There must be a management about it but this will be added in a different
change set.

Change-Id: I47b6ce7f671f1c8ae07083d6d99c534069e3cc1a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-08-08 13:13:35 +00:00
Orgad Shaneh
5e483d04bc Clang: Fix build
This amends commit cf4dbb4bb6.

Change-Id: Ib74fba38348a02f6bb9d254b7a5e9013a2013942
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-04-09 05:25:40 +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
6922f549d5 Clang: Check if the include search path has changed
If the include search paths and the compiler macros have not changed it is
save to assume that we don't need to update the symbol database. This saves
us from executing a very expensive task. Later we have to test the
modification time of the files too.

Change-Id: I6b958075024a811c2abd3d7918263fd74bba090b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-22 10:23:39 +00:00
Marco Bubke
56f79feebf Clang: Introduce CompilerMacro
We want not only the name but the value of the macro too. So we can
compare if anything has changed.

Change-Id: Ie59caf8cbf54d108f9e15299d25306a406b5c40d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-15 09:58:53 +00:00
Marco Bubke
22b5bbbff3 Clang: Add defineName to ProjectPart
We need them later to find out if the defines have changes.

Change-Id: Iaaa14df3dc6f50cb286c2dac37db13c975063c1e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:54:49 +00:00
Marco Bubke
0f8befacd3 Clang: On the road to update and preprocessor support
This patch has grown in a quite big change set and it is really hard to
divide it in different parts.
V2::ProjectPartContainer is now using FileIds instead of file paths. This
cleans code up because it is a big step in the direction that internally
only file ids are used. But it is depending on the file cache, so the
file cache has to be provided as an argument. There is now an interface for
transactions too which are ease the testing of them and enables the support
of preprocessor. It adds macros as symbols and is saving used macros. The
used macro support is enabling update improvements because only if a
changed macro is used it needs to be recompiled. This is still in flux
and can be changed in later patches.

Change-Id: I492a2c9af1201d40fdd9f46a0045f7878bbbaa3d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-29 13:47:09 +00:00
Marco Bubke
507d99f03c UnitTests: Use memory database
Tests get more reliable if the database is not shared between different
tests and the testing is speed up by not accessing the file system.

Change-Id: Ieb3c5495df4f0fae2293111949792774b01bf913
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-23 17:59:20 +00:00
Marco Bubke
d2e15e5f1e Clang: Add file cache
The database is using file path integer ids to handle file paths because
otherwise we would save many redundant data. This patch is improving it
further with the introduction of a database based file path cache. The
entries are now divided in a directory path and file name. This is quite
handy for directory based file watching.

Change-Id: I03f2e388e43f3d521d6bf8e39dfb95eb2309dc73
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-05 17:36:37 +00:00
Marco Bubke
3adb71d45e Clang: Add Symbol Indexing
It is a first step and now a database is generated if you start QtCreator.
Some code is now shared with the PchManager which can be improved in the
future.

Change-Id: Ic267fe7960f6c455d91832859a673ce98f269aa2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-14 13:39:55 +00:00
Marco Bubke
a31eae4d0a Clang: Add clang query pane
We now support highlighting for an example text and for the query.

Change-Id: I88c415ff871cf3e4c2d4fc83d60a8555bf0ce08a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-20 13:32:39 +00:00
Tim Jenssen
86b6b71937 Clang: fix separators for tests
Change-Id: I951603294f2cf0a044463ddb431b80370b393bb6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-07-03 18:17:29 +00:00
Tim Jenssen
23cae9a9e0 Clang: Filter duplicates in clang query output
Because we can visit headers many times, we get results many times too.

Change-Id: I3bbe7d7a5d01c2580a4569bfe115f14a69edc8a7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-03 09:57:57 +00:00
Marco Bubke
f5d68398d5 Clang: Fix canceling of clang query
Every AST unit is created and queried asynchronously, like before, but
we don't wait anymore but use a timer to process new sources. So the server
will not be blocked and can process other messages like cancel.

Change-Id: If0e69466c78f628190f59fd32a03cab1c3a4d0a3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-28 09:15:51 +00:00
Marco Bubke
ada5ea1952 UnitTests: Fix names and disable slow tests by default
Slow and very slow tests have now their own test category. We add SlowTest
for tests which are slower than ~5ms and VerySlowTest if they are slower
than ~100ms. They are disabled them by "-*SlowTest.*". If you have a faster
machine than most developers simply try lower values. The aim is that most
developers can execute the tests in under ~2s.

In the long run we should use dependency breaking and data sharing to
reduce the count of the slow tests.

Change-Id: I8578071258d7f89b2052709f3dd526ced811483f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-01-04 12:35:52 +00:00
Marco Bubke
15de02ea0c Clang: Add refactoring support for unsaved content
We need the generated UI header but we don't have a build directory. So we
provide clang with in memory represations of the file.

Change-Id: Ie9db97bbea2222b0203a0457baa1f1fc7ad97213
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:39:11 +00:00
Tim Jenssen
7f757884c5 Clang: Extend clang query
It's a first step to introduce clang query.

Change-Id: I4d001a8883f56066765ce6bc561fa3f49611c0a4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 12:16:04 +00:00
Tim Jenssen
9c7ff5199f Clang: Add clang query
Clang query is mechanism to use AST matcher to search for code. Think
about regular expression but in the context of AST. So you get a semantic
search tool for C++.

Change-Id: I72e882c5b53a0c52f352a3664847c4c3e4f6fc2e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-15 15:30:33 +00:00
Marco Bubke
47c01daeb2 UnitTest: Cleanup
Improve naming and introduce googletest.h.

Change-Id: I445c13db4c23d6dd5682ce0db3b83055cc6b8a89
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-19 15:17:54 +00:00