Commit Graph

40 Commits

Author SHA1 Message Date
Alessandro Portale
a1ff9d170f CppTools: "CLANG-UPGRADE-CHECK: Update known language features macros."
Clang++ 11 has __cpp_constexpr_in_decltype

Change-Id: I450a79f2af8cd6aca51b95b11b3c06b9682c0418
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-18 15:40:15 +00:00
Christian Kandeler
d65ef60ea2 clang: Fix include/resource dir confusion
The getClangResourceDirAndVersion() function in ClangTools could return
the actual resource dir or the include dir, depending on the input. This
mistake happened because of misleading names spread all around the code.
Now the function returns what it says, and the other names are accurate
as well.

Change-Id: I0a8600857ee7b9fafb16256e0d1ad203ac3273d2
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-08-24 10:18:30 +00:00
Marco Bubke
99e841d140 UnitTests: Add return value to mock function
Otherwise we try to get access a negative index. The real implementation
will never return a negative value, so the shouldn't the mock function.

Change-Id: I369e168bd18530b39fa5e2a622a716b30b8b344c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:54:06 +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
199746143a Clang: Bulk add project file paths to database
This project part container generation because there is not anymore one
single access to the database for every file path.

Change-Id: I5f82022262fe89a976729d48ee4f098b74a1e1d1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:52:09 +00:00
Christian Stenger
e8e17f6c52 Unittest: Fix compile
Change-Id: I2ee07a67f042ac952d0301a0880f0674d21de714
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-24 09:42:32 +00:00
Eike Ziller
917636b88b Merge remote-tracking branch 'origin/4.10'
Conflicts:
        src/libs/utils/consoleprocess.h
        src/libs/utils/consoleprocess_unix.cpp
        src/libs/utils/consoleprocess_win.cpp
        src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp
        src/tools/clangrefactoringbackend/source/symbolscollector.cpp
        tests/unit/mockup/projectexplorer/project.h

Change-Id: I8d10f26b9bcb54829ba31cdc2272885691df1e16
2019-06-18 12:30:55 +02:00
hjk
ce40c84a38 Fix projectupdater unit test
Amends 35fa8aa802.

Change-Id: Ic791959c4bce66bf9b8b1b43e60c86268c33a029
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-06-17 12:44:42 +00:00
Marco Bubke
4bae5de36b Enable macro editing for the Clang indexer
Refactor much of the code from Environment* classes to NameValue* classes
to share it with the preprocessor macro settings.

Change-Id: Ica4ee817aa338230c422b30d91240d266248d226
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-13 16:51:48 +00:00
Marco Bubke
e904fc202c Clang: Filter macro QT_TESTCASE_BUILDDIR out
We have to universalize it later with a UI so that user can set their
own macros.

Change-Id: I5385c3c1b01dbf77a1cbc2431103fcdea3f96118
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-06-05 13:54:21 +00:00
hjk
35fa8aa802 Fix projectupdater-test.cpp after FileName changes
Change-Id: I43974405522facd46a757ba4cf2886128310597c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 16:49:29 +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
1975641a3d ClangPchManager: Remove target triple
We don't need it so far and it is creating trouble.

Change-Id: Ia502452717b5be935e4ba2cd2de04007e4144199
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-29 12:51:58 +00:00
Marco Bubke
5ab057746c CppTools: Add pre system include search path per project
Sometimes you want add a pre system include search path per project to
overload some system header for indexing. This can then even be checked in
the repository.

Change-Id: Ib103e5935d0553aa94522ed736f8c4eb2405a093
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:08:33 +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
71e6c40cc2 UnitTests: More QString fixes
Change-Id: Id1c60dfa8b3ada2c855f43437a153042cfec9f63
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-04-08 22:15:04 +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
f009dad9ef ClangPchManager: Show extra progress for dependency building
Task-number: QTCREATORBUG-21956
Change-Id: Id244c9ef9fc7825489daa143b21fcca78164d8c7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-02-22 12:09:09 +00:00
Ivan Donchevskii
29492ecf24 ClangPchManager: Do not build pch and index inactive project parts
Some project parts should not be built as well as some files
can be inactive inside project part.
We should not try to build pch-s or index them.

Change-Id: I8e62365b817a424ae38a0df94b6703820a4cde9d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-19 07:34:19 +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
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
Tobias Hunger
1df553a683 ProjectExplorer: Rename IncludePathType to HeaderPathType
It is the type used by the HeaderPath class, so reflect that in
the name.

I also considered to rename HeaderPath to IncludePath, but
that name is reflected in a lot of users, which would also need
to be adjusted for consistency. That would blow up the patch size
for little value IMHO.

Change-Id: I51421dbd3ab8b2874dc32fc82dc394c9b93ce5e9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:32:31 +00:00
Marco Bubke
75c95d4b73 ClangRefactoring: Fix project part id
We used display name which is part of project part id instead of the id
getter.

Change-Id: I97aa343c4380f9eb8c8e6a4400156eeac1f40863
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-12 10:35:12 +00:00
Marco Bubke
3abaf647d0 Add system include path to HeaderPath and merge ProjectPartHeaderPath
System include paths are appended after other includes by the compiler. So
we should set them as system includes and not as normal includes. Otherwise
we change the include order. Headers in system include paths are not
cluttering the screen with unwanted warning and by the way improve
performance too.

ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them.

Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-09-10 09:31:32 +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
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
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
8b85b095b2 Clang: Rename defineName in macroName
Change-Id: Iaf8da991032e5ed4726384c051290a77887351fa
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:57:34 +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
Ivan Donchevskii
b10f8484c7 CppTools: merge CompilerOptionsBuilder with Clang one
Since it's never used for other compilers.

Change-Id: I9512692d1dc9f9a701ea2453b7d50005478bed5d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-23 12:46:34 +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
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
1a75db12f4 Clang: Improve speed by content generation
The argument parsing has some considerable overhead. We try to avoid that
with merging all content together in one file.

Change-Id: Icf426bb5d6a5569d59c180f94c7eab66a22a251c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-16 17:39:05 +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
c072cdfb88 Clang: Add ClangPchManager
Compiling every header file again and again is quite time comsuming. There
are technics to improve this like preambles(a kind of automated
precompiled header) but they don't share their data between translation
units. This approach provides an automatically generated precompiled
header for every project and subproject to improve the loading time.

Change-Id: I34f5bd4db21951175920e2a9bbf6b97b1d705969
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-30 13:55:58 +00:00