Commit Graph

918 Commits

Author SHA1 Message Date
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
98d7b502ca ClangRefactoring: Clear input files after collecting symbols
Change-Id: Ic4fbaac7ad3b3f80223d6cbb84a34dffa741fc4f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-26 12:21:24 +00:00
Christian Stenger
64e842759b Unittest: Silence most of the warnings on Windows
There are lots of warnings coming from including
or linking against LLVM which cannot be influenced
directly. Silence most of the warnings to be able
to work with the mess.

Change-Id: I2c4adec14945ada878bb1e6fda2f06e6d56007e2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-06-25 07:36:47 +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
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
ee27ae2ef7 ClangRefactoring: Improve indexing
Fix some bugs in the indexing and use the new macro indexer from clang.

Change-Id: I2ba1b28097a8751aea942071851a60d164c6f371
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:49:49 +00:00
Marco Bubke
b36e9d0e95 ClangPchManager: Improve handling of no include in project PCH
We were doing simply nothing but we should call
PchCreator::doInMainThreadAfterFinished().

Change-Id: Ia21d2cf4af53121d9e401f6e9a5b432a4daed00f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:46:31 +00:00
Marco Bubke
b213dee013 Clang: Improve updating
If project parts are up to date we send them directly to the indexer, so
the indexer can decide we something needs an update.

Change-Id: I7d4f32794c6b3a861cdefb3653a6dfd4e711f619
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-17 10:46:21 +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
Cristian Adam
84659016e7 CMake build: Build fix for "Enable macro editing for the Clang indexer"
Change-Id: I69396e306d1b8646fa4388681a8705937bf9423f
Reviewed-by: hjk <hjk@qt.io>
2019-06-14 10:46:23 +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
Christian Kandeler
e6bda58033 CompilationDBProjectManager: Handle relative sysroot
Fixes: QTCREATORBUG-22388
Change-Id: I030b105897bd483c17aaf86229d4515b2dd747d3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-06-04 10:17:44 +00:00
Cristian Adam
f50859e856 CMake build: Add unittest CMake build files
On MinGW 8.1 I get the following after running ctest -j 40

99% tests passed, 35 tests failed out of 2631

Change-Id: I2c3ce7940b036e52ef393feab5837886355e7b5a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-29 13:46:25 +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
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Nikolai Kosjar
0bac3ad279 C++: Do not auto-insert '}' after control flow constructs
...as this rather gets in the way.

As before, pressing ENTER after { will still auto insert } on the next
line.

Fixes: QTCREATORBUG-18872
Change-Id: I8ee082962b5ee82781e51c3e5ee146343f808332
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-05-28 07:36:09 +00:00
Christian Kandeler
0ffbe6a9e4 CompilationDbProjectManager: Sanitize project parsing
The parsing code used to access all kinds of stuff (e.g. the project
tree and the toolchain manager) from the non-UI thread, which is not
allowed.

Fixes: QTCREATORBUG-22420
Change-Id: I4be47919d7e543376d31826dd380f66f4e060458
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-05-23 08:56:16 +00:00
Nikolai Kosjar
eb1aa8dcca UnitTest: Fix ProjectInfoGenerator.* tests
This amends e3def98c00.

Change-Id: I21deb74fe4a4387f7490c806e0990bafd06438bf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-05-21 12:54:12 +00:00
Orgad Shaneh
fc11380e07 Fix unit tests compilation + initialization order
Amends commit cc9d246b02.

Change-Id: I688df432cd03f440ec6c15ca5402d94430ce74f8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-05-03 06:21:44 +00:00
Ivan Donchevskii
d4c5a6f9b2 CompilationDatabase: Fix unit-test
Change-Id: I2a2e2b5ead35236f11e6f9f0ec15608b30335fd1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-04-30 12:46:41 +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
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
facda6f502 ClangPchManager: Don't generate PCHs if there is no include
Change-Id: I88caab6ff188b64d92a74d61276c4724c33cae23
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-29 08:57:10 +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
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
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
0fbc16cd7d ClangPchManager: Fix alive message
Computing the dependencies can take quite some time. So it is better
to ensure that the alive timer is fired.

Change-Id: I0b372ef73a8a5e6716673ba9457d424151a762bb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-23 09:08:15 +00:00
Ivan Donchevskii
9d4c7b1c42 Unit-test: Fix build
Change-Id: Id89bbd391117d998bb6e8d4607786ac48580a7f4
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-18 14:29:07 +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
Orgad Shaneh
f213f6176b UnitTest: Fix compilation
This amends commit a5ee354b19.

Change-Id: I29938d30187fde1ac05d824276cb4b02b561645a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-17 04:34:31 +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
Orgad Shaneh
39ba01da71 Merge remote-tracking branch 'origin/4.9'
Change-Id: I7d1912cd5c4d824fd40d3454c5f1bb796f2c21d8
2019-04-07 23:13:17 +03:00
Marco Bubke
dce3e9708c UnitTests: Allow cast from char* to QString
Otherwise it is not working for older compilers and Qt versions. We can
revert it if we drop support for that old versions.

Change-Id: I0f71e05235e9ff24cee28131654c9b6df9997643
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-04 10:48:23 +00:00
Ivan Donchevskii
c5a58a9cb5 ClangFormat: Add more unit-tests for if conditions
Change-Id: I4ed68fc6260bfb4b058d5714d64dfec638ae1953
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-03 12:48:38 +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
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
Ivan Donchevskii
01a528c77a ClangFormat: Fix indentation when empty lines are involved
Unify continuation and new statement to get less false indentations.
Handle one-statement if/else as a special case.
Properly handle empty lines after
 - includes
 - preprocessor directives
 - beginning of the file
 - if/else

Fixes: QTCREATORBUG-22238
Change-Id: Ic334eeca7de47d9fcb74963d2e31711838d04bde
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-02 11:32:39 +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
1b0cba38dd Clang: Fix access specifier for variables
Static members have a variable declaration kind so
we need to check their access specifiers in order to
provide proper information about tokens.

Fixes: QTCREATORBUG-22082
Change-Id: If455174bd346398a2df3499fa6cf1ea2b4e26965
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-12 14:19:48 +00:00
Ivan Donchevskii
d7eeb0bd90 ClangFormat: Reduce dummy text to minimum size
... and tweak continuation dummy text to fix the indentation
for the line with existing text inside parenthesis.

Change-Id: Iaebd2f58823fcbeed24bb7e47769af53261c18ca
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-12 10:45:46 +00:00
Ivan Donchevskii
5333331362 ClangFormat: Tweak dummy text for consecutive empty lines
If empty lines follow each other it makes sense to use
the empty comment as dummy text for all but the last one of them.

This prevents increasing indentation lengths after if (foo) when
there are multiple new empty lines inserted.

Change-Id: I4c948161b674b3af0a131bfb85e7a45a80ed3fb0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-12 10:11:12 +00:00
Ivan Donchevskii
cb3a553583 ClangFormat: Indent closing brace on the new line
Sometimes the curly brace also requires indentation.
These are the cases when it comes directly after the
comma, for example inside the initializer list.

Lets handle such cases in the similar way we do it for
the closing parenthesis.

Change-Id: Ia0d25fa08f7224567dd41dd17f9757d9d8b27362
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-12 10:10:28 +00:00
Ivan Donchevskii
5006bfb157 ClangFormat: Simplify the dummy text for empty line heuristics
The text to fill the empty line mostly depends not on the
fact of being inside parenthesis or not but rather on the
last preceding meaningful character.

Let's check for this character and sometimes for the following
one to better understand the current context and pick the
proper dummy text.

With this behavior improvement we can better indent empty lines
inside initializer lists with empty lines inside.

Change-Id: Id2f27454ef56dfdf8c15b5efb14c4d09242908a9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-11 10:32:23 +00:00
Ivan Donchevskii
df23fbdc89 ClangFormat: Improve dummy text guessing for empty lines
Improve detection of the cases when the empty line is inside
the parenthesis to get more proper indentation.

Change-Id: I4aa37c29b17bedcd0e4a781d12c7066e818a07f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-07 14:03:36 +00:00
Ivan Donchevskii
7e5e99d551 ClangFormat: Add whitespace unit-tests and fix bugs
Check that extra whitespace does not prevent the indentation
and that indentation is the same for the consecutive empty lines.

Change-Id: I04aa12c4cd31aaf07daf9320c98d2eea7afcc9a8
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-06 14:24:07 +00:00