Both completion kinds have the same name. Do not merge them
together when looking for constructor overloads.
Task-number: QTCREATORBUG-21010
Change-Id: I4c851033d63ad4e242b6179491f1fba00af466f6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
With recent clang versions we can show default arguments properly.
Change-Id: I6028db183b0413650a32928d0051afb9402c5e32
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* It's skipped / must be rewritten.
* It does not belong to ClangCodeCompletionTest
Change-Id: If6708d28602cc8c3478a968b87bae542ae859590
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Last use was eliminated with
commit b6e12f4a1c
Convert macros from plain QByteArray to a vector of structs
Change-Id: I512524839199bc5c8b64f739636e9caebc37c7d0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
The old code model expected the macros as C++ formatted text
("#define Foo 42) but newer targets like the Clang codemodel expect key
value arguments like "-DFoo=42". So instead of parsing the text again and
again we use an abstract data description.
Task-number: QTCREATORBUG-17915
Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
We already share same classes there which has nothing to do with IPC and
I want to more for sharing. So we should use a name which fits better.
Change-Id: Idfb12b6de714206117b92634ad719c6a0e290e78
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This should have been adapt in
commit 33a2288c7d
Clang: Fix extra space before left paren
Change-Id: I68fe7cbbdcb9432a7dce6aede00a3190cce1cd4d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This reduces the overhead when a new message needs to be added.
Change-Id: I5bb2833af2f06f2a8e101cfb03f75ffc2927bf68
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
For "foo(|" [1] we requested a completion from libclang with the cursor
position just before "foo" and then filtered the function declarations
for functions matching the name "foo". This worked fine for ordinary
functions, but obviously not for constructors and functors.
Recent versions of libclang support proper function call completion with
XCursor_OverloadCandidate, so make use of that.
[1] '|' represents the cursor position
Task-number: QTCREATORBUG-14882
Task-number: QTCREATORBUG-14884
Change-Id: I9d31b3960ccff6a8b9440dbcb7ff9f5ca9f61266
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This allows to start Qt Creator in batch processing mode:
$ export QTC_CLANG_BATCH=/path/to/file
$ export QT_LOGGING_RULES=qtc.clangcodemodel.batch=true
$ ./qtcreator -load ClangCodeModel
The batch file will be executed and Qt Creator will exit. Advanced
logging output can be activated as stated above.
Note that it is required that the project was already configured/set up
properly with the used settingspath, otherwise the wrong configuration
will be taken or a pop-up dialog will block the execution.
A small example follows that covers all the understood and so far needed
batch file commands in order to train libclang for profile guided
optimization. ${PWD} expands to the directory of the batch file.
openProject "${PWD}/calendarwidget.pro"
# Initial parsing
openDocument "${PWD}/window.cpp"
closeAllDocuments
openDocument "${PWD}/window.cpp"
# Reparse
setCursor 478 1
insertText " "
insertText " "
insertText " "
# Completion
complete
complete
complete
# Member completion
insertText "comboBox->"
complete
complete
complete
# Wait in order to inspect the result
processEvents 3000
Change-Id: I7dc5dddc6752272ecc2fb4f30497b17cee3f9a9f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This reverts commit 07f4ae6227,
which broke compilation
clangbatchfileprocessor.cpp:170:27: error: ambiguous overload for
'operator==' (operand types are 'const QChar' and 'char')
and only worked in QT_TEST=1 cases.
Change-Id: I089427359958221882cb4e4369c4b88d71779acf
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This allows to start Qt Creator in batch processing mode:
$ export QTC_CLANG_BATCH=/path/to/file
$ export QT_LOGGING_RULES=qtc.clangcodemodel.batch=true
$ ./qtcreator -load ClangCodeModel
The batch file will be executed and Qt Creator will exit. Advanced
logging output can be activated as stated above.
Note that it is required that the project was already configured/set up
properly with the used settingspath, otherwise the wrong configuration
will be taken or a pop-up dialog will block the execution.
A small example follows that covers all the understood and so far needed
batch file commands in order to train libclang for profile guided
optimization. ${PWD} expands to the directory of the batch file.
openProject "${PWD}/calendarwidget.pro"
# Initial parsing
openDocument "${PWD}/window.cpp"
closeAllDocuments
openDocument "${PWD}/window.cpp"
# Reparse
setCursor 478 1
insertText " "
insertText " "
insertText " "
# Completion
complete
complete
complete
# Member completion
insertText "comboBox->"
complete
complete
complete
# Wait in order to inspect the result
processEvents 3000
Change-Id: Ib30526036f999e530f0c01d42a196a1e311e2c4c
Reviewed-by: David Schulz <david.schulz@qt.io>
No need to require the project managers to do this. Also, it is easy to
forget.
Change-Id: I96f7a5e5547418678af9653e5753c372f0880e5a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Feeding libclang with unsaved files (e.g. in-memory generated ui_*.h)
that do not exist on disk leads to regeneration of the preamble on every
parse/reparse/completion and thus renders the clang code model useless.
We could check the existence in the file system for every unsaved file
just before every parse/reparse/completion. Obviously this does not
scale (e.g. qtcreator.pro generates about 200 unsaves files) and would
also slow down the responsiveness of the completion, especially for the
dot-to-arrow correction case.
We could also set up a file system watcher. However, implementing the
"file got created" case is not trivial because QFileSystemWatcher does
not support it out of the box.
Instead, set up a custom include directory and create empty files in it
that represent the unsaved files and pass that include directory to
libclang as the last one. While this fixes the performance problems, it
also comes with at least two problems:
* Because ui_*.h files are "relocated" to the same directory, two or
more "foo.ui" in the same session will be problematic.
* Because of the custom include directory, problems might arise for
projects that include the ui_*.h as "some/relative/path/ui_foo.h"
instead of "ui_foo.h". This should be the less common case.
Task-number: QTCREATORBUG-17245
Change-Id: I6e40e87c3ef095086eb22c972dd8c1a6459a8245
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
The messages
RequestDiagnosticsMessage
RequestHighlightingMessage
and
DiagnosticsChangedMessage
HighlightingChangedMessage
are always send/received together, so merge them into
RequestDocumentAnnotationsMessage
DocumentAnnotationsChangedMessage
Change-Id: I6a0b6281ed1e6efe6cb18386afe99b1d1fb58abf
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Might fix a fail on loaded test machines.
Change-Id: Ieb9e8426f760e2257ececa0b53c564d68992c3fa
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
If there are no completion items, do not add snippets since these will
otherwise pop-up at undesired positions, e.g. when:
1) Typing float/doubles: 0.
2) Typing file suffix in include directives: #include "stdio.
Task-number: QTCREATORBUG-16188
Change-Id: Ie1c29826dc62dc447b2ff57b0c5537eb9d9511ef
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
For unit test we need to break every dependency to the TextEditor
Widget etc.. With an abstract interface we can implement it in clang
without relying on unwanted dependencies. It makes it also easier to
compute the values deferred.
Change-Id: I1b313a1625f4e80bd324ab4bf1a7c4f6b690abe9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
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>
Also extracting inline HeaderPath class and change projects list in vector
because the size is larger than a pointer.
Change-Id: I885fdff3fe9bccc877634d1615249755f5b674fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
...in the function call completion tooltip.
Task-number: QTCREATORBUG-15286
Change-Id: Ie24576f98ee4ba8f954de394f3596093323a2c35
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This removes also the need to close editor documents.
Change-Id: I96c68105bceb37841053f3dbd8a264e059a02cb8
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
We reparse first the current and then the visible translation units before
we reparse all other units.
The signals connections are queued to wait for the visible editor update.
Change-Id: I5e2b8bc80568450268ca24e26720b3f5af640995
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Related to
commit c47079f97f7d42db0c581525a2ce6fddbc0995f2
Clang: Activate the code model with a check box
Change-Id: Ief11768ba0dd27788032e2dd3ad9b7ae39a8f52b
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Register the translation unit and request diagnostics from the
clangbackend as soon as the project part is determined. There is no
reason to wait until the parser is finished for the highlighter.
Change-Id: Iebccbf59ebd205389462dcee97363746fb651bb2
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Same test as the first version, but without having the header open in
the editor. This one is also skipped since we can't make it reliable
without adding extra messages.
Follow up changes will improve the names of both tests and will make
them both reliable so that the can be activated again.
Change-Id: Ie3ca52e01aedd612bc07e7429dd64d92eb1a23b5
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
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>
Ensure that first the editors unregister with the removed project part,
then unregister the project part.
This makes testing and following the message logs easier.
It also fixes the following race condition:
* Unload project of opened file
* Immediately close the editor before a new project part is calculated
==> The editor is closed, but the translation unit is not properly
unregistered.
Change-Id: I618930d221323435ba60ac6c051380bccc9fdaf1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
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>
The integration test has to be rewritten!
Change-Id: Id06f9a3ceb54cf6836f4ca1a745e20fefc6a5391
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>