We called reserve for even if we do not found anything to replace.
Change-Id: I01dfbb9e8152605c01fa007eb93586f9a30cf56e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
You need to allocate the memory before you replace a smaller text with
a larger one. It has some overhead because you go two times over the text
but it is anyway not designed for a large text.
Change-Id: I2f56f1300a5daf9e26632b5b0667023a09ff4bd2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
The short string capacity is the data area size minus the size of \0.
Change-Id: Iffb4428bb81fc78bdc4c00218cf9f2c9ac8c25e5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
If you call reserve on a read only reference we always allocated on the
heap which is not that smart.
Change-Id: Ib9653c6fc87bc65716a966545c13f7ecb3712039
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
The bug was that we returned the new end() but not the old reallocated
after a reallocation of the memory. The return value is used to move the
string after the found sub string to the next found sub string to the
new position of after the replaced sub string. Because the new end moved
more to the right we moved a much bigger chunk of memory. So we
accessed memory outside of the allocated memory.
Change-Id: I9ac276e201eabee896190da0cf0ee1d86860777d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Using values instead of pointers makes the handling much easier. We can
remove ColumnDefinition too, and use SqliteColumn instead.
Change-Id: I224db9cc569c4dfb6e2746179b02096904bfbccb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
You can now write
SqliteWriteStatement statement("UPDATE test SET name=?, number=?
WHERE rowid=?", database);
statement.write("see", 7.23, 1);
and
SqliteWriteStatement statement("UPDATE test SET name=@name, number=@number
WHERE rowid=@id", database);
statement.writeNamed("@name", "see", "@number", 7.23, "@id", 1);
This is more type safe than using variants and performant too.
Change-Id: Ie1ed2a6d326b956be5c4ec056214f3f5b1531f45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
We only will need the utf8 optimized SmallString for the indexer database.
So we remove all other string bindings, QByteArray and QVariant.
Change-Id: I4a77901a80b26bf292fc85df535c2ccf3a8ab52f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
It should not be used for chained concatenation. Use initializer list
instead.
auto text = in + 'x';
auto text = Utils::SmallString{in, "x", other, ", "};
Change-Id: I453d986913eae89fd5e1f525b9f4e0c4bd089467
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
We use std::to_string except for integer where we want a low overhead
solution.
Change-Id: I16ce7d575d83ff56e61a5038aa7f9a1febfaf34f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
We don't need the threading anymore, so we removed it. The indexer
will be run in its thread anyway, so an extra thread makes the code
only more complicated. And we added namespaces.
Change-Id: Ibcba306324763285cf653c28bb08122345e5f8da
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
...by adapting to recent mime type changes:
commit e8e46ab553
Plugins: Fix that mimetype definition was not valid JSON
Change-Id: Iac416ab481814e4488fac4d818c51c647c1ec349
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
f(x.get()); -> x.get() should be shown as a output argument
Task-number: QTCREATORBUG-18591
Change-Id: I99f5637660bcd0a889338ebfa6737d79de226f87
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
If you hover a diagnostics in for a clang query you get now a simple tool
tip.
Change-Id: I6352dd3d4b9a33c183e69037eac903469b90eea4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Non constant pointers are used many times as non output arguments, so you
get misleading information.
Task-number: QTCREATORBUG-18591
Change-Id: Ic5f987db44ad63a0b1a38fd59cd807db5f2acc8f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Do not insert for these cases:
* <Cursor>{
* namespace X <Cursor>
* if the next block is indented, like e.g.:
if (e) <Cursor>
g();
* on empty line if text before looks like a finished statement or
scope opening/end
Change-Id: Id9decc1e964a775724a929c2a3e79b5283105560
Reviewed-by: David Schulz <david.schulz@qt.io>
We now support highlighting for an example text and for the query.
Change-Id: I88c415ff871cf3e4c2d4fc83d60a8555bf0ce08a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This is supposed to fix
[ FAILED ] ReferencesCollector.VariableInTemplate
[ FAILED ] ReferencesCollector.MemberInTemplate
on Windows.
Change-Id: I1a6486e524069c83da183e3e68df2dea8ba415ff
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Because we can visit headers many times, we get results many times too.
Change-Id: I3bbe7d7a5d01c2580a4569bfe115f14a69edc8a7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Clang file ids are only unique for one query. Because we query in parallel
we have to manage our own unique ids.
Change-Id: I67d57d8b1766cab75ad252a14e57bbf9dc5fdb79
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Every AST unit is created and queried asynchronously, like before, but
we don't wait anymore but use a timer to process new sources. So the server
will not be blocked and can process other messages like cancel.
Change-Id: If0e69466c78f628190f59fd32a03cab1c3a4d0a3
Reviewed-by: Tim Jenssen <tim.jenssen@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>
In the example below, "var" is highlighted as a function, but it should
be highlighted as a local variable.
struct OtherOperator { void operator()(int); };
void g(OtherOperator o, int var)
{
o(var);
}
This is due to a libclang bug.
Change-Id: I7c9fcad6f16c25191d31fc330e969ebd282d4869
Reviewed-by: David Schulz <david.schulz@qt.io>
mock-matchers.h:204:60: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
bool operator()(const A& a, const B& b) const { return a == b; }
~~^~~~
Change-Id: I58883118e1eb42f2e0129b760cdce07daf4ac8d3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Utf8String is allocating memory but for many compares it is not needed.
In an inner loop this can be expensive.
Change-Id: I6320823ab7e086008447eea255e52859a7faaad7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Do not add space before left paren in function
because it must not be there
Task-number: QTCREATORBUG-14878
Change-Id: I0fd0e650aeeee59af7bbc157c2fae652109763bc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
...to avoid ambiguity in regard to a new enum in a follow-up change.
Change-Id: I4f732b5200ed674b6708510ac8de0a795afe52da
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Converting them in a Utf8String in an inner loop can be quite heavy.
Change-Id: I4f2ccde47a6e3ca08ed054462eb7772ded9e55c9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>