Commit Graph

28 Commits

Author SHA1 Message Date
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
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
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
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
d8ba9fa972 Clang: Check in translation unit if the file exists
We get in crashes in clang if we not check if the file exists.

Change-Id: I78a20507db6403247c02f8c1e69cd872e3e8f774
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-12 15:32:13 +00:00
Nikolai Kosjar
210228da1f Clang: Whitespace fixes in translationunit{s}.cpp
Change-Id: I6e9f479023f0993df365b4e2f0d71539e962c278
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-01 12:59:05 +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
Marco Bubke
88b167c5da Clang: Fix premature reparsing
cxTranslationUnit() is starting a reparsing if it is needed so in the best
case it is useless. But it can be maybe harmful if the translation unit
isn't already created.

Change-Id: Ie733edac58ab8f7eccb1611ca1554209f8aa8718
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-30 11:54:46 +00:00
Marco Bubke
a7e3c07580 Clang: Update includes after reparsing
Change-Id: I783cc0b536f880ce736cddf530f0363691cd6e77
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-03 12:01:07 +00:00
Marco Bubke
74e24084c8 Clang: Workaround for clang bug to gather inclusions
We have to revert it if the fix is going in.

Change-Id: I28418e6c7cf6c40afdb5025eb1a52c13a0aa1302
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-03 11:56:47 +00:00
Marco Bubke
d041a79a18 Clang: Fix some warnings
Change-Id: I73c432e5fe834ce199204c49b1e0afe43ae605ac
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-03 11:56:05 +00:00
Christian Stenger
e10ba2e289 Clang: Fix missing includes and compiler warnings for MSVC2013
Change-Id: I88d371a5997576bfd29aedc38353df9ea3a3faeb
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-01 07:22:46 +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
d4976e1109 Clang: Avoid double reparsing
The document is now always reparsed after a change.

Change-Id: Iad1d9f78d98f75d5e873de35ac487a8dabc4fc4e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:00:48 +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
Marco Bubke
b278dc87ca Clang: Add diagnostics
Diagnostics are now moved to the clang backend process. Fixits are
supported too.

Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 14:59:16 +00:00
Nikolai Kosjar
3b314e50c8 Clang: Suppress printing diagnostics by default
Triggering completion happens often on invalid code, which leads to
diagnostics from libclang. Suppress those by default, but allow to
inspect them with the logging category:

    qtc.clangbackend.verboselib=true

Change-Id: I802ae58fe1b5244f3228ee73a181ea362de20608
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-29 08:53:18 +00:00
Marco Bubke
b3113bbbc6 Clang: Reparse always before you complete the code
There are two ways to hot fix the dependency problem. First version is to
disable the caching(not the preamble) but it is triggering bugs. Second 
version is to enable caching and reparse before every complete. I opted
for the second version because it is the commonly used path for most
implementations. Later we have to minimize the reparse calls but for that 
we need the cooperation of editor.

Change-Id: I878afb896cbf2338cbeb13d9e596a7776dd49854
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-23 09:08:28 +00:00
Marco Bubke
568d7e7c7d Revert "Clang: Reparse the translation unit for unsaved file changes"
We reparse before every code completion so this code can be removed. We
will reuse some of it later.

This reverts commit 2443f18b85.

Change-Id: Ifcadfaa09b87ce5b58bfe5fe3cbaa2a86a59c5a6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-23 09:08:19 +00:00
Marco Bubke
2443f18b85 Clang: Reparse the translation unit for unsaved file changes
Change-Id: I49711ce040a995f193d36961e010decc27c34c4c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-17 09:08:08 +00:00
Marco Bubke
f9899c2da8 Clang: Little speedup for code completion
...by ensuring that the precompiled preamble is created.

Change-Id: I80784b6a79c40a7e452530e8288783f33f881efc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-15 12:20:59 +00:00
Marco Bubke
65c867db3b Clang: Remove option for code completion
Completion should be faster and the test are still running.

Change-Id: If663e80ce349547b0948412e52b9bf4f76cbb011
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-13 10:30:55 +00:00
Marco Bubke
2b84d7611b Clang: Reorder includes
Change-Id: I324e88c0d295114390c1fac2745c0d2d47637ece
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-16 13:53:30 +00:00
Marco Bubke
1402c067b1 Clang: Rename CodeModelBackEnd in ClangBackEnd
Change-Id: I13e8a458634110456375956d4d4da7239c86957f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-16 13:29:27 +00:00