Commit Graph

47 Commits

Author SHA1 Message Date
Marco Bubke
2349b13ae5 Clang: Rename HighlightingInformation to HighlightingMark
Change-Id: I3954c7c9abe593ea04092337f48ac2b153e883ba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-07 12:06:40 +00:00
Marco Bubke
7984e928d1 UnitTests: Rename CLANGBACKEND_TESTS in UNIT_TESTS
Change-Id: I26635a0c85edcc90cdffb93d3f9ae4ad4c8cb98e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-17 14:57:53 +00:00
Tobias Hunger
36118a5cb0 ClangBackend: Fix warning about unused member variable
Change-Id: I0608eb32f77bb677f1fecc1c75082ecf29ff1aa8
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-12 10:40:57 +00:00
Marco Bubke
974070d2c8 Clang: Use MessageEnvelop instead of QVariant
QVariant has unwanted dependencies so we provided our own simpler solution.
We want to support move only types and calling the copy constructor as you
move the value in and outside. This copying is adding unwanted overhead
too.

Change-Id: I2e27a7924868efe81e8b8ff3415499c9fa22c2bc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-08 14:11:44 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00
Nikolai Kosjar
8d6549fa74 Clang: Correct member access operator if possible
1 struct Foo { int member; };
 2 void f(Foo *foo)
 3 {
 4     foo.<REQUEST COMPLETION> // correct '.' to '->' and provide results
 5 }

The preferred approach would be to check if "foo" in line 4 is of
pointer type, but there is no suitable cursor (only CompoundStmt) at
that position since the code is usually not yet parsed and thus invalid.

Thus, just run the completion as is. If there are not any results for a
dot completion, re-run the completion with "." exchanged by "->". This
approach is inherently slower than the preferred approach implemented in
the built-in code model.

The following rare cases are not handled:

 1) Requesting completion after white space:
      Works: foo.<COMPLETE HERE>
      Fails: foo. <COMPLETE HERE>

 2) Opening a file and requesting completion (ctrl+space) without prior
    editing. No editing before triggering completion means that no
    unsaved file is generated on the backend side, which is a
    requirement for the correction.

Task-number: QTCREATORBUG-11581
Change-Id: I6bc8e8594778774ab342755fdb01a8a3e5c52ba0
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-01-19 13:20:35 +00:00
Yuchen Deng
fc6a0c68a6 Clang: Clangbackendipc build fix
Change-Id: I750521cca5e101e679b79cf45f995f5cca8f07bb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-01-05 05:15:24 +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
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
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
5f29a00c89 Clang: Change temporary directory for clangbackend
This is meant to

  1. Work around a libclang bug on Windows (not deleting preamble files)
  2. Delete left-over preamble files in case of a clangbackend crash

The temporary diretory will be removed on Qt Creator exit.

Task-number: QTCREATORBUG-10988
Change-Id: Ia5837c2a6ab2d55366d167dd591d87faaededf3e
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-01 12:24:55 +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
7874d61998 Clang: Enable not exporting symbols
Having a dllexport in the sources for a TEMPLATE=app project (e.g.
unittest.pro) will create a library on Windows, which is not needed.

Change-Id: I1ebdd8b5ada06965c3dd89074ac2bc6dff09299c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-26 13:56:50 +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
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
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
be1e0f7ec0 Clang: De-duplicate in Messages::registerMessages()
Change-Id: Id3c73249f562abd89de8e76290ea712c2fe7fae1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-19 09:21:21 +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
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
87baaee78d Clang: Add environment variable to disable alive timer
Change-Id: I558ff0fe83cce9ee921819c6fd9c18534fad9bcf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-21 13:28:45 +00:00
Eike Ziller
fb73a87033 Clang: Fix compilation on OS X / clang
Change-Id: I7cc5738971b00dfcf012584d4b51f86914ec874b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-01 10:28:41 +00:00
David Schulz
d5c29ada95 Clang: Add QDataStream includes to ipc container.
Change-Id: I6f73a1daa3e8b934896ceb6fd0c1185e24d60236
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-01 05:45:35 +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
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
Marco Bubke
ec4d002857 Clang: Rename command in message
Change-Id: I1e2671d15b0db3c670b86dd0d4bed5ee09e866f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-25 12:54:27 +00:00
Nikolai Kosjar
db3dc92202 Clang: Clarify stdout/stderr prefix of backend
Change-Id: I936e75ddc26b812c4570859e6a61c2a09590ed98
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-29 08:53:37 +00:00
Nikolai Kosjar
b783bcea60 Clang: Allow to time high-level functions
...by enabling the logging rule:

    qtc.clangbackend.timers=true

Change-Id: I085c6bbebc0343b74bcb90119d1ebb80ad49518d
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-29 08:53:24 +00:00
Nikolai Kosjar
e4748fe801 Clang: Typedef some often used types
using CodeCompletions = QVector<CodeCompletion>;
using CodeCompletionChunks = QVector<CodeCompletionChunk>;

Change-Id: Id729a43566c23dc000e44d79ccf4a49e4f235f51
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-23 11:48:26 +00:00
Nikolai Kosjar
b4464d8f4b Clang: Shorten debug output
...by writing unsaved file content and project part arguments to
temporary dirs.

Change-Id: Ic411700cb3da756788bbb315851ff38b0100fe71
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 09:58:34 +00:00
Nikolai Kosjar
09ce021627 Clang: Fix command name for QDebug
Change-Id: If29a41aaefeda725965a85f0c7ff47124e2a23c7
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-17 11:33:33 +00:00
Marco Bubke
5df8085529 Clang: Remove the hint and snippet field from the CodeCompletion
It is not used and is producing overhead.

Change-Id: I1398b18a40c0f5c0b90fe4c058996d7eb109f9f2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-16 12:54:58 +00:00
Marco Bubke
89bc1fc4c4 Clang: Rename filePaths in ids
UnregisterProjectPartsForCodeCompletionCommand is using them as ids
and not as file paths.

Change-Id: I13a82c1995c60bdb60c72f4fd794aa354fcbb4ef
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-15 08:57:42 +00:00
Nikolai Kosjar
b2ec03c74c Clang: Fix potential infinite loop
Change-Id: I373a652db8811b0ebb416f5914aa4af12a23a3c9
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-02 17:06:46 +00:00
Christian Kandeler
028709876a ClangBackendIPC: Fix qbs build on Windows.
Change-Id: I3dee9256cf9b49b3a5651d8534aec630c2d1ae5d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-30 08:48:49 +00:00
Nikolai Kosjar
2eb3bda5a8 Clang: Indicate lines from ClangBackEnd
...with a prefix.

Change-Id: I6e23e00254d7b7316057514d1234cde66ab44a0d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-26 07:56:44 +00:00
Marco Bubke
0e0f8b318e Clang: Filter out connection errors
The connections server needs some time to start and so the first connect
can be fail. Don't print an error in that case.

Change-Id: I38fe5401cd47a4ad1a552dcbdfafcc851e5dd7cf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-25 13:08:03 +00:00
Christian Stenger
83957912fe Clang: Fix compilation with clang
Change-Id: I7c81e5d06564c43fb6ac2ee5d538ad6b7565c73c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-24 11:32:38 +00:00
Nikolai Kosjar
b105917b97 Clang: Quote project part arguments for easier debugging
Now we can copy paste to the shell and make tests there more easily.

Change-Id: Ic17ea23c4040583ba3af9e60ae73b242a574ab9b
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-06-24 10:22:27 +00:00
Nikolai Kosjar
5d51bd9324 Clang: Ensure end command is send before waiting for process finish
This reverts

    CmbIpc: Remove workaround
    287a263083

since the bug still exists. However, we use waitForBytesWritten()
instead of QCoreApplication::processEvents() since this seems to be fine
(QAbstractSocket::waitForBytesWritten is not called on Windows).

The bug was:
 1. Open a bigger project, like qtcreator.pro.
 2. After 2 seconds, quit it.
 ==> The Qt Creator window is gone but the Qt Creator process waits
     until the clangbackend process is finished.

Change-Id: I25c475d2a6db94a1c3a8d827a41f8c0b2624eaea
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-06-24 10:03:26 +00:00
Orgad Shaneh
3ea517636f ClangBackEnd: Fix another operator<
Missed in 2fc604e699

Change-Id: I520cff39f806213b92f5f49bd8d22153ecdfe62b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-18 07:50:57 +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