If we use paths with spaces we cannot split them anymore so we have to
handle unix and windows differently.
Change-Id: Ibfc8c51cfe2ecd68e913ad84e0e1269eb7eeda02
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Extract common stuff into the base class ClangException
* Remove unused exceptions TranslationUnitParseErrorException and
TranslationUnitReparseErrorException
* Do not send error messages to the Qt Creator side. The messages were
only generated when the backend crashed and while it was not yet fully
re-initialized (e.g. do code completion right after crash where the
document was not yet registered at the backend).
Change-Id: I91d98d5ef681ad487f7a2fd66f78fa7cd1e958df
Reviewed-by: David Schulz <david.schulz@qt.io>
The "TranslationUnit parts" moved already to TranslationUnitCore.
Change-Id: I2bea7847e2b3e84fbfacc3d2dc43f180873349ac
Reviewed-by: David Schulz <david.schulz@qt.io>
We don't want to disable RTTI in unittest so we require to compile them
with RTTI. You can disable yourself RTTI if you don't want them for some
reasons.
Change-Id: I76d05a36442305f379ce3d88b3f6ed4372127002
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
If you have no LLVM installed it was impossible to compile the unit test.
But some unit test don't depend on LLVM. With this change it is now
possible to compile them.
Change-Id: Iac0c1b3cdf6c317e6ba4755acd5f8458db5a7451
Reviewed-by: David Schulz <david.schulz@qt.io>
Prevent operator selection to be ambiguous.
Change-Id: I1ff0d6aad8fe5ce24b0d1038c1b6121a595800fe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
CXCodeComplete_IncludeBriefComments has to used if the translation unit
is using it too. Otherwise an assert is triggered.
Change-Id: Ia252ffd9c440144f21c2354c6885f7ae73de4b29
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
It was bumped to 14 in merge commit 1853f01a, due to a conflict in
unittest.pro which I confused with qtcreator.pri.
Change-Id: I1ec15d9d20d90c38849eea799a724f4c85fe36b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
We move the io operators in an extra header file because if we would
include ostream in smallstring.h we would blow the compile time.
Change-Id: Iea61ceedbbbcdd2adc6dc149794dab6e743084f8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
... and remove all instances that became redundant now.
this excludes everything that comes from outside qtc, or looks like it
could "leave" it.
Change-Id: Idc8baad17cd1ffdc5e160ec48ea3292d633a2562
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Speed ups the typical use cases that can profit from this:
* Change a header file and switch then to source file
* Open documents one after the other (Follow Symbol)
* Change documents visible in splits (e.g. by refactoring action)
* Restore a session with multiple splits
Fixes the test ClangIpcServer.GetCodeCompletionDependingOnArgumets.
Change-Id: Ia575bd59780df14146dfc091a4d48794e4a0543d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Extract TranslationUnitCore, which is the API for the high-level
operations we need. TranslationUnit does not call any clang_* functions
anymore, except the one needed for disposing the CXTranslationUnit - for
now, we keep TranslationUnit the owner of TranslationUnitCore.
TranslationUnitCore will be passed on to the worker threads.
With this, the current "TranslationUnit" looses its meaning. We will
rename it to "Document" in a follow-up change.
***
TranslationUnit::cxTranslationUnit does not implicitly
creates/parses/reparses anymore. We use more verbose update operations
now.
The test ClangIpcServer.GetCodeCompletionDependingOnArgumets fails now
because of this - CodeCompleter::completeHelper() does not recreate the
translation unit anymore, thus working on the old data.
This will be addressed in a follow-up change.
Change-Id: I6213d6f1609cd3c9a54666c84cb8b623b2fefe1c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
...in preparation for concurrent processing of documents.
Parsing and reparsing is handled by TranslationUnit. Since we will do
this in a different thread, extract the core logic into the new class
TranslationUnitUpdater, so that we can prepare the necessary data for
the run and then later incorporate the results of the parse/reparse.
Change-Id: Ic9d936d193ee6795a755f0cfc38c0b2a7bd402cc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Make the necessary data implicitly shared since it might get
accessed/modified from two different threads with follow-up changes.
This applies for UnsavedFiles/UnsavedFile and ProjectPart::arguments().
* Avoid returning references.
Change-Id: I98842c1cb90ae0d344a15c63b72cbc89568722d3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Assertion failed: IncludeBriefComments == this-
>IncludeBriefCommentsInCodeCompletion, file C:\dev\src\llvm-381\tools
\clang\lib\Frontend\ASTUnit.cpp, line 2337
Only occurs when linked again a debug llvm.
Change-Id: I6a37875fe95852ee2afcef7f6b6b38e9669a6584
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
In TDD development is a standard advised that you setup you values in the
block, run what you want to test in the second and assert in third. We
should try to stick it because it makes reading the test easier.
It is advised too put the setup code after the test if possible.
I used const QList<QByteArray> inputChunks = {"hello\n"} instead of
const QList<QByteArray> inputChunks {"hello\n"} because it is always using
the initializer_list constructor.
Change-Id: I1573566efc1327a2d8681e9ae7bd0ad6ee182789
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]
Change-Id: I8c6e2d8f6c536ec3c50293b6302ebb5b1d8313c1
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
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>
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>