Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Except FakeVim, which had it before.
for i in [a-eg-z]*/*.json ; do
upper=${i##*/}
upper=${upper/.json/}
lower=${i%/*}
trfile=$lower/${lower}tr.h
cat << EOT > $lower/${lower}tr.h
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
namespace $upper {
struct Tr
{
Q_DECLARE_TR_FUNCTIONS($upper)
};
} // namespace $upper
EOT
git add $trfile
perl -pi -e "s/(${lower}_global.h)/\1\n ${lower}tr.h/" $lower/CMakeLists.txt
perl -pi -e "s/(\"${lower}_global.h\",)/\1 \"${lower}tr.h\",/" $lower/$lower.qbs
done
Change-Id: I15ebbaaa9443c57b391b9e143f592d8a0c9208a9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Depending on context, callgrind sees contributions of >8% to
the total cost of project parsing for these functions. The
functional are actualy executed executed out-of-line, often
for a function body of one "payload" instruction only.
Inlining removes the call/endbr64/ret overhead.
Change-Id: I6886f08e322fcaa4e0f54d424279e0a8c24e4718
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
False positive, it couldn't be. `ok` could only become true if
var.toInt() was called, which means some value was assigned to `value`.
But anyway, we can simplify this because QVariant::toInt() returns 0
when it sets ok to false.
classviewutils.cpp:78:50: warning: ‘value’ may be used uninitialized [-Wmaybe-uninitialized]
78 | return SymbolInformation(name, type, iconType);
| ^
Change-Id: Iba16e8ea451b444ab213fffd16f4918c45228f2c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Removes qmake as a build system for building Qt Creator itself.
Keep them for some tests that are not completely moved to CMake yet.
Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
In favor of the FilePath/Link ones.
Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.
Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Don't call SessionManager methods in non-main thread.
It's not safe to call SessionManger::projects() or
any method of Project class in a non-main thread,
as in meantime the Project object may get deleted
or the Project object may change in main thread in
a not thread-safe way.
Instead, prepare the data needed for the parser's
thread before, when scheduling a call in a main thread,
and pass this data in a safe way.
This fixes possible crash in class view, e.g. on session
switch.
Task-number: QTCREATORBUG-25317
Fixes: QTCREATORBUG-25312
Change-Id: I114aae788aec649d1de3b3d3afdd049ed1e9b2c6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Minimize the communication with parser's thread.
Don't call getParseDocumentTree() multiple times
when subsequent request for the same document comes
before the timeout.
Don't queue again already queued documentUpdated()
signal (it's emitted form non-gui thread).
Prepare for moving the calls to SessionManager out of the
parser's thread.
Task-number: QTCREATORBUG-25317
Change-Id: I5d4898b5addbb589d415e00c66de5cba7b96d512
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
In order to refresh GUI, call reparse after files are removed.
Task-number: QTCREATORBUG-25317
Change-Id: I8f29c042c9002587dd791800597af0e42e19856e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
The Parser object is being moved to parser's thread inside
Manager constructor. However, when destructor of Manager
is being called, we delete the Parser from inside the main
thread. According to QThread documentation we should delete
object (which have been moved to another thread) from inside
the object's current thread. So in case of Parser, we should
delete it from the parser's thread. In order to fix it,
we create Parser object dynamically and connect finished
signal of the parser's thread to the parser's deleteLater().
Since now the parser is being deleted in parser's thread
we don't need a special handling for stopping the timer
object inside the parser's thread, as its destructor
will also be called from inside parser's thread.
Task-number: QTCREATORBUG-25317
Change-Id: I28dee2c3db5cf8329a9578e7a85952e8a85850d3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
There is no need to use non-const pointers anymore. This also
ensures, that after generating the tree data in the non-gui
thread no-one modifies already created items.
Task-number: QTCREATORBUG-25317
Change-Id: I91f63da8f57ae9798587265adc029ebd0c68504e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Move a code that operates on QIcon instances out from non-GUI
thread into GUI thread. Instead of storing the QIcon directly
inside ParserTreeItem, store the path to the project. Set the
real icon when we are back on the main thread side.
Rename some fields to start with m_ prefix.
Task-number: QTCREATORBUG-25317
Task-number: QTCREATORBUG-25312
Change-Id: Iaff89c0995045b70c5378a2ff72c5deb74abf89e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Don't create QStandardItem objects inside the non-gui thread,
as it was in case of requestCurrentState() which is always
called in parser's thread. As a result of parsing send a root's
ParserTreeItem::ConstPtr now instead. Store the generated
root inside Manager instead of inside Parser. Remove rootItemLocker
as it's not needed now anymore. Move the implementation of
canFetchMore(), fetchMore() and hasChildren() into Manager class.
Now all the API of Parser class is used only in parser's thread
(with the exception of constructor and destructor).
Task-number: QTCREATORBUG-25317
Change-Id: I2b3c49918bf58266e6bea8acf65c975e19f7d9cb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
When we are going to delete Parser object, it may happen,
that its timer is still being active. A call to
parserThread.quit() won't stop the timer. When we quit the
thread and wait for it to finish, the thread's timer may
still be active. Then we delete the Parser in the main thread,
what cause the following warning to appear:
"QObject::killTimer: Timers cannot be stopped from another thread".
In order to fix it, we post a request to the parser's thread
for stopping the timer by a call to aboutToShutdown() with
Qt::BlockingQueuedConnection, just before quitting the thread,
as the thread's event loop should still be spinning and is
able to receive and handle our request. It's the only safe way
to stop the active timer that was started in another thread
- it must be stopped it the same thread it was started in.
Inside the call to aboutToShutdown() we mark that we don't want
to start the timer anymore with m_shuttingDown flag and we stop
the timer. After the blocking call returns to the main thread
we are sure that the timer is not active anymore and it won't
became active in the future, so we safely quit the thread and
delete the timer.
Task-number: QTCREATORBUG-25317
Change-Id: I3b95c062b5561588c45c223d8588b2b700ad4040
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Make all of the fields of SymbolLocation and SymbolInformation
const members. Optimize a bit operator== of these structures:
check first if hashes are non-equal - in this case return
false early. Fix hash type of SymbolInformation for porting
to Qt6 purpose.
Task-number: QTCREATORBUG-25317
Task-number: QTCREATORBUG-24098
Change-Id: I769f99ff3157093e9f10ee3929bc7f6eb83f34e3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Make the API of ParserTreeItem const only.
Reorganize the code a bit:
Transform ParserTreeItem::add() method into private
mergeWith() and add a static method
ParserTreeItem::mergeTrees().
Remove ParserTreeItem::copy(), as in case of adding
projects we may use directly the instance from cache.
Remove now unneeded Parser::addProject() and use
directly getCachedOrParseProjectTree().
Transform ParserTreeItem::copyTree() into private
cloneTree() and make it a const method.
Move document symbols parsing code from Parser into
ParserTreeItem and add a static method
ParserTreeItem::parseDocument().
Remove ParserTreeItem::addChild() and provide instead
an overloaded constructor.
Allocate QElapedTimer object only when debug is on.
Fix some const correctness.
Remove some ugly usings.
Added some TODOs.
Task-number: QTCREATORBUG-25317
Change-Id: I6e7c48bb118b0d826fbb463cae94d59bf43a6938
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
In fact, all the methods inside Parser class are
called only in one thread (parser thread), which runs
his own event loop. The exception is 3 methods
(canFetchMore(), fetchMore() and hasChildren()),
which may be called concurrently from the main thread.
However, they are protected with another mutex.
So, project and document mutex were protecting
the access to internals only when called from
one, always the same thread, what is not needed at all.
Task-number: QTCREATORBUG-25317
Change-Id: I0b44b762b5d76d003035e9c3099c90568b7faf80
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
When parsing is being done we are producing a new
ParserTreeItem structure from scratch. This includes
creating new ParserTreeItems or getting data from
caches. So, we are not interferring with the
data stored in the rootItem. After the rootItem
is set, Parser doesn't modify this structure
anymore. There is no need to protect the parsing
with the mutex, as only 3 methods which are called
concurrently operate only on the rootItem: fetchMore(),
canFetchMore() and hasChildren(). Instead, we
protect only the process of setting the rootItem
to the new value. Similarly, we protect only
the process of reading the rootItem inside
findItemByRoot().
Task-number: QTCREATORBUG-25317
Change-Id: Ieda10107137f5031a81d67f2d608a90f6e72902d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Otherwise when we switch session we still keep
the data about the old session in the cache, which is pointless.
Protect clearing both caches with both mutexes, so it comes
atomically.
Task-number: QTCREATORBUG-25317
Change-Id: Ic5bc7ae2b8640e9290024e00c394ca9608f88da9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
We had three different hashes that cached the document data.
Replace it with one cache. Provide a dedicated structure for it.
Task-number: QTCREATORBUG-25317
Change-Id: I6592de62b7c026a9236a295657c9c06f6e9e5b4c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
We had three different hashes that cached the project data.
Replace it with one cache. Provide a dedicated structure for it.
Task-number: QTCREATORBUG-25317
Change-Id: Ib6bafd38ee3c48f3e4960be1650709af777f255a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Instead of clearing the project's file list completely,
remove just a project (in case a removed file was a project)
and remove from all project's lists the removed file (in case
a removed file was contained in any project).
Task-number: QTCREATORBUG-25317
Change-Id: I63a5f9eb1043bd0d9b835d55f4a16f7f6af7bc6e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
After fixing QTCREATORBUG-17977 we don't have Subprojects
mode anymore, since currently Parser::addProjectTree() and
Parser::addFlatTree() are identical. For now, we just
remove this duplication. The subproject mode to be fixed later.
Amends 8634aa4cbd
Change-Id: I53d1b5a7354295449c2995c4421f8fa21a3ac2be
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
clearCache() is already called from inside
Manager::resetParser() ->
Parser::resetDataToCurrentState() ->
Parser::resetData() ->
Parser::clearCache().
Change-Id: I270be85b291f99552959e50ee54bd6e1f293c63a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Remove unused methods. Replace one slot with a call
to lambda.
Amends a673fca144
Task-number: QTCREATORBUG-25317
Change-Id: I1125b62b9ea66b8dc43038a6b748d52a5a27224f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Allow for direct connections where signal emitter and
receiver live in the same thread.
Remove unneeded mutexState, as changes to state and
all queries of state are done in the same thread.
Remove some indirections by removing some signals
and by calling respective slots through
QMetaObject::invokeMethod() or directly.
Remove some unused methods.
Remove a code path of setState(false), as this was never called.
Remove an initial call to onProjectListChanged(), as initially
the state is false and a call is no-op.
This change doesn't influence the existing behavior.
Task-number: QTCREATORBUG-25317
Change-Id: I683525b49afaf04e155d1859bb85ee5dd8e26dd2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
After you load the project, and after "Parsing C/C++ Files"
has finished, if you open the Class View and start
typing in cpp editor, a warning appears:
"QObject::killTimer: Timers cannot be stopped from another thread"
and changes to source files, like adding a new method or
renaming it, are not reflected anymore in Class View.
Short:
A fix is to give timer a parent in order to move it properly
into another thread.
Long:
Just after creating a Parser object we move it into another
thread by calling moveToThread(), inside constructor of
Manager in classviewmanager.cpp. All the children
of the moved object are moved together into the target thread.
Original intention of the timer object inside Parser was
that it should live in the same thread as its parent
Parser object. In meantime, after some refactoring,
that's not the case anymore and the timer is orphaned
(parentless in terms of QObject hierarchy). It means
it's not moved together with the parent Parser anymore,
while still being a member field of the Parser.
This is reflected in a warning message and class view
doesn't react to the changes in edited document anymore.
Amends 87b3ea9af4
Change-Id: I9cca7556d5b77aa31ce7b4ab426f84a478488a84
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Writes less settings and makes it possible to change defaults in the
future.
Task-number: QTCREATORBUG-24762
Change-Id: I73873b3684827b4fe27cfa5ea2f62a76003f9750
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Rename QHashSeedType to QHashValueType and use it also for return
values.
Use qHashMulti directly instead of continuing using temporary QPairs.
Avoids ugly namespace tricks to find the new pair overloads, and is
actually clearer.
Classes used in signals cannot be forward-declared. ...
Change-Id: I22450a0c642437a43f876e8e89cc8788fff3db61
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The coreplugin/id.h header is kept for downstream for now.
Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>