Commit Graph

70 Commits

Author SHA1 Message Date
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
3e1faec230 Clang: Don't filter source with missing includes
We do now tag and save them. So we can reliably track them.

Task-number: QTCREATORBUG-22035
Change-Id: I49aaeeb76150b7e2d77b863eeb0aedefc9ab50f4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-03-06 11:24:28 +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
Orgad Shaneh
495f98b256 UnitTest: Add missing enum
Amends commit f009dad9ef.

Change-Id: I5288297525edc153c1aea81d2cabb1f230a8fcce
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-05 12:19:35 +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
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
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
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
ef8de6a384 CppTools: Introduce HeaderPathFilter
We went the filtering of the header path outside of the compiler options
builder so merge the PCHs.

Task-number: QTCREATORBUG-21693
Change-Id: Ia1126813a5049e39d7c6e7d60bf449aa17012d02
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-17 11:06:14 +00:00
Marco Bubke
390a227df6 ClangPchManager: Introduce PchTaskQueue
With the PchTaskQueue the pipeline is almost complete.

Task-number: QTCREATORBUG-21346
Change-Id: I5f05d525db1679eb37dd1d462076c1ed42958099
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-10 17:09:31 +00:00
Marco Bubke
299a163b18 ClangPchManager: Extend PchTaskGenerator
It's generating now PchTasks for project and system includes and call the
merger directly.

Change-Id: I966a9a72e1b915255d95b713b66e92d36d85d79b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-10 10:58:40 +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
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
Marco Bubke
f644ea0a01 ClangPchManager: Add BuildDependenciesProvider
It is still unfinished but I want to add other changes first.

Change-Id: Ife7ac56576f85d800633ea1e8f1c3f4f16486d5f
Task-number: QTCREATORBUG-21377
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-06 11:52:11 +00:00
Eike Ziller
1473bc5891 Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/debugger/debuggermainwindow.cpp
	src/plugins/qbsprojectmanager/qbsbuildstep.cpp
	src/plugins/winrt/winrtdevicefactory.cpp
	tests/unit/unittest/gtest-creator-printing.cpp
	tests/unit/unittest/gtest-creator-printing.h
	tests/unit/unittest/unittest.pro

Change-Id: Ie9b80b87a8a4fa81baf72a2daa7919b21371c15e
2018-11-06 09:20:00 +01:00
Marco Bubke
f8ec57919f ClangPchManager: Add PchTaskGenerator
Task-number: QTCREATORBUG-21358
Change-Id: Ia460ce82c3c896f4d0ac00638d03800a55dd27dc
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 13:35:11 +00:00
Marco Bubke
e571220663 Clang: Add top system includes to include collector
If we want to split the project part we have to filter out the top system
includes.

Task-number: QTCREATORBUG-21345
Change-Id: I258fa33ac39bd94b4699f4f39923d6ad274c1dc7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 13:34:52 +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
Nikolai Kosjar
aa290912b8 Clang: Remove project tracking on clangbackend side
...as it is not needed. Just provide the compilation arguments as part
of the Document.

As a side effect, re-initializing the backend after a crash is cheaper
and will not freeze the UI anymore (referenced bug).

Task-number: QTCREATORBUG-21097
Change-Id: I866e25ef1fd5e4d318df16612a7564469e6baa11
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-26 10:45:41 +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
Ivan Donchevskii
50e5aacb02 Highlighting: Add highlighting style for punctuation
Currently only operators have their own style but not
punctuation tokens. Make possible to highlight both.

Task-number: QTCREATORBUG-20666
Change-Id: I9533e0f1bef65b86c4e4f5c9756571103584124b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:15:05 +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
5bd7af7a90 ClangRefactoring: Add SymbolIndexerTaskQueue
A first step for concurrent index task.

Change-Id: I9a0dba9f4a67ee605281516785697045b34e2694
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-08-27 09:17:39 +00:00
Marco Bubke
876d068011 UnitTests: Move printing functions to creator printing file
Change-Id: I09043347370d4fad623f8e803d4ef0f147fffa21
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-08-23 08:06:25 +00:00
Marco Bubke
4195fce68f ClangRefactoring: Integrate generated files
This is an intermediate step to handle the indexing of the project parts
completely. The generated files are now independently handled from the
project parts. We still not handle the case the a file is indexed but the
generated file is not provided. This will be done in a different patch.
All provided data is now sorted too to improve merging.

Change-Id: I09712b99217a881ec0a233d09aea8659fb787324
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-08-14 12:47:03 +00:00
Orgad Shaneh
8654677015 UnitTest: Remove unused function
This amends commit da4be3fdb7.

Change-Id: Iffdf4581b7f29fc846c944e24f33e27e003f1b3b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-07-31 10:10:19 +00:00
Ivan Donchevskii
da4be3fdb7 Clang: Use new libclang code completion fix-its feature
Each completion coming from libclang now has it's own
list of fix-its which are required to be applied before
completion itself.

This saves one extra reparse cycle and gives an ability
to provide both kinds of completion (initial and corrected
one) for cases like shared_ptr, unique_ptr or any other
class with overloaded arrow operator.

Each of these extra fix-its is applied together with
corresponding completion dircetly before completion itself.

Change-Id: Ide37e45bb15fa2f1375cd6b86ecd43ced3593046
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-07-27 07:34:44 +00:00
Orgad Shaneh
993f893a9c UnitTest: Add missing highlighting enums display
Change-Id: Id35c328cf98896a39c9c6c0e641b1046720d78ad
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-07-25 07:57:30 +00:00
Ivan Donchevskii
e1111d4570 Clang: Use built-in follow symbol for virtual methods
ClangCodeModel currently does not provide a list of overrides.
Therefore it makes sense to use ClangCodeModel result for
virtual method only if built-in code model does not find anything.

Task-number: QTCREATORBUG-20584
Change-Id: I5b4fac7974f990e741d3438ab61827670a8ce8d8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-15 12:15:22 +00:00
Nikolai Kosjar
f01fbcb789 Clang: Clean up some IPC names
This is long overdue since some names were simply wrong and/or
misleading. Also, some of the old names were long enough to almost get
crazy.

The renaming starts from ClangCodeModelServerInterface and
ClangCodeModelClientInterface and affects usages and related functions.

For the ClangCodeModelServerInterface, categorize the messages in
 - messages that require a response (request*)
 - notification messages (the remaining ones)

Change-Id: I5342ed8e0d87404ee72f3c3766fd8ef7505defb1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-06-04 09:54:01 +00:00
Ivan Donchevskii
4e4bd4909a Clang: Use follow symbol result from clang when global fails
When built-in code model fails to follow symbol under cursor
fall back to the clang result even if it only follows
to the decalration.

Change-Id: I22d8c5fee6ab7594b1d1b7ce8104414db28383c7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-04 08:48:33 +00:00
Nikolai Kosjar
2dde82112e Clang: Fix -Wswitch warning regarding OverloadedOperator
gtest-creator-printing.cpp:493:12: warning: enumeration value
   'OverloadedOperator' not handled in switch [-Wswitch]

Change-Id: Ic28dcbcc402a8f5c0f2bd284cc9b6fd560221208
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-08 11:32:20 +00:00
Ivan Donchevskii
ef660d8bd0 Clang: Simplify name and type in FullTokenInfo for functions
Take Cursor displayName instead of token name.
From now on type spelling can serve the return type
role for functions because together with 'token' member
they form the full type.

Change-Id: Ic8eec533f4a11458f99f070b6a6aa80714097b4d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-23 07:59:40 +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
Marco Bubke
b0fd6c30ce Clang: Distinguish between Enum and Records
Creator is distinguishing enumerations and records, so we should do too.

Change-Id: I114cfd207464abd9afd96c26c7504cf8a3a1cb8c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-12 13:11:51 +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
1f0562742e Clang: Add lastModified to the precompiled header
It is important to know then the PCH generation started, so we can compare
the header file time stamps against it.

Change-Id: Id8ee91e886c153d9d4a37cc0438c682f2098f7fa
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-20 14:04:00 +00:00
Marco Bubke
b5c3d5a40d Clang: Improve ProjectPartArtefact
Empty strings were only handled by accident and wrongly formatted ones
were never handled. Now we do nothing for empty strings and throw an
exception from wrongly formatted strings. The exceptions are very helpful
in the test code because the show errors the the testing data.

Change-Id: I87d1678eda7502fdc3f74f51fad491803d28582b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-21 14:17:09 +00:00
Ivan Donchevskii
dacfc611c5 Clang: Add highlighting types for ObjectiveC
Builtin code model supports ObjectiveC classes,
properties, etc. We can easily get the same
information from clang.

Change-Id: Iede5e177d4932f404e4ccb81ae356eee8faffb71
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-02-20 13:34:37 +00:00
Ivan Donchevskii
66c7629814 Clang: Properly handle Q_PROPERTY in TokenInfo
Transform Q_PROPERTY into unique AST node.
Mark different parts with types and search for parent
in FullTokenInfos.

Change-Id: Iaa1ec0c73d34773edf5605d3682bd6a290d195de
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-02-20 06:49:47 +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
29a4419c07 Clang: Update symbol database if file has changed
The code in the symbol indexer is quite similar, but still different
enough to prevent easy reuse of the function.

Change-Id: I47907d90066da922eafe8ff3cce124ea47ea4a0a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-14 15:06:58 +00:00