We always use one client and the dispatching is removing to possibility
of moving commands. Moving the client to IpcServerInterface improves the
code sharing.
Change-Id: I5f102ab7907239572534b7d4c2848abbaade69b6
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
We want to reuse the connection client in other plugins. This is the first
step, the next step is refactoring the IPC mechanismn and move it up to
the IpcServer- and IpcClientInterface.
Change-Id: I6eb6db1e9bc18232c8df350a6303afd2edc68da8
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
The connection client can block main thread at start up. This patch is
removing the wait functions and using signals instead.
Change-Id: I847c98b095752f6a875c0365bc27361bc5bdd051
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
The fixits have own ranges/locations and thus might address more than
one file.
Change-Id: I5ee59944bef588e763a91f054a60823593373a0e
Reviewed-by: David Schulz <david.schulz@qt.io>
We get different mangled names on windows and unix. As we do not
actually use the mangled names and to reduce the maintenance for this
test accept any mangled name, as long as it is not empty.
Change-Id: Id154da430db6958eb40e5b409e5fb186778d41c1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
libclang 3.8 seems to be sensitive to file paths separators [1]. On Windows,
this led to not updated document annotations and/or crashes after reparsing.
When passing file paths to libclang, convert to native separators.
When getting file paths from libclang, convert back.
This handles:
* main file path
* file paths of the unsaved files
* -I<DIR> arguments, the resource path (for builtins) and the paths to the
wrapped qt headers
* included header files from libclang
* source locations from libclang
Also, minimize the conversion in SourceLocation to a minimum by making
filePath() lazy.
[1] https://llvm.org/bugs/show_bug.cgi?id=28381
Change-Id: If5866f34a6fdc6b34b16c022d3988e8e6eae2a0a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
We want to share more functionality of the IPC mechanism and for what we
need more interface classes. But we use this names already for the
ClangCodeModel implementation. So we rename the them to ClangCodeModel*.
Change-Id: Ie320e0d3b993586a9bcc6a5aa0d32427af41202e
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
The issue was re-producible with e.g.:
void g()
{
// Type 'foo.' as fast as possible in the next line
}
This led to "foo->" with completion results as if there was no "foo." at
all in that line.
We relied on a correct position for
translationUnit.sourceLocationAtWithoutReparsing(), but the just typed
characters were not yet reparsed. And we do not want to reparse at that
point since takes too long. We already determine the utf8 position for
the dot character, so simply use that instead.
This completes commit 17c1325cc4.
Change-Id: I669888b5c17ee63b2aec7b16c9921f9d79e281f9
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
The test data produces different results when it is run with libclang
3.6 and libclang 3.8. (lib)clang 3.8 will generate an error instead of a
warning and suppress further diagnostics. See below.
Use simpler test data that is agnostic to the different clang versions.
$ cat input.cpp
class X {
X(X&&) noexcept;
};
X::X(X&&) = default;
int function()
{
}
$ clang++-3.6 -fsyntax-only -std=c++11 input.cpp
input.cpp:5:4: warning: 'X' is missing exception specification 'noexcept'
X::X(X&&) = default;
^
noexcept
input.cpp:2:5: note: previous declaration is here
X(X&&) noexcept;
^
input.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
2 warnings generated.
$ clang++-3.8 -fsyntax-only -std=c++11 input.cpp
input.cpp:5:4: error: 'X' is missing exception specification 'noexcept'
X::X(X&&) = default;
^
noexcept
input.cpp:2:5: note: previous declaration is here
X(X&&) noexcept;
^
1 error generated.
Change-Id: I6d786a8b87eb4438fa8db36540db9358181b9a5b
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
There are some compiler problems and before I change the code I want to
investigate them deeper.
Change-Id: I497aa594fe0ea67be5927cc75bf6d64158952663
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
The position of the dot character was determined on an outdated
translation unit.
We queried the translation unit for the source location of the dot
character, but apparently clang_codeCompleteAt() does not update the
source locations for the translation unit. And we do not want to reparse
since this is expensive. Thus, determine the byte position manually by
scanning over the document until the right line/column is reached.
Change-Id: I25e256bb81a83bb71c7e46a0fb3e927bf4031b16
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Remember whether clang_parseTranslationUnit() or
clang_reparseTranslationUnit() failed the last time and do not trigger
parse/reparse again.
Also, check whether the main file exists before reparsing.
Task-number: QTCREATORBUG-16051
Task-number: QTCREATORBUG-16140
Change-Id: Ied39e66a18032854911229898573941fe2ada35b
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
...that ocurred for e.g. "foo (<COMPLETE HERE>".
We did not handle the following cases:
1) white space after the function name
2) nothing before parenthesis
Change-Id: If6aedd2cc938df30516e13a860d07d7a509633ae
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
When using stdlib (default on Linux) and compiling with "-std=c++14", errors
like the following occurr. Avoid them by not requiring c++14.
$ clang --version
Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ cat clangtest.cpp
#include <random>
$ clang -std=c++11 -fsyntax-only clangtest.cpp # Fine with c++11/stdlibc++
$ clang -std=c++14 -fsyntax-only clangtest.cpp # Ops with c++14/stdlibc++
In file included from clangtest.cpp:1:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/algorithm:62:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:65:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/random:39:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
using ::gets;
~~^
1 error generated.
$ clang -std=c++14 -stdlib=libc++ -fsyntax-only clangtest.cpp # Fine with c++14/libc++
See also https://llvm.org/bugs/show_bug.cgi?id=18402.
Change-Id: I2ab3ea837b80196b51d8816ee8aa26a4a531e939
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
We are adding declaration detection for function to the highligher on
user request. Other declaration will follow in separate patches.
Task-number: QTCREATORBUG-15564
Change-Id: I54e97c26425f8d6e9854547d50a9ac8fa076b4e8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Test that local, argument and member variables are highlighted
correctly when referenced inside a lambda
struct LambdaTester
{
int member = 0;
void func() {
const int var = 42, var2 = 84;
auto lambda = [var, this](int input) {
return var + input + member; // All variables here
};
lambda(var2);
}
};
Change-Id: I3b7b86c57a91f0f254715770dd870033be928b28
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
We already had this workarounded, but it got lost in the refactorings.
Task-number: QTCREATORBUG-12067
Change-Id: Ie01f9d41f25d17d1b595204748634bc87ef44378
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
There is implicit knowledge that the reference is read only in the code
so we should honor that and make is explicit.
Change-Id: I0d6eab6595ae1414ad2607760a2e02fd49bafd72
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
void func() {
const int var = 42;
auto lambda = [var](int input) { // var is not highlighted
return var + input;
};
}
Change-Id: I95a5732ab8391e1232894e419b081c729e2d1ba1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Sometimes you need a very small array which has a size and max size.
QVarLengthArray is simular but has some size and run time overhead and it
has no max size. It will instead malloc. So this array is for very small
collections under 256 values which never allocate and have only a size
overhead of a byte.
Change-Id: Ia392c750d566c4accc6077c3dc4d9d4ae501e599
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Perf is not producing reliable stack traces without.
Change-Id: I5f594d45b06a66d91b0c687937dd948d6c724c62
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
SmallString is a very simple utf8 string class. It's purpose is performance.
It uses a short string opimization which provides 31 bytes of heap free
memory to save a 30 bytes long string plus null terminator. If the string
gets larger heap is allocated. The grow strategy is 1.5 to improve reuse
of allocated memory.
It uses optionally constexpr to provide string literals.
Change-Id: I7757fb51abfeca200d074cbfce2f1d99edc0ecb0
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
...by introducing a custom tooltip widget for diagnostics.
Locations and fixits of child diagnostics are presented as clickable
links, leading to that position in the editor or to the execution of
that fix it.
Change-Id: I83e801e22d0421dd29275e333e5dd91587885cf1
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
We used to call QTextCharFormat::setToolTip from the ExtraSelection to
install the diagnostic tooltip. Since this allows to set only text
tooltips and we would like to introduce a custom tooltip widget for
diagnostics, make use of CppHoverHandler, which is more flexible.
Change-Id: Ia1b2c3c50810596ce4a3a025002e6e4efd8789db
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
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>
...by explicitly checking for the dot in the source.
Task-number: QTCREATORBUG-15654
Change-Id: I4172e88a7fbb3015ef391daf13ded1f0002aab9c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>