Commit Graph

279 Commits

Author SHA1 Message Date
Orgad Shaneh
e9cffc1b74 Clang: Fix auto-detection of gtest/gmock on debian family
The source files are in /usr/src/g{test,mock}, the includes in /usr/include

They were also swapped.

Change-Id: I2a9ad84f8d29a0873a4e568f4b21a198c70d948c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-01-04 10:53:50 +00:00
Orgad Shaneh
1e5d6115f0 Clang: Fix GCC 5.3 warnings in unit tests
signed/unsigned comparisons.

Change-Id: I04c7fc82e23736ab07432a09f4063872e4405735
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-01-04 10:07:39 +00:00
Nikolai Kosjar
c0e1b1581b Clang: Fix displaying template parameters II
...in the function call completion tooltip.

Task-number: QTCREATORBUG-15286
Change-Id: Ie24576f98ee4ba8f954de394f3596093323a2c35
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-16 15:38:36 +00:00
Nikolai Kosjar
4382274ba4 Clang: Fix emphasizing current parameter in function signature tooltip
...when completing function calls.

Task-number: QTCREATORBUG-15108
Change-Id: If55effe117774f3ec5debb03a9c7889981ea27d2
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-16 15:36:47 +00:00
Marco Bubke
18fa35c152 Clang: Fix highlighting for using a namespaced type
using NameSpace::StructInNameSpace;

Task-number: QTCREATORBUG-15271
Change-Id: I17a3ad1e1eed7a820ed7dead5d15a3de760c135f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-16 15:28:27 +00:00
Nikolai Kosjar
86f3194cc1 Clang: Add disabled test ArgumentToUserDefinedIndexOperator
It looks like there is no way to mark a test as expected to fail, so
disable it.

Task-number: QTCREATORBUG-15473
Change-Id: Ic6cb2c00a64cf647cb499492064d451d0dd08075
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-16 15:21:21 +00:00
Marco Bubke
8d6c10b241 Clang: Flatten code completion chunks
Avoid the sub vector for performance reason and use an flag for every
optional argument because there can be no recursion.

Change-Id: Iae1eaa1f164e4129e30358a1719582e5231f0385
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-16 12:16:08 +00:00
Nikolai Kosjar
0af0bd8e36 Clang: Show type icon for usings/typedefs
...in the completion widget.

Task-number: QTCREATORBUG-15078
Change-Id: I1309b628e1f060fa68bdcf13838037728207b035
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-08 13:05:02 +00:00
Nikolai Kosjar
0985e67858 Clang: Reparse editor document on project change
Change-Id: If7dcdc370fd50fded996df80ab6c893b4ec1ad55
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-07 15:49:33 +00:00
Marco Bubke
d7a0268610 Clang: Show Enumeration as Type
Change-Id: Icb3fbaad68802276faa4a2c50d18c2415e17d26b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-07 15:32:29 +00:00
Marco Bubke
19d9dc0ce3 Clang: Use line and column instead of offset for diagnostics
Offsets can be get wrong because of the utf8 <-> utf16 differences. Line
and columns are not that sensitive to it.

Change-Id: I2e3e8c000621b6d694a4ada6df176f29427794f5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-07 11:10:05 +00:00
Marco Bubke
c209aaf22e Clang: Fix highlighting issues
...for macros, typedefs and enums.
	
Change-Id: I926e7238695caefd7f4463dbe0cf5b428aa98c1a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-07 08:41:03 +00:00
Marco Bubke
493a2a6189 Clang: Fix slowness of code completion after opening the file
Task-number: QTCREATORBUG-15429
Change-Id: I9a8a582fb3c59a960425f83eb8e7b436f15d1c1a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-02 12:37:25 +00:00
Marco Bubke
a992a1064c Clang: Update document annotations only if document is visible
So no reparsing is happen for invisible files.

Change-Id: I8bf3fe8aed38b30ceeabc50ba2f216acc4b8b718
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-01 13:59:53 +00:00
Marco Bubke
514a96c75f Clang: Don't reparse before code completion
Task-number: QTCREATORBUG-15365
Change-Id: I37f623449fa95268f1a0a5d5e66d75df0582c183
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-30 15:49:19 +00:00
Nikolai Kosjar
ed4bfff644 Clang: Rename "Editor Updates" to "Document Annotations"
"Editor Updates" are not to the point since what we generate is for the
document.

Change-Id: I94ceeca5c85c7cf01cc659ca55320d07010c8617
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-30 11:11:32 +00:00
Nikolai Kosjar
1410bf3faf Clang: Use "clang" prefix plugin files
...for consistency and to avoid future file name clashes.

Change-Id: If595c8debfa1ceb01a1bb0ed34649fa513660503
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-30 11:04:07 +00:00
Nikolai Kosjar
6a1fc699fd Clang: Tests: Use google test dir from qmake variable
...so that we can compile the tests without environment variables:

    qmake LLVM_INSTALL_DIR=/the/path1 GOOGLETEST_DIR=/the/path2

Change-Id: I40633988d325720397dea28bd13b957a31712a9d
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-11-30 09:58:36 +00:00
Marco Bubke
a610c6740b Clang: Fix names for visibility changes in translation units
Change-Id: Iafee06b8f39610f4245ad86eec2b6d442acc61e2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-27 12:27:47 +00:00
Nikolai Kosjar
6cab8e6f4a Clang: Tests on MSVC2013: Disable warning 'unreferenced formal parameter'
Change-Id: Id3889a2529e5d816617806ade20323504e019384
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-26 15:34:34 +00:00
Marco Bubke
7ce9ef9db4 Clang: Integrate highlighting results from backend
Change-Id: I2c3fb69aabfe075bde76d63eafc2ca370f17493c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-26 15:19:27 +00:00
Nikolai Kosjar
216f110385 Clang: Tests on MSVC2013: Fix file name clashes
The following files conflicted:

	src\tools\clangbackend\ipcsource\translationunit.cpp
	src\libs\3rdparty\cplusplus\TranslationUnit.cpp

	src\libs\3rdparty\cplusplus\Type.cpp
	src\tools\clangbackend\ipcsource\type.cpp

	src\libs\3rdparty\cplusplus\Symbol.cpp
    src\plugins\clangcodemodel\symbol.cpp

Change-Id: If7865570cd70e39e25cc8d508f771c8023288f0c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-26 13:54:21 +00:00
Nikolai Kosjar
6687b60a99 Clang: Tests on MSVC2013: Fix string literal concatenation
Change-Id: I1b1cefbace16cf0161bfe522d2ac37704e374713
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-26 13:17:32 +00:00
Marco Bubke
8c3959534d Clang: Add current and visible editor message
Change-Id: Ifd88bc032388ae7a8d3dbc0f1f5746665074cc18
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-25 14:48:35 +00:00
Marco Bubke
9310c02bc8 Clang: Add better diagnostic sending
We send first the current editor, next the visible editors and the end
everything else.

Change-Id: I4a7b5924ffe563d6a74251739ddedcd005ce046c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-25 14:23:44 +00:00
Marco Bubke
2e499b73d6 Clang: Filter scope operators
Scope operators are not really user defined.

Change-Id: I1ab08dc3db7c39b98da02b6ef10bf78b75a6856d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-25 14:18:42 +00:00
Nikolai Kosjar
609bc2a389 Clang: Avoid needless reparse after first parse
Change-Id: Ie97818f29d1df61380cd1c22ef2598091050b10d
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-23 14:22:39 +00:00
Marco Bubke
bcd93b594e Clang: Extract highlighting information
Prepare the move of the semantic highlighting to the clang back end. We
have it under tests too so it should be quite easy to make changes or
corrections.

Change-Id: I5706a8a06fde5a9ba2eba3a8ba62782102ac0bd3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-17 12:41:37 +00:00
Marco Bubke
7fb4315da2 Clang: Adapt to new Google Test project directories
Google mock moved to github and merged with Google Test.

Change-Id: I66639532be1cd399c47dfd4511430b2d65b76b23
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-16 14:39:12 +00:00
Nikolai Kosjar
f7741ef63c Clang: Report only diagnostics that can be shown in the editor
Change-Id: I9c258159d240c6ba7eeff34702d8512d9220b3af
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-16 14:18:37 +00:00
Nikolai Kosjar
2ca473d59e Clang: Print command line args for debugging
...if qtc.clangbackend.verboselib=true.

Change-Id: Ibba408db955892daf055b2050d810ce55b9d8913
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:55:12 +00:00
Nikolai Kosjar
23fa5a7efd Clang: Provide the language option to the backend
Provide the language option (e.g. "-x c++-header") when registering a
translation unit for the editor.

Task-number: QTCREATORBUG-14787
Change-Id: Ie06f9fdab302f1b21ba72cdb65b6aabf9f7bc04c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:54:16 +00:00
Nikolai Kosjar
08fcb7f317 Clang: Filter out invalid diagnostic ranges
Apparently libclang might return invalid ranges.

Now we discard the invalid ranges. Since there is a diagnostic location
(in addition to ranges) the editor will still display an indication for
the user.

Task-number: QTCREATORBUG-15272
Change-Id: I351e136b9925a53fb2273a394e17873c5533798d
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:33:12 +00:00
Marco Bubke
250c8d662b Clang: Add UpdateTranslationUnitsForEditorMessage
If an editor is changing all translation units independent of their project
part they must be updated too. So we introduce a new message to update all
translation units with the same file path.

Change-Id: I70d0ea2bbca9fa880111ff7219573e54f3277026
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-13 14:03:11 +00:00
Marco Bubke
0eaa9f668c Clang: Improve diagnostic update timer
Start the timer after a translation unit change and stop after every
diagnostic is sent. We should decrease the interval as we are
sending the diagnostics because otherwise the sending is delayed to much.
If the file watcher is emitting a file change we should only react
to changes of files which have no editor open.

Change-Id: I5431b4bf6b4c0b825bfc74bb9c697bb2d198fa26
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-13 11:56:51 +00:00
Marco Bubke
b8a9e85880 Clang: Don't set a translation unit dirty if the main file is deleted
If a file is deleted the translation unit should be not updated. It will be
later removed anyway.

Task-number: QTCREATORBUG-15070
Change-Id: I40c9c70629dab1d35b713d54442ffdbb2df3db43
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-12 15:49:07 +00:00
Marco Bubke
a4917d3fdd Clang: Disable logging by default in unit tests
Change-Id: I489cec1dcbcfba71dfa6679e8d90bbf8c8d0a867
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-01 13:04:59 +00:00
Nikolai Kosjar
f1300df6b3 Strip BOM from files
Change-Id: I9167c016760fe1e8378cdf84144c4bed5cd4e57c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-01 10:51:10 +00:00
Nikolai Kosjar
1c7fb225db Clang: Add one more test for SendDocumentTracker
Ensure that the document is not send with initial values. In that case,
the document was just loaded and has not any modified content yet.

Change-Id: I67ee8dcffe20779ef8294cf2668d0974b44f5bbb
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-30 14:44:09 +00:00
Nikolai Kosjar
a7928b4b0b Clang: Integrate clang's fixits as refactoring actions
They are invokable by the usual means (Alt+Enter, editor's context menu
> Refactor) plus by the context menu of the editor's left margin for the
related line.

The fixit text comes directly from libclang and is thus not translated.
We modify the text slighty by stripping the diagnostic category prefix
("note:", "error:", ...) and capitalizing the first letter.

A follow-up change should properly indicate available refactorings with
a refactoring icon in the editor's left margin.

Task-number: QTCREATORBUG-14868
Change-Id: I86157c9f824d2a9dedf19087476d02ad1e6cc854
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-29 11:39:21 +00:00
Nikolai Kosjar
de6d7f0617 Clang: Refactor handling of diagnostics
...by introducing ClangDiagnosticManager and the helper class
ClangDiagnosticFilter.

ClangDiagnosticManager will get more state in a follow-up change.

Change-Id: Id2c312bc897ea41ed67292b56b24dcfb7975ff4a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-29 11:38:53 +00:00
Marco Bubke
b412eb81ea Clang: Add revision and completion management
Reparsing a document is expensive so we should avoid it by all means. In
this patch we prevent that the same document is send again. It isn't send
too in advance of a code completion if there was no changes before the
the completion position.

Change-Id: I0bb786ba1d4e7ce08611a518cb32f8cf8f4d0037
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-28 15:46:15 +00:00
Marco Bubke
7eee8061f6 Clang: Add unsaved files messages
We have auto generated buffers from ui files which are not open but have no
file representation. So we need to provide them as unsaved files only.

Change-Id: I48a426c18e06eeda2fa707864f32f293e17ac651
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:02:19 +00:00
Marco Bubke
6e14eb6940 Clang: Rename ForCodeCompletion in ForEditor
It reflects that the translation units and projects have a tied
relationship with an editor.

Change-Id: I3c01d5776980fe079af1fdef82feded83fdf5463
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:02:02 +00:00
Marco Bubke
8ad7616420 Clang: Reparse for removed files too
Change-Id: Ibe8a3fa46bead6018a4279c3a270cb2535a7b296
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:01:43 +00:00
Marco Bubke
053e9597af Clang: Fix CodeCompletionsExtractor.BriefComment test
Change-Id: Ic01f3c361a5c81cfb96c51d6111ed6d589a76563
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:01:37 +00:00
Marco Bubke
0267f2861d Clang: Send the diagnostics delayed
Change-Id: I6065e51d38c262cf59d977c11c6453dec85a6dfe
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:01:18 +00:00
Marco Bubke
aa300e363f Clang: Adds needs reparsing test
Change-Id: Id58a831ac7ae389f225e3eac5d376dbf78a07772
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:01:10 +00:00
Marco Bubke
f2b7371af1 Clang: Reparse only if files are changed
Includes are now watched by a file watcher. Unsaved file changes are
watched too. If they are changed the translation units which depend on
them are set to a state which require a reparse. Later the diagnostics
of this units are collected and send back to creator.

Change-Id: I2fb5c7dd6644687f22399edd8d18edd6215c9505
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:00:07 +00:00
Marco Bubke
aa6aaee510 Clang: Add brief comment support
Change-Id: I5af23b6694d3d0bf45ed0a30b4d91b350f0515df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 14:59:50 +00:00