Commit Graph

827 Commits

Author SHA1 Message Date
Marco Bubke
17080d70d4 UnitTests: Cleanup ClientServerOutsideProcess test
The data member could not be made constant. So it was quite propable that
the tests were order dependent.

Change-Id: I9e3792ea45434ad8318ef6325ca516a74ca222c2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:12 +00:00
Marco Bubke
409fecd3a0 UnitTests: Cleanup SupportiveTranslationUnitInitializer test
Change-Id: I0c43baeb13fe2a1004622267deb4e588f941d254
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:06 +00:00
Marco Bubke
872f3ee9c3 UnitTests: Cleanup ReferencesCollector test
Change-Id: I5c6d25e28116fb7e608044c2c187ff64bfcac9c9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:00 +00:00
Marco Bubke
d755986827 Clang: Cleanup ClangQueryProjectFindFilter test
Change-Id: I8e9246490c8501c71a5f0cc10aa45a0914fdda62
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:25:53 +00:00
Marco Bubke
cf4b2aec86 UnitTests: Cleanup FollowSymbol test
Change-Id: Idfacd3737b6a830a1e7c08f7b3745277ace3f756
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:25:47 +00:00
Marco Bubke
8dac5ff1c4 UnitTests: Remove heap allocations in the DocumentProcessor test
A fixture class is called for every test, so we don't need that setup
code.

Change-Id: I7fb2ee8248a161f701292a90eb6b8b88e9df08a7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:25:26 +00:00
Marco Bubke
f70bf3d2d1 Clang: Move QLocalServer in ConnectionClient
Before the QLocalServer was in the ConnectionServer so more than one
client could connect to the server. But we never used that possibility
which made the hand shaking much more difficult. It is now moved
in the client, so that there is always a QLocalServer.

Change-Id: Ifa357074b0c0809434c49d23b1cee38496f72f43
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-28 15:08:58 +00:00
Hugo Holgersson
bf3c67e0d0 TextEditor: Implement highlighting of function definitions
This allows users to style function names at their definitions.

Once set, the XML-style token "FunctionDefinition" will
highlight all function definitions: the style option is a
mixin to Function and Virtual Function.

TEST=Default themes and locally hacked themes that lack Function,
FunctionDefinition, Declaration-styling look as they did before
this patch.

Requires Clang.

Task-number: QTCREATORBUG-16625
Change-Id: I49d8e401211bdf28ff74699feac16fe98f6d64ce
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-28 12:54:29 +00:00
Marco Bubke
3f12a33bcb UnitTests: Remove duplicate
Change-Id: I5c409cce070a9f02515750139fd87b44d734979f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-11-23 12:45:31 +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
Ivan Donchevskii
7fb80595b9 ClangRefactoring: use sourceUsagesAt instead of locationsAt
Change-Id: I085b243b6e0ea4b786ce5c5f5a6894345f9d87eb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-23 07:17:57 +00:00
Ulf Hermann
5e0639542f Add some sanity to the clang detection code for qmake build
llvm-config can usually be found in PATH on systems which have standard
paths at all. There is no need to specify LLVM_INSTALL_DIR then.
Furthermore, llvm-config has an option --bindir which will tell us the
directory where clang can be found (if installed). No need to apply
strange heuristics based on LLVM_INSTALL_DIR. Finally, we can check
within each .pro file for the conditions to be met using qmake's
require() function. This way we don't need to fiddle with
LLVM_INSTALL_DIR in unrelated places.

Change-Id: I1a6ab092b06de40dfbfa4a9e7053451360fd24c8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-22 08:47:05 +00:00
Marco Bubke
9678c86e40 Sqlite: Fix double throwing for reset
We do want prevent throwing again for reset if we already have thrown an
exception but we want to throw if there was no exception.

Change-Id: Iaf9fffb872ccd579a8ccde02381b5e5d30d5c4cb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-11-13 15:45:41 +00:00
Orgad Shaneh
8a2adfef6c Clang: Remove outdated macro
Minimum version is now 5.0.

Change-Id: Ia75a26d28e676881b8e45832cae02826d176bd5b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-01 07:47:18 +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
2382824d7b UnitTest: Fix google benchmark
Change-Id: I3ea223c161d49c2f78751c07916398682b70767c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-10-26 11:25:27 +00:00
Orgad Shaneh
1c5d4d9f3b Fix tests compilation
Change-Id: I58cfe84b950e15ad9600aa25fc5e3cacd99626ee
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-26 06:15:24 +00:00
Eike Ziller
7f626b1182 Merge remote-tracking branch 'origin/4.5'
Change-Id: Iceaa4ca40b5318744bde8a76c6d3ccca08df71bb
2017-10-25 16:07:21 +02:00
Ivan Donchevskii
81f5c1c8ec Clang: implement globalRename based on clang Index
Has the same limitations as findUsages.

Change-Id: I8de4df2ecbfd8a4f3073666994398dc43af0d73c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-10-25 13:35:48 +00:00
Marco Bubke
68589a3fbc Disable GCC warning for noexcept
GCC >= 6.4 is generating warnings for function signature with noexcept. In
C++ 17 noexcept is part of the function signature. But the warning is
catching cases where a changed signature is not a problem, because it is
a template it self.

Task-number: QTCREATORBUG-18959
Change-Id: Ia6fa79c10e16d8c96a53c849ea15dcec94538fbe
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-24 14:24:08 +00:00
Ivan Donchevskii
050b4dd2f5 Clang: implement findUsages with existing index
Functionality is limited to the abilities of
current index which is not updated and is
generated only at project open.
Search box temporarily doesn't allow to "Search again".

Change-Id: Id1047f27ad0aafc901f06aa51ad38ceab95eaebb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-24 10:46:52 +00:00
Marco Bubke
b9d268977e Clang: Add usage functions to symbol query
Change-Id: If68a5119c863e616fea40275136d028abcf441f3
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-23 18:13:44 +00:00
Marco Bubke
0a3df84533 Sqlite: Use string view as result value
String view is returning simply the string pointer and the size from the
database. In that way we remove useless copies to an intermediate data
type.

Change-Id: I3354061938c52df585e91054a97c900ae4cd39b3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-23 18:03:32 +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
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
Nikolai Kosjar
f19facd378 Clang: Add more CLANG-UPGRADE-CHECK markers
Change-Id: I9ee553f29fa7a7f60291e2d7d2a56062dc722b9d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-23 11:02:18 +00:00
Marco Bubke
2a41031273 UnitTests: Add utility functions for test
Having a global temporaryDirPath makes changes much easier.

Change-Id: Iec92bba7b7eca5b0e893ebee9f457734deba8cc8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-21 13:39:31 +00:00
Marco Bubke
ce4d7e9d0e Utils: Fix smallstring move assignment
Before the string was simply swapped with the other string which can lead
to an unexpected behavior for xvalues. Now the destructor of the source is
called and it is default initialized.

foo = std::move(bar);

bar would now hold the value of foo.

Change-Id: Ibea3f18333a168634b7faf2fdaf9b5b52c82d5cc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-20 14:36:37 +00:00
Eike Ziller
bb9663529b Merge remote-tracking branch 'origin/4.5'
Change-Id: Ie83666bd18e899dabf5190c360027bf02abecdaf
2017-10-19 13:01:12 +02:00
Nikolai Kosjar
7cbc7af022 Clang: Fix completion after qualification (::)
...and maybe other cases.

Since

    Clang: fix findStartOfName handling
    commit 82d0650b11

the proposal's base position was calculated wrong. As a result, an early
return triggert in CodeAssistantPrivate::displayProposal (call to
newProposal->hasItemsToPropose(prefix, reason)) and no completions were
displayed.

Fix by ensuring that the added code from the mentioned commit is only
called when needed, namely only for function expressions.

Task-number: QTCREATORBUG-19083
Change-Id: I8f23c9b7186f9d81159939c8b3ef475a09bbe760
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-19 07:43:21 +00:00
Marco Bubke
5e0b207a89 Clang: Improve locking of string cache
The string cache is only very seldom written but very often read. To
improve thread scaling it is faster to lock it only for write operations.
So we use a shared mutex which is locked in shared mode for read
operations and locked exclusively for write operations.

Change-Id: I7dfd4a02c5484683e4d0becd39269c0146126a96
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-18 13:13:29 +00:00
Ivan Donchevskii
5c554c0de9 CppTools: add multiple refactoring engines support
Make model manager able to select the most functional
refactoring engine from the available ones.

Change-Id: I74031c910706fd694a0a7def022531501f1ea005
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-17 13:32:51 +00:00
Christian Stenger
9bd0fcbe2e Revert "Clang: Improve locking of string cache"
This reverts commit be939a80db.
'shared_timed_mutex' is not available before Xcode 9.

Change-Id: I1ac6c2b3691d5b4f457c431e255629a526c48c3a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-10 09:12:21 +00:00
Eike Ziller
07bec99e8f Merge remote-tracking branch 'origin/4.5'
Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/gcctoolchain.cpp

Change-Id: Iaad0659293681cce4266fc3e4ba2a4f2068de911
2017-10-09 12:09:27 +02:00
Marco Bubke
be939a80db Clang: Improve locking of string cache
The string cache is only very seldom written but very often read. To
improve thread scaling it is faster to lock it only for write operations.
So we use a shared mutex which is locked in shared mode for read
operations and locked exclusively for write operations.

Change-Id: I2cc742d1b9cc15c162be40ab339fa8310640bc44
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-05 17:48:23 +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
Ivan Donchevskii
bea6a3dc9f Clang: Fix ClangCodeModelServerSlowTest.RequestDocumentAnnotations
Add missing HighlightingMark parameter in test.

Change-Id: I7b2661152bebf038a3da650ee20b253fa18b471f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-29 09:08:04 +00:00
Nikolai Kosjar
087ea0e531 Clang: Rename directory ipcsource to source
Now it's in accordance with clangrefactoringbackend/source and
clangpchmanagerbackend/source.

Change-Id: I939cfc72cffb8fcde0649f125e6efb6670d1cbc3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-28 12:45:41 +00:00
Orgad Shaneh
3924d3deac UnitTest: Fix build with clang 3.9.1
llvm-config-3.9 --cxxflags has -g1 which is substituted by 1.

Change-Id: I626f3f15c659f7de030c08883b5b739b1d636ada
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-09-25 11:32:41 +00:00
Nikolai Kosjar
92693b9ac9 Clang: Remove unused messages
Change-Id: Ibe2678de726a867308fac16c6a14b0eff10cbacb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-25 11:27:12 +00:00
Ivan Donchevskii
68a49c79da Clang: Unify compiler options builders
Make build command the same for all builders.
Minimize differences.

Change-Id: I1cfe5071b3afb4944ed178fff1e57d3aee45d8a9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-22 15:00:48 +00:00
Ivan Donchevskii
f130de2400 Clang: use HighlightingMarks for hover with Ctrl highlighting
Make this highlighting work without builtin code model
but based on the HighlightingMarks that we already have
from ClangCodeModel.
Redundant parameters are removed by this change.

Change-Id: I73b5dab46ba59d2f813236831818f0a9bc94c5bc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-22 12:58:46 +00:00
Nikolai Kosjar
4c571f4056 Clang: Simplify creation of JobRequest
Do what can be done in the constructor instead of relying on the
clients.

Change-Id: I5f475b5309afb37e34d228e54ad3c12f1698d72b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-22 07:25:53 +00:00
Marco Bubke
ed2ae5fa81 Sqlite: Improve SqliteStatement
There are now only value and values methods. value returns an optional
and values are returning a vector. The result value count has now be
specified instead of the result value list.

Change-Id: I17a0741d5e838b4bf4b9486825c870ada1722584
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-21 12:35:36 +00:00
Marco Bubke
2fc4e17e31 Utils: Add Utils::SmallStringView::empty
It is required by many template function because it is used in the STL.

Change-Id: I5a2b9266d0c9d79bdc37cbbc4e7b62fac7a82b8b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-21 12:35:24 +00:00
Marco Bubke
816a9175be Sqlite: Extend database
lastInsertedRowId() function was added and more test are now under test.

Change-Id: I02bf11dbab29654dbff9f2cad8c13c0c4d15e3be
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-21 12:35:18 +00:00
Marco Bubke
fc231309e8 Utils: Fix reverse iterators in SmallString
Change-Id: I859c801fdb1ad68d5943b580f07a9e8260ae192a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-21 12:35:10 +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
623135592c Sqlite: Add locking for sqlite transactions
If you use the database in a multi-threaded environment, you must always
your statements in transactions.

For read-only statements, you use DeferredTransaction and write statements
you use ImmediateTransaction. If you mix read and write statements you have
to use ImmediateTransaction. Don't use DeferredTransaction because it leads
to undefined behavior.

Change-Id: Ida298a20f33423c8da09e768a7b658dd8e918f46
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-09-20 10:44:37 +00:00
Marco Bubke
c870199823 Sqlite: Don't use the lower level interface of the statements
We now have the very powerful write and read methods, so using the low
level interface leads only to stupid errors and prevents optimizations.

Change-Id: If2340833977935cb2d319735dee96b0bac33142b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-09-20 10:44:15 +00:00