We get the source range for the parameter list and not the arguments
in the initializer list back. So we have to disable the test case.
Task-number: QTCREATORBUG-17101
Change-Id: I65ec6d111766b5728a951b024576cbf777c89728
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Constructors are not recognized by libClang as callable expressions.
Task-number: QTCREATORBUG-17101
Change-Id: I40eb46c07475e3b2e48bc8117de073732005f8b9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Clang query is mechanism to use AST matcher to search for code. Think
about regular expression but in the context of AST. So you get a semantic
search tool for C++.
Change-Id: I72e882c5b53a0c52f352a3664847c4c3e4f6fc2e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This adds a mix-in for writable functions arguments.
Change-Id: I758f7fef77d992ea25395db550571ccb081fd5fd
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>
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>
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>
...by explicitly checking for the dot in the source.
Task-number: QTCREATORBUG-15654
Change-Id: I4172e88a7fbb3015ef391daf13ded1f0002aab9c
Reviewed-by: Marco Bubke <marco.bubke@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>
using NameSpace::StructInNameSpace;
Task-number: QTCREATORBUG-15271
Change-Id: I17a3ad1e1eed7a820ed7dead5d15a3de760c135f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
It looks like there is no way to mark a test as expected to fail, so
disable it.
Task-number: QTCREATORBUG-15473
Change-Id: Ic6cb2c00a64cf647cb499492064d451d0dd08075
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Scope operators are not really user defined.
Change-Id: I1ab08dc3db7c39b98da02b6ef10bf78b75a6856d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
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>
Apparently libclang might return invalid ranges.
Now we discard the invalid ranges. Since there is a diagnostic location
(in addition to ranges) the editor will still display an indication for
the user.
Task-number: QTCREATORBUG-15272
Change-Id: I351e136b9925a53fb2273a394e17873c5533798d
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
They are invokable by the usual means (Alt+Enter, editor's context menu
> Refactor) plus by the context menu of the editor's left margin for the
related line.
The fixit text comes directly from libclang and is thus not translated.
We modify the text slighty by stripping the diagnostic category prefix
("note:", "error:", ...) and capitalizing the first letter.
A follow-up change should properly indicate available refactorings with
a refactoring icon in the editor's left margin.
Task-number: QTCREATORBUG-14868
Change-Id: I86157c9f824d2a9dedf19087476d02ad1e6cc854
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
...by introducing ClangDiagnosticManager and the helper class
ClangDiagnosticFilter.
ClangDiagnosticManager will get more state in a follow-up change.
Change-Id: Id2c312bc897ea41ed67292b56b24dcfb7975ff4a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
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>
Diagnostics are now moved to the clang backend process. Fixits are
supported too.
Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reparsing in Clang is broken in master. We need to test what is working
in which version.
Change-Id: I620acd4a0a5adc951951e0fc3c0a4096ac9844fe
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>