Commit Graph

853 Commits

Author SHA1 Message Date
Nikolai Kosjar
5972e27169 Clang: Ensure to clear all affected translation units on project part change
The ones that were already dirty were not taken into the account and
used the old project configuration.

Change-Id: I949d1ca8c23bbdb18eec78e5a708199beff6f735
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-05 15:27:44 +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
Ivan Donchevskii
7a7123b1bc Clang: add globalFollowSymbol to RefactoringEngine
Allows to follow outside of current TU.

Change-Id: Ieea2fd72bfdf6d60a988b40efcf2f41c5a71d045
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-14 14:25:14 +00:00
Marco Bubke
bb62fd3e56 Clang: Move printing functions in clang support to unit tests
The printing functions are only used by the unit tests and they use an
external API. So we can easily move them to the printing functions in
the unit test project. We have to move the TokenInfo print functions too
because the depend on other print functions. The rest of the print
functions will be moved in other patches.

Change-Id: I87c452f8ca40687ec47de675ba6bee13efa5655b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-13 17:24:59 +00:00
Marco Bubke
8cce4daa80 UnitTests: Make fake function inline
Change-Id: I8e0927a80d0bdcde7bd0e91c749d015636d07388
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-13 17:23:28 +00:00
Ivan Donchevskii
11d002968e Clang: add more data to TokenInfo class
Add token name, usr, isDefinition and isDeclaration.

Change-Id: If67bf78c999cb9edd397d0b553b33e5f5f378f8a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-11 15:18:52 +00:00
Ivan Donchevskii
affc652b7b Clang: Rename HighlightingMark to TokenInfo
Before adding additional members into that class it
makes sense to rename it to better represent its content.

Other classes serving the same purpose are also renamed
to keep the names consistent.

Change-Id: I3c8517e42aae29779d71ec9c85b713cff581a473
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-11 15:00:24 +00:00
Marco Bubke
b1bb6d9641 UnitTests: Fix ODR problem for print functions
You have to include them for all translationunits because otherwise default
print function are generated. So you get to different implementations for
the same symbol.

Change-Id: I732d2e1f1774f72acdbb49cbe1848d31ca3f5c98
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-11 11:56:21 +00:00
Marco Bubke
76807c134a Clang: Merge FilePathView and NativeFilePathView
Change-Id: Ib07b16bf60c56027814cc5f0d7be1cacd15e96bb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-12-05 17:08:56 +00:00
Marco Bubke
b045705115 UnitTests: Cleanup SymbolQuery test
Change-Id: Ieb4fe43c7b5cd27cc270f3c5d269c2d4812a0131
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:47 +00:00
Marco Bubke
21ce7386e9 UnitTests: Cleanup SourceRange test
Change-Id: Icd9ef74385bb35a4fe1f2f8142b4bf677eb7d389
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:39 +00:00
Marco Bubke
f3164c5a91 UnitTests: Cleanup SourceLocation test
Change-Id: Ia18fb69584087c38c464444b4385a9b2ddb78179
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:31 +00:00
Marco Bubke
40a8c56b5f UnitTests: Cleanup FixIt test
Change-Id: Iaf5616156c5d712c19661529ff6a444a6d20b937
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:24 +00:00
Marco Bubke
b5fdfe46c5 UnitTests: Cleanup Diagnostic test
Change-Id: Idf7d50ad15862508c2d57167f2147389e3bacba4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-05 10:26:18 +00:00
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
67767f9925 UnitTests: Add mockup for Core::ICore::userResourcePath()
Otherwise the unit tests does not linked any more.

Change-Id: I1d756b8bef18d65174a8924a15995cc179af61f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-29 13:04:13 +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