Commit Graph

61 Commits

Author SHA1 Message Date
Marco Bubke
cbe9a665c5 Clang: Fix formatting
Change-Id: I250a3d3ef01ecfcf7bd8d188ab131498e67b538d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:57:23 +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
8beb205ee0 Clang: Fix statement names for symbol storage
Change-Id: Ieb242baf70ffedbdcfdbdbff2b780a1ffb810cc2
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:52:16 +00:00
Marco Bubke
b247c4fdeb Clang: Store UsedDefines in the symbol database
We write the new defines in a temporary table and then write every new
entry in the usedDefines table, followed by remove of every entry in
usedDefines which are not in the temporary table but have a file entry in
common with one of the entries in the temporary table. At last we clean up
the temporary table.

Change-Id: Idf11ce8d17ad9ccef490578059fac08409fcc5d9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:51:06 +00:00
Marco Bubke
8a280129ff Clang: Update or insert used defines in the storage by the symbol indexer
Change-Id: Id8af85976be391e17886c9947863b81d206bb575
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:49:44 +00:00
Marco Bubke
30143650b0 Clang: Add default constructor for UsedDefine
Change-Id: Ib980f35df96a95076a92382711c23e3cee15621a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:48:22 +00:00
Marco Bubke
4f0c17bc5d Clang: Improve Macro collection
Now undefined macros are added to used macros but we filter out header
guards and dynamic libraries export. The export is quite simple but
without we would think that exports change the AST.

Change-Id: Ic16f60a6675e397dfd769c53caf77056708d8459
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:47:46 +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
fb0b5d9d9b Clang: Make it more clear that the FilePathId.filePathId is not shared
The name fileNameId could imply that the id shared for the same file name
which is not the case.

Change-Id: I27310a8994c2d9e9bb0f0aed2094bd988309c710
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-22 13:22:30 +00:00
Marco Bubke
2c08ddcd5a Clang: Add path notifier to symbol indexer
Change-Id: I2a605a5a5ac2511566edd9c069e84b5ec9d95279
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-10 12:38:47 +00:00
Marco Bubke
d9bd062325 Clang: Cleanup ClangTool
Change-Id: I34b943b1ffbc778d539acf16720d76e3cdef024e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-03 14:45:43 +00:00
Marco Bubke
ab60cfd3a4 Clang: Clear SymbolCollector before updating new project parts
Change-Id: I82e9bb4f66a7597bb911fbc97d6022ff3fdb0b35
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-03 14:45:17 +00:00
Marco Bubke
3c43e5d7ec Clang: Collect source files
Change-Id: If0183cafd00ed7e42bacbdb72a1d65624dc03cee
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-03 14:45:04 +00:00
Marco Bubke
a15250051d Clang: Handle native file in the file cache
Different types are introduced for normalized and native file path. So the
compiler is warning you if you try the wrong format.

Change-Id: I1da0686b142cbf9bb7578468c2b50f90a94cebf9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-11-23 11:55:15 +00:00
Nikolai Kosjar
5ba40cb7fb Clang: Require LLVM/Clang >= 5.0.0
...for the code model parts and declare 5.0 as the supported version for
the clang static analyzer.

Adapt versions and tests, remove code assuming clang <= 5.0.

LLVM/Clang 5 was released on 07 Sep 2017.

Task-number: QTCREATORBUG-18931
Task-number: QTCREATORBUG-18657
Task-number: QTCREATORBUG-17187
Task-number: QTCREATORBUG-14881
Change-Id: I53b00258ca06a1d2e57f9379dacc54b310687295
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-27 14:21:19 +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
2df9a99cac Clang: Add RefactoringDatabaseInitializer
We moved the creation of the tables and indices to an extra class which can
be called from other places. So you can be sure that a database is
initialized.

Change-Id: Ief5b30ced7b9011ca94367aa2578098423dcecd9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-20 10:45:07 +00:00
Marco Bubke
382c9647e8 Sqlite: Remove the Sqlite Prefix
We use a name space now, so the prefix is not of much use.

Change-Id: I2b077576f94dab778add6ab2e54870f7ca18da78
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-18 13:37:11 +00:00
Nikolai Kosjar
d1799b9aa1 UnitTests: Fix build with QTC_NO_CLANG_LIBTOOLING
Change-Id: Ia2c5b9cf617e56f09bf334bdd57e58bf96c838b1
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-09-15 09:59:46 +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
2bc537ca6b Clang: Fix build again
Change-Id: I1c8164a32c3cbfa27ce72db5093bbda613e1b9d9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-08-30 12:58:15 +00:00
Eike Ziller
696a978942 Merge remote-tracking branch 'origin/4.4'
Change-Id: I5b12586086297b57e250bbbd9c94818623ad33f9
2017-08-30 14:49:19 +02:00
Marco Bubke
d551c39faf Clang: Fix build
Change-Id: I7a310402ec4527e4db47b46e34078885e08dac0b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-08-30 12:14:46 +00:00
Marco Bubke
3dd1d11f6e Clang: Fix path for clang query
Task-number: QTCREATORBUG-18814
Change-Id: I638fa4dd993e8efbabefc883622e1619b4e5d9cc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-30 11:01:18 +00:00
Marco Bubke
5ad44318eb Clang: Improve caching of file path ids
Clang is internally using an id to handle files. We add now a mapping from
their AST local id to out global id.

Change-Id: I2d724761287b5e915237175134ec5d3b92099ddb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-29 16:37:49 +00:00
Marco Bubke
f49a1d721c Clang: Add symbol storage
Extend file path cache to 64 bit integer.

Change-Id: I5627f13d59a3214f389087038482cbcc8d0eb484
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-29 16:37:24 +00:00
Marco Bubke
81d43b8a11 Clang: Add symbol indexer
Change-Id: I8ff879631ae022bc870431628be002903360369c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-29 16:37:17 +00:00
Marco Bubke
f0e00a8c25 Clang: Add symbols collector
Change-Id: I64c25eef8eaa6cc6c3ff09d41866972b6c7248d0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-29 16:37:09 +00:00
Marco Bubke
8640ef1927 Utils: Convert to SmallStringView for comparison
Change-Id: I38d9716225b81091e8e75b26c9c2258a2aefa987
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-29 16:36:57 +00:00
Marco Bubke
b725018e9e Clang: Cleanup interface hierarchy
The server and client interfaces was tightly coupled.So it prevented
the introduction of immediate interfaces.

Change-Id: Ie4197ffddb862e076d080b3d2a5ee869fad9e4d0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-08-24 13:28:47 +00:00
Marco Bubke
9428624fc1 Clang: Tool tips for clang query diagnostics
If you hover a diagnostics in for a clang query you get now a simple tool
tip.

Change-Id: I6352dd3d4b9a33c183e69037eac903469b90eea4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-24 13:37:18 +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
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
Tim Jenssen
dae4477cd3 Clang: Make file ids unique
Clang file ids are only unique for one query. Because we query in parallel
we have to manage our own unique ids.

Change-Id: I67d57d8b1766cab75ad252a14e57bbf9dc5fdb79
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-03 09:27:05 +00:00
Nikolai Kosjar
202d4a52a0 Clang: Fix build with QTC_NO_CLANG_LIBTOOLING
...caused by

  commit f5d68398d5
  Clang: Fix canceling of clang query

Change-Id: Ic48485aed1d23e1ddd2f7bc1e37a797d2c2498c6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-29 09:00:07 +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
Tim Jenssen
637034c318 Clang: fix SEH exception
against the documentation nullptr is not working here

Change-Id: I6b5329ef97289370715faba8046724d5e42662ed
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-03-23 11:34:36 +00:00
Nikolai Kosjar
5455a45784 Clang: Compile against llvm/clang 4.0
Task-number: QTCREATORBUG-17692
Change-Id: I2781129543c09aa64938c9570896d592b57a753c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-10 08:48:45 +00:00
Marco Bubke
68afbbce75 UnitTest: Fix compilation for different configurations
Change-Id: I20d4217d1c33002f7e1ac084af4b0982b2f04971
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-06 10:23:29 +00:00
Marco Bubke
01a96537a8 Utils: Move forward declaration of SmallString in an extra header
Change-Id: I6da1cc60d425f654a31570373eb3b4f660d5f975
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-02 12:46:44 +00:00
Marco Bubke
b860d46579 Clang: Handle generated files
We don't handled generated files so we got internal parse errors.

Change-Id: If75e202f93fe3f71f43e3b1d15c0fb77e20c2248
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-01 13:11:15 +00:00
Marco Bubke
8624e3c97d Clang: Remove unused files
Change-Id: If100138459665a11812ed5977ca15b79c0836b93
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-09 13:21:33 +00:00
Marco Bubke
1ae34549b1 Clang: Remove useless move
Temporary values are already rvalue references.

Change-Id: Iae3122cc04f6adb23fdf9986b9cdfe6575e906ee
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-08 14:13:04 +00:00
Marco Bubke
1f7694135d Clang: Workaround bug in clang for multithreading
We have to fix that but people want to try it now.

Change-Id: I957215c7ec05ec0b0632179b538f5fac41f77dab
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-08 11:57:43 +00:00
Marco Bubke
542c730b33 Clang: Suppress unused parameter warnings in clang headers
Change-Id: I8b2d50be5bda75b6759b7ce73b9d37b2500f3efc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-08 11:57:35 +00:00
Marco Bubke
8c701f620a Clang: Fix warning
We can add it later again.

Change-Id: Ic75d05623cec0f9b0558495be5e1856ccf639c97
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-07 14:43:32 +00:00
Marco Bubke
cf885a138c Clang: Clean up SourceRangeExtractor::findStartOfLineInBuffer
Change-Id: Ic0b5e44756f0364f583c72b5b05795764718a6e8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:40:47 +00:00
Marco Bubke
6f362072d6 Clang: Workaround missing std::make_reverse_iterator
Because of the ancient compiler support we cannot use
std::make_reverse_iterator. If we support newer compilers we can revert
this patch.

Change-Id: I9b20ab1e53a0e9784b0455eafbbfd966797ad91e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:40:30 +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