aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2019-07-04 14:47:52 +0200
committerTim Jenssen <tim.jenssen@qt.io>2019-07-04 15:17:55 +0200
commit1df6443d4a6e58338dfaed7d787debfaeba86756 (patch)
tree29ceb6ea3313311287eb5b5216a8a49c1ec0ecfd /src
parent2b7fab166878b759fc8fa29256754a41c3fc6259 (diff)
parent6a58666f4403cdde1809784c1cc98668a4b02cfc (diff)
Merge remote-tracking branch 'origin/4.10'
Conflicts: qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/libs/utils/synchronousprocess.cpp src/plugins/baremetal/iarewtoolchain.cpp src/plugins/cmakeprojectmanager/cmakeproject.cpp tests/unit/unittest/CMakeLists.txt Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
Diffstat (limited to 'src')
-rw-r--r--src/libs/clangsupport/CMakeLists.txt7
-rw-r--r--src/libs/clangsupport/clangpathwatcher.h72
-rw-r--r--src/libs/clangsupport/clangpathwatchernotifier.h7
-rw-r--r--src/libs/clangsupport/clangrefactoringclientmessages.h1
-rw-r--r--src/libs/clangsupport/clangrefactoringservermessages.h1
-rw-r--r--src/libs/clangsupport/clangsupport-lib.pri4
-rw-r--r--src/libs/clangsupport/idpaths.h45
-rw-r--r--src/libs/clangsupport/precompiledheadersupdatedmessage.h2
-rw-r--r--src/libs/clangsupport/refactoringclientinterface.cpp3
-rw-r--r--src/libs/clangsupport/refactoringclientinterface.h2
-rw-r--r--src/libs/clangsupport/refactoringclientproxy.cpp5
-rw-r--r--src/libs/clangsupport/refactoringclientproxy.h3
-rw-r--r--src/libs/clangsupport/refactoringserverinterface.cpp3
-rw-r--r--src/libs/clangsupport/refactoringserverinterface.h2
-rw-r--r--src/libs/clangsupport/refactoringserverproxy.cpp5
-rw-r--r--src/libs/clangsupport/refactoringserverproxy.h1
-rw-r--r--src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp41
-rw-r--r--src/libs/clangsupport/requestsourcelocationforrenamingmessage.h108
-rw-r--r--src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp39
-rw-r--r--src/libs/clangsupport/sourcelocationsforrenamingmessage.h87
-rw-r--r--src/libs/cplusplus/LookupContext.cpp4
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp12
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/classitem.cpp4
-rw-r--r--src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp2
-rw-r--r--src/libs/qmldebug/qmldebugconnection.cpp17
-rw-r--r--src/libs/qmljs/qmljscheck.cpp5
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.cpp7
-rw-r--r--src/libs/qmljs/qmljsplugindumper.cpp6
-rw-r--r--src/libs/utils/algorithm.h23
-rw-r--r--src/libs/utils/codegeneration.cpp10
-rw-r--r--src/libs/utils/synchronousprocess.cpp25
-rw-r--r--src/plugins/android/androiddebugsupport.cpp8
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp3
-rw-r--r--src/plugins/android/androidsdkmodel.cpp2
-rw-r--r--src/plugins/autotest/gtest/gtestconfiguration.cpp8
-rw-r--r--src/plugins/autotest/qtest/qttestparser.cpp4
-rw-r--r--src/plugins/baremetal/iarewtoolchain.cpp4
-rw-r--r--src/plugins/clangcodemodel/clangbackendcommunicator.cpp4
-rw-r--r--src/plugins/clangcodemodel/clangbackendcommunicator.h2
-rw-r--r--src/plugins/clangrefactoring/clangrefactoringplugin.cpp6
-rw-r--r--src/plugins/clangrefactoring/qtcreatorclangqueryfindfilter.cpp3
-rw-r--r--src/plugins/clangrefactoring/refactoringclient.cpp21
-rw-r--r--src/plugins/clangrefactoring/refactoringclient.h7
-rw-r--r--src/plugins/clangrefactoring/refactoringengine.cpp32
-rw-r--r--src/plugins/clangtools/clangtoolsprojectsettings.cpp4
-rw-r--r--src/plugins/classview/classviewparser.cpp3
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/tealeafreader.cpp2
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp3
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp4
-rw-r--r--src/plugins/coreplugin/id.cpp4
-rw-r--r--src/plugins/coreplugin/jsexpander.cpp2
-rw-r--r--src/plugins/coreplugin/locator/locatorsettingspage.cpp4
-rw-r--r--src/plugins/cppeditor/cppeditorwidget.cpp2
-rw-r--r--src/plugins/cppeditor/cppinsertvirtualmethods.cpp8
-rw-r--r--src/plugins/cpptools/builtineditordocumentparser.cpp3
-rw-r--r--src/plugins/cpptools/builtinindexingsupport.cpp2
-rw-r--r--src/plugins/cpptools/clangdiagnosticconfigswidget.cpp4
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp2
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp2
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp19
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp4
-rw-r--r--src/plugins/cpptools/symbolsfindfilter.cpp2
-rw-r--r--src/plugins/debugger/breakhandler.cpp2
-rw-r--r--src/plugins/debugger/debuggermainwindow.cpp2
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp12
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp2
-rw-r--r--src/plugins/git/branchmodel.cpp6
-rw-r--r--src/plugins/git/branchmodel.h4
-rw-r--r--src/plugins/git/branchview.cpp36
-rw-r--r--src/plugins/git/gitclient.cpp21
-rw-r--r--src/plugins/git/gitclient.h7
-rw-r--r--src/plugins/help/docsettingspage.cpp2
-rw-r--r--src/plugins/help/filtersettingspage.cpp4
-rw-r--r--src/plugins/help/helpmanager.cpp10
-rw-r--r--src/plugins/ios/iosconfigurations.cpp8
-rw-r--r--src/plugins/ios/iosprobe.cpp3
-rw-r--r--src/plugins/modeleditor/pxnodecontroller.cpp4
-rw-r--r--src/plugins/projectexplorer/deploymentdata.cpp2
-rw-r--r--src/plugins/projectexplorer/gccparser.cpp109
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp3
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp2
-rw-r--r--src/plugins/projectexplorer/kit.cpp2
-rw-r--r--src/plugins/projectexplorer/kitinformation.cpp8
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp2
-rw-r--r--src/plugins/projectexplorer/selectablefilesmodel.cpp6
-rw-r--r--src/plugins/projectexplorer/target.cpp2
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.cpp4
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.cpp4
-rw-r--r--src/plugins/projectexplorer/toolchainsettingsaccessor.cpp18
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp7
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.h5
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp8
-rw-r--r--src/plugins/qmldesigner/components/curveeditor/detail/playhead.h2
-rw-r--r--src/plugins/qmldesigner/components/curveeditor/detail/selector.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp6
-rw-r--r--src/plugins/qmldesigner/components/formeditor/rubberbandselectionmanipulator.cpp8
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp20
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h6
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp45
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp27
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.h3
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h3
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp12
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp4
-rw-r--r--src/plugins/qmldesigner/shortcutmanager.cpp8
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp9
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp2
-rw-r--r--src/plugins/qtsupport/qtoutputformatter.cpp18
-rw-r--r--src/plugins/qtsupport/qtversionmanager.cpp2
-rw-r--r--src/plugins/studiowelcome/studiowelcomeplugin.cpp5
-rw-r--r--src/plugins/texteditor/basefilefind.cpp2
-rw-r--r--src/plugins/texteditor/codeassist/documentcontentcompletion.cpp3
-rw-r--r--src/plugins/todo/todoitemsprovider.cpp5
-rw-r--r--src/plugins/vcsbase/baseannotationhighlighter.cpp5
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp3
-rw-r--r--src/plugins/vcsbase/vcsbasesubmiteditor.cpp12
-rw-r--r--src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp6
-rw-r--r--src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h114
-rw-r--r--src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h6
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchcreator.cpp44
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchcreator.h17
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp115
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchmanagerserver.h11
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchtask.h29
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp41
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h8
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchtaskgeneratorinterface.h3
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchtasksmerger.cpp4
-rw-r--r--src/tools/clangpchmanagerbackend/source/usedmacrofilter.h9
-rw-r--r--src/tools/clangrefactoringbackend/source/CMakeLists.txt2
-rw-r--r--src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri7
-rw-r--r--src/tools/clangrefactoringbackend/source/findcursorusr.h191
-rw-r--r--src/tools/clangrefactoringbackend/source/findlocationsofusrs.h126
-rw-r--r--src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp128
-rw-r--r--src/tools/clangrefactoringbackend/source/findusrforcursoraction.h70
-rw-r--r--src/tools/clangrefactoringbackend/source/refactoringserver.cpp16
-rw-r--r--src/tools/clangrefactoringbackend/source/refactoringserver.h1
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolfinder.cpp79
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolfinder.h58
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolindexer.cpp27
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolindexer.h5
-rw-r--r--src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp99
-rw-r--r--src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h71
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolstorage.h106
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolstorageinterface.h5
148 files changed, 991 insertions, 1661 deletions
diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt
index 84cdbaf8b9..0366d74f8c 100644
--- a/src/libs/clangsupport/CMakeLists.txt
+++ b/src/libs/clangsupport/CMakeLists.txt
@@ -11,7 +11,6 @@ add_qtc_library(ClangSupport
annotationsmessage.cpp annotationsmessage.h
baseserverproxy.cpp baseserverproxy.h
cancelmessage.cpp cancelmessage.h
- changedfilepathcompressor.h
clangcodemodelclientinterface.cpp clangcodemodelclientinterface.h
clangcodemodelclientmessages.h
clangcodemodelclientproxy.cpp clangcodemodelclientproxy.h
@@ -36,6 +35,8 @@ add_qtc_library(ClangSupport
connectionclient.cpp connectionclient.h
connectionserver.cpp connectionserver.h
diagnosticcontainer.cpp diagnosticcontainer.h
+ directoryandfilepathid.h
+ directorypathid.h
documentschangedmessage.cpp documentschangedmessage.h
documentsclosedmessage.cpp documentsclosedmessage.h
documentsopenedmessage.cpp documentsopenedmessage.h
@@ -61,6 +62,10 @@ add_qtc_library(ClangSupport
filepathstoragesources.h
filepathstoragesqlitestatementfactory.h
filepathview.h
+ filestatus.h
+ filestatuscache.cpp filestatuscache.h
+ filesystem.cpp filesystem.h
+ filesysteminterface.h
fixitcontainer.cpp fixitcontainer.h
followsymbolmessage.cpp followsymbolmessage.h
generatedfiles.cpp generatedfiles.h
diff --git a/src/libs/clangsupport/clangpathwatcher.h b/src/libs/clangsupport/clangpathwatcher.h
index 7a7d6ccfcf..5ce02458c4 100644
--- a/src/libs/clangsupport/clangpathwatcher.h
+++ b/src/libs/clangsupport/clangpathwatcher.h
@@ -1,4 +1,4 @@
-; /****************************************************************************
+/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
@@ -57,7 +57,7 @@ void set_greedy_intersection_call(
class WatcherEntry
{
public:
- ProjectPartId id;
+ ProjectChunkId id;
DirectoryPathId directoryPathId;
FilePathId filePathId;
long long lastModified = -1;
@@ -98,9 +98,9 @@ public:
ClangPathWatcher(FilePathCachingInterface &pathCache,
FileSystemInterface &fileSystem,
ClangPathWatcherNotifier *notifier = nullptr)
- : m_pathCache(pathCache)
- , m_fileStatusCache(fileSystem)
+ : m_fileStatusCache(fileSystem)
, m_fileSystem(fileSystem)
+ , m_pathCache(pathCache)
, m_notifier(notifier)
{
QObject::connect(&m_fileSystemWatcher,
@@ -140,25 +140,6 @@ public:
m_notifier = notifier;
}
- static std::vector<uint> idsFromIdPaths(const std::vector<IdPaths> &idPaths)
- {
- std::vector<uint> ids;
- ids.reserve(idPaths.size());
-
- auto extractId = [] (const IdPaths &idPath) {
- return idPath.id;
- };
-
- std::transform(idPaths.begin(),
- idPaths.end(),
- std::back_inserter(ids),
- extractId);
-
- std::sort(ids.begin(), ids.end());
-
- return ids;
- }
-
std::size_t sizeOfIdPaths(const std::vector<IdPaths> &idPaths)
{
auto sumSize = [] (std::size_t size, const IdPaths &idPath) {
@@ -168,19 +149,19 @@ public:
return std::accumulate(idPaths.begin(), idPaths.end(), std::size_t(0), sumSize);
}
- std::pair<WatcherEntries, ProjectPartIds> convertIdPathsToWatcherEntriesAndIds(
+ std::pair<WatcherEntries, ProjectChunkIds> convertIdPathsToWatcherEntriesAndIds(
const std::vector<IdPaths> &idPaths)
{
WatcherEntries entries;
entries.reserve(sizeOfIdPaths(idPaths));
- ProjectPartIds ids;
+ ProjectChunkIds ids;
ids.reserve(ids.size());
auto outputIterator = std::back_inserter(entries);
for (const IdPaths &idPath : idPaths)
{
- ProjectPartId id = idPath.id;
+ ProjectChunkId id = idPath.id;
ids.push_back(id);
@@ -214,7 +195,7 @@ public:
m_fileSystemWatcher.addPaths(convertWatcherEntriesToDirectoryPathList(filteredPaths));
}
- void removeUnusedEntries(const WatcherEntries &entries, const ProjectPartIds &ids)
+ void removeUnusedEntries(const WatcherEntries &entries, const ProjectChunkIds &ids)
{
auto oldEntries = notAnymoreWatchedEntriesWithIds(entries, ids);
@@ -294,7 +275,7 @@ public:
}
WatcherEntries notAnymoreWatchedEntriesWithIds(const WatcherEntries &newEntries,
- const ProjectPartIds &ids) const
+ const ProjectChunkIds &ids) const
{
auto oldEntries = notAnymoreWatchedEntries(newEntries, std::less<WatcherEntry>());
@@ -420,25 +401,22 @@ public:
return filePathIds;
}
- ProjectPartIds idsForWatcherEntries(const WatcherEntries &foundEntries)
+ std::vector<IdPaths> idPathsForWatcherEntries(WatcherEntries &&foundEntries)
{
- ProjectPartIds ids;
- ids.reserve(foundEntries.size());
-
- std::transform(foundEntries.begin(),
- foundEntries.end(),
- std::back_inserter(ids),
- [&](WatcherEntry entry) { return entry.id; });
+ std::sort(foundEntries.begin(), foundEntries.end(), [](WatcherEntry first, WatcherEntry second) {
+ return std::tie(first.id, first.filePathId) < std::tie(second.id, second.filePathId);
+ });
- return ids;
- }
+ std::vector<IdPaths> idPaths;
+ idPaths.reserve(foundEntries.size());
- ProjectPartIds uniqueIds(ProjectPartIds &&ids)
- {
- std::sort(ids.begin(), ids.end());
- ids.erase(std::unique(ids.begin(), ids.end()), ids.end());
+ for (WatcherEntry entry : foundEntries) {
+ if (idPaths.empty() || idPaths.back().id != entry.id)
+ idPaths.push_back({entry.id, {}});
+ idPaths.back().filePathIds.push_back(entry.filePathId);
+ }
- return std::move(ids);
+ return idPaths;
}
void addChangedPathForFilePath(DirectoryPathIds &&directoryPathIds)
@@ -446,10 +424,12 @@ public:
if (m_notifier) {
WatcherEntries foundEntries = watchedEntriesForPaths(std::move(directoryPathIds));
- ProjectPartIds changedIds = idsForWatcherEntries(foundEntries);
+ FilePathIds watchedFilePathIds = watchedPaths(foundEntries);
+
+ std::vector<IdPaths> changedIdPaths = idPathsForWatcherEntries(std::move(foundEntries));
- m_notifier->pathsWithIdsChanged(uniqueIds(std::move(changedIds)));
- m_notifier->pathsChanged(watchedPaths(foundEntries));
+ m_notifier->pathsChanged(watchedFilePathIds);
+ m_notifier->pathsWithIdsChanged(changedIdPaths);
}
}
diff --git a/src/libs/clangsupport/clangpathwatchernotifier.h b/src/libs/clangsupport/clangpathwatchernotifier.h
index 393525dbf2..248925ffb9 100644
--- a/src/libs/clangsupport/clangpathwatchernotifier.h
+++ b/src/libs/clangsupport/clangpathwatchernotifier.h
@@ -26,9 +26,8 @@
#pragma once
#include "clangsupport_global.h"
-
-#include <filepathid.h>
-#include <projectpartid.h>
+#include "filepathid.h"
+#include "idpaths.h"
#include <utils/smallstringvector.h>
@@ -41,7 +40,7 @@ public:
ClangPathWatcherNotifier(const ClangPathWatcherNotifier &) = delete;
ClangPathWatcherNotifier &operator=(const ClangPathWatcherNotifier &) = delete;
- virtual void pathsWithIdsChanged(const ProjectPartIds &ids) = 0;
+ virtual void pathsWithIdsChanged(const std::vector<IdPaths> &idPaths) = 0;
virtual void pathsChanged(const FilePathIds &filePathIds) = 0;
protected:
diff --git a/src/libs/clangsupport/clangrefactoringclientmessages.h b/src/libs/clangsupport/clangrefactoringclientmessages.h
index 012ca0431d..87b61b4c6b 100644
--- a/src/libs/clangsupport/clangrefactoringclientmessages.h
+++ b/src/libs/clangsupport/clangrefactoringclientmessages.h
@@ -27,6 +27,5 @@
#include "alivemessage.h"
#include "progressmessage.h"
-#include "sourcelocationsforrenamingmessage.h"
#include "sourcerangesanddiagnosticsforquerymessage.h"
#include "sourcerangesforquerymessage.h"
diff --git a/src/libs/clangsupport/clangrefactoringservermessages.h b/src/libs/clangsupport/clangrefactoringservermessages.h
index dd1cb3a6d7..8a79518c7e 100644
--- a/src/libs/clangsupport/clangrefactoringservermessages.h
+++ b/src/libs/clangsupport/clangrefactoringservermessages.h
@@ -27,7 +27,6 @@
#include "cancelmessage.h"
#include "endmessage.h"
-#include "requestsourcelocationforrenamingmessage.h"
#include "requestsourcerangesanddiagnosticsforquerymessage.h"
#include "requestsourcerangesforquerymessage.h"
#include "removegeneratedfilesmessage.h"
diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri
index dc66408e58..18896c0ea0 100644
--- a/src/libs/clangsupport/clangsupport-lib.pri
+++ b/src/libs/clangsupport/clangsupport-lib.pri
@@ -56,14 +56,12 @@ SOURCES += \
$$PWD/requestannotationsmessage.cpp \
$$PWD/requestfollowsymbolmessage.cpp \
$$PWD/requestreferencesmessage.cpp \
- $$PWD/requestsourcelocationforrenamingmessage.cpp \
$$PWD/requestsourcerangesanddiagnosticsforquerymessage.cpp \
$$PWD/requestsourcerangesforquerymessage.cpp \
$$PWD/requesttooltipmessage.cpp \
$$PWD/sourcelocationcontainer.cpp \
$$PWD/sourcelocationcontainerv2.cpp \
$$PWD/sourcelocationscontainer.cpp \
- $$PWD/sourcelocationsforrenamingmessage.cpp \
$$PWD/sourcerangecontainer.cpp \
$$PWD/processcreator.cpp \
$$PWD/processexception.cpp \
@@ -163,14 +161,12 @@ HEADERS += \
$$PWD/requestannotationsmessage.h \
$$PWD/requestfollowsymbolmessage.h \
$$PWD/requestreferencesmessage.h \
- $$PWD/requestsourcelocationforrenamingmessage.h \
$$PWD/requestsourcerangesanddiagnosticsforquerymessage.h \
$$PWD/requestsourcerangesforquerymessage.h \
$$PWD/requesttooltipmessage.h \
$$PWD/sourcelocationcontainer.h \
$$PWD/sourcelocationcontainerv2.h \
$$PWD/sourcelocationscontainer.h \
- $$PWD/sourcelocationsforrenamingmessage.h \
$$PWD/sourcerangecontainer.h \
$$PWD/filepath.h \
$$PWD/processcreator.h \
diff --git a/src/libs/clangsupport/idpaths.h b/src/libs/clangsupport/idpaths.h
index d67a73e83e..d0945f7ff5 100644
--- a/src/libs/clangsupport/idpaths.h
+++ b/src/libs/clangsupport/idpaths.h
@@ -25,21 +25,60 @@
#pragma once
-#include "projectpartid.h"
#include "filepathid.h"
+#include "projectpartid.h"
+#include "sourceentry.h"
namespace ClangBackEnd {
-class IdPaths
+class ProjectChunkId
{
public:
ProjectPartId id;
+ SourceType sourceType;
+
+ friend bool operator==(ProjectChunkId first, ProjectChunkId second)
+ {
+ return first.id == second.id && first.sourceType == second.sourceType;
+ }
+
+ friend bool operator==(ProjectChunkId first, ProjectPartId second)
+ {
+ return first.id == second;
+ }
+
+ friend bool operator==(ProjectPartId first, ProjectChunkId second)
+ {
+ return first == second.id;
+ }
+
+ friend bool operator!=(ProjectChunkId first, ProjectChunkId second)
+ {
+ return !(first == second);
+ }
+
+ friend bool operator<(ProjectChunkId first, ProjectChunkId second)
+ {
+ return std::tie(first.id, first.sourceType) < std::tie(second.id, second.sourceType);
+ }
+
+ friend bool operator<(ProjectChunkId first, ProjectPartId second) { return first.id < second; }
+
+ friend bool operator<(ProjectPartId first, ProjectChunkId second) { return first < second.id; }
+};
+
+class IdPaths
+{
+public:
+ ProjectChunkId id;
FilePathIds filePathIds;
- friend bool operator==(const IdPaths &first, const IdPaths &second)
+ friend bool operator==(IdPaths first, IdPaths second)
{
return first.id == second.id && first.filePathIds == second.filePathIds;
}
};
+using ProjectChunkIds = std::vector<ProjectChunkId>;
+
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/precompiledheadersupdatedmessage.h b/src/libs/clangsupport/precompiledheadersupdatedmessage.h
index 5bd24dcd49..9e3e3b981c 100644
--- a/src/libs/clangsupport/precompiledheadersupdatedmessage.h
+++ b/src/libs/clangsupport/precompiledheadersupdatedmessage.h
@@ -26,6 +26,7 @@
#pragma once
#include "clangsupport_global.h"
+#include "filepathid.h"
#include "projectpartid.h"
#include <utils/smallstringio.h>
@@ -37,6 +38,7 @@ class PrecompiledHeadersUpdatedMessage
public:
PrecompiledHeadersUpdatedMessage() = default;
PrecompiledHeadersUpdatedMessage(ProjectPartId projectPartId)
+
{
projectPartIds.push_back(projectPartId);
}
diff --git a/src/libs/clangsupport/refactoringclientinterface.cpp b/src/libs/clangsupport/refactoringclientinterface.cpp
index 5e3b98df66..e862e4e4d9 100644
--- a/src/libs/clangsupport/refactoringclientinterface.cpp
+++ b/src/libs/clangsupport/refactoringclientinterface.cpp
@@ -38,9 +38,6 @@ void RefactoringClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
case MessageType::AliveMessage:
alive();
break;
- case MessageType::SourceLocationsForRenamingMessage:
- sourceLocationsForRenamingMessage(messageEnvelop.message<SourceLocationsForRenamingMessage>());
- break;
case MessageType::SourceRangesAndDiagnosticsForQueryMessage:
sourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<SourceRangesAndDiagnosticsForQueryMessage>());
break;
diff --git a/src/libs/clangsupport/refactoringclientinterface.h b/src/libs/clangsupport/refactoringclientinterface.h
index c1127592d6..c7d2fcf7d0 100644
--- a/src/libs/clangsupport/refactoringclientinterface.h
+++ b/src/libs/clangsupport/refactoringclientinterface.h
@@ -47,10 +47,8 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void alive() = 0;
- virtual void sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message) = 0;
virtual void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) = 0;
virtual void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) = 0;
- virtual void setLocalRenamingCallback(RenameCallback &&localRenamingCallback) = 0;
virtual void progress(ProgressMessage &&message) = 0;
protected:
diff --git a/src/libs/clangsupport/refactoringclientproxy.cpp b/src/libs/clangsupport/refactoringclientproxy.cpp
index 646cb0e161..b2d30d7bfb 100644
--- a/src/libs/clangsupport/refactoringclientproxy.cpp
+++ b/src/libs/clangsupport/refactoringclientproxy.cpp
@@ -66,11 +66,6 @@ void RefactoringClientProxy::alive()
writeMessageBlock.write(AliveMessage());
}
-void RefactoringClientProxy::sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message)
-{
- writeMessageBlock.write(message);
-}
-
void RefactoringClientProxy::sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message)
{
writeMessageBlock.write(message);
diff --git a/src/libs/clangsupport/refactoringclientproxy.h b/src/libs/clangsupport/refactoringclientproxy.h
index 07cba05e8d..371ae91f82 100644
--- a/src/libs/clangsupport/refactoringclientproxy.h
+++ b/src/libs/clangsupport/refactoringclientproxy.h
@@ -50,13 +50,10 @@ public:
void readMessages();
void alive() override;
- void sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message) override;
void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) override;
void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) override;
void progress(ProgressMessage &&message) override;
- void setLocalRenamingCallback(RenameCallback &&) final {}
-
private:
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
diff --git a/src/libs/clangsupport/refactoringserverinterface.cpp b/src/libs/clangsupport/refactoringserverinterface.cpp
index a95837f80a..6fcaa0f054 100644
--- a/src/libs/clangsupport/refactoringserverinterface.cpp
+++ b/src/libs/clangsupport/refactoringserverinterface.cpp
@@ -38,9 +38,6 @@ void RefactoringServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
case MessageType::EndMessage:
end();
break;
- case MessageType::RequestSourceLocationsForRenamingMessage:
- requestSourceLocationsForRenamingMessage(messageEnvelop.message<RequestSourceLocationsForRenamingMessage>());
- break;
case MessageType::RequestSourceRangesAndDiagnosticsForQueryMessage:
requestSourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<RequestSourceRangesAndDiagnosticsForQueryMessage>());
break;
diff --git a/src/libs/clangsupport/refactoringserverinterface.h b/src/libs/clangsupport/refactoringserverinterface.h
index 2dcc503860..a8a677427c 100644
--- a/src/libs/clangsupport/refactoringserverinterface.h
+++ b/src/libs/clangsupport/refactoringserverinterface.h
@@ -32,7 +32,6 @@
namespace ClangBackEnd {
class RefactoringClientInterface;
-class RequestSourceLocationsForRenamingMessage;
class RequestSourceRangesAndDiagnosticsForQueryMessage;
class RequestSourceRangesForQueryMessage;
class CancelMessage;
@@ -46,7 +45,6 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void end() = 0;
- virtual void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) = 0;
virtual void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) = 0;
virtual void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) = 0;
virtual void cancel() = 0;
diff --git a/src/libs/clangsupport/refactoringserverproxy.cpp b/src/libs/clangsupport/refactoringserverproxy.cpp
index 2208f3a0ce..a206a2531b 100644
--- a/src/libs/clangsupport/refactoringserverproxy.cpp
+++ b/src/libs/clangsupport/refactoringserverproxy.cpp
@@ -50,11 +50,6 @@ void RefactoringServerProxy::end()
m_writeMessageBlock.write(EndMessage());
}
-void RefactoringServerProxy::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
-{
- m_writeMessageBlock.write(message);
-}
-
void RefactoringServerProxy::requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message)
{
m_writeMessageBlock.write(message);
diff --git a/src/libs/clangsupport/refactoringserverproxy.h b/src/libs/clangsupport/refactoringserverproxy.h
index 34861767d8..4b91036c46 100644
--- a/src/libs/clangsupport/refactoringserverproxy.h
+++ b/src/libs/clangsupport/refactoringserverproxy.h
@@ -52,7 +52,6 @@ public:
explicit RefactoringServerProxy(RefactoringClientInterface *client, QIODevice *ioDevice);
void end() override;
- void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) override;
void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) override;
void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) override;
void updateProjectParts(UpdateProjectPartsMessage &&message) override;
diff --git a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp b/src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp
deleted file mode 100644
index dd25a3ebae..0000000000
--- a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#include "requestsourcelocationforrenamingmessage.h"
-
-namespace ClangBackEnd {
-
-QDebug operator<<(QDebug debug, const RequestSourceLocationsForRenamingMessage &message)
-{
- debug.nospace() << "RequestSourceLocationsForRenamingMessage("
- << message.filePath << ", "
- << message.line << ", "
- << message.column << ", "
- << message.unsavedContent << ")";
-
- return debug;
-}
-
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.h b/src/libs/clangsupport/requestsourcelocationforrenamingmessage.h
deleted file mode 100644
index 9082e0dfaf..0000000000
--- a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangsupport_global.h"
-#include "filepath.h"
-
-#include <utils/smallstringvector.h>
-
-namespace ClangBackEnd {
-
-class CLANGSUPPORT_EXPORT RequestSourceLocationsForRenamingMessage
-{
-public:
- RequestSourceLocationsForRenamingMessage() = default;
- RequestSourceLocationsForRenamingMessage(FilePath &&filePath,
- uint line,
- uint column,
- Utils::SmallString &&unsavedContent,
- Utils::SmallStringVector &&commandLine,
- int textDocumentRevision)
- : filePath(std::move(filePath)),
- unsavedContent(std::move(unsavedContent)),
- commandLine(std::move(commandLine)),
- line(line),
- column(column),
- textDocumentRevision(textDocumentRevision)
- {}
-
- friend QDataStream &operator<<(QDataStream &out, const RequestSourceLocationsForRenamingMessage &message)
- {
- out << message.filePath;
- out << message.unsavedContent;
- out << message.commandLine;
- out << message.line;
- out << message.column;
- out << message.textDocumentRevision;
-
- return out;
- }
-
- friend QDataStream &operator>>(QDataStream &in, RequestSourceLocationsForRenamingMessage &message)
- {
- in >> message.filePath;
- in >> message.unsavedContent;
- in >> message.commandLine;
- in >> message.line;
- in >> message.column;
- in >> message.textDocumentRevision;
-
- return in;
- }
-
- friend bool operator==(const RequestSourceLocationsForRenamingMessage &first, const RequestSourceLocationsForRenamingMessage &second)
- {
- return first.filePath == second.filePath
- && first.line == second.line
- && first.column == second.column
- && first.textDocumentRevision == second.textDocumentRevision
- && first.unsavedContent == second.unsavedContent
- && first.commandLine == second.commandLine;
- }
-
- RequestSourceLocationsForRenamingMessage clone() const
- {
- return RequestSourceLocationsForRenamingMessage(filePath.clone(),
- line, column,
- unsavedContent.clone(),
- commandLine.clone(),
- textDocumentRevision);
- }
-
-public:
- FilePath filePath;
- Utils::SmallString unsavedContent;
- Utils::SmallStringVector commandLine;
- uint line = 1;
- uint column = 1;
- int textDocumentRevision = 1;
-};
-
-CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestSourceLocationsForRenamingMessage &message);
-
-DECLARE_MESSAGE(RequestSourceLocationsForRenamingMessage)
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp b/src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp
deleted file mode 100644
index 3490738531..0000000000
--- a/src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#include "sourcelocationsforrenamingmessage.h"
-
-namespace ClangBackEnd {
-
-QDebug operator<<(QDebug debug, const SourceLocationsForRenamingMessage &message)
-{
- debug.nospace() << "SourceLocationsForRenamingMessage("
- << message.sourceLocations
- << ")";
-
- return debug;
-}
-
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/sourcelocationsforrenamingmessage.h b/src/libs/clangsupport/sourcelocationsforrenamingmessage.h
deleted file mode 100644
index 5be072677c..0000000000
--- a/src/libs/clangsupport/sourcelocationsforrenamingmessage.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "sourcelocationscontainer.h"
-
-#include <utils/smallstring.h>
-
-namespace ClangBackEnd {
-
-class SourceLocationsForRenamingMessage
-{
-public:
- SourceLocationsForRenamingMessage() = default;
- SourceLocationsForRenamingMessage(Utils::SmallString &&symbolName,
- SourceLocationsContainer &&sourceLocationContainer,
- int textDocumentRevision)
- : symbolName(std::move(symbolName)),
- sourceLocations(std::move(sourceLocationContainer)),
- textDocumentRevision(textDocumentRevision)
- {}
-
- friend QDataStream &operator<<(QDataStream &out, const SourceLocationsForRenamingMessage &message)
- {
- out << message.symbolName;
- out << message.sourceLocations;
- out << message.textDocumentRevision;
-
- return out;
- }
-
- friend QDataStream &operator>>(QDataStream &in, SourceLocationsForRenamingMessage &message)
- {
- in >> message.symbolName;
- in >> message.sourceLocations;
- in >> message.textDocumentRevision;
-
- return in;
- }
-
- friend bool operator==(const SourceLocationsForRenamingMessage &first, const SourceLocationsForRenamingMessage &second)
- {
- return first.textDocumentRevision == second.textDocumentRevision
- && first.symbolName == second.symbolName
- && first.sourceLocations == second.sourceLocations;
- }
-
- SourceLocationsForRenamingMessage clone() const
- {
- return SourceLocationsForRenamingMessage(symbolName.clone(),
- sourceLocations.clone(),
- textDocumentRevision);
- }
-
-public:
- Utils::SmallString symbolName;
- SourceLocationsContainer sourceLocations;
- int textDocumentRevision = 0;
-};
-
-CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationsForRenamingMessage &message);
-
-DECLARE_MESSAGE(SourceLocationsForRenamingMessage)
-} // namespace ClangBackEnd
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 026b293e2d..5a187e4f1d 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -37,6 +37,8 @@
#include <cplusplus/Scope.h>
#include <cplusplus/Control.h>
+#include <utils/algorithm.h>
+
#include <QStack>
#include <QHash>
#include <QVarLengthArray>
@@ -1175,7 +1177,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
if (!name->isTemplateNameId())
_alreadyConsideredClasses.insert(referenceClass);
- QSet<ClassOrNamespace *> knownUsings = reference->usings().toSet();
+ QSet<ClassOrNamespace *> knownUsings = Utils::toSet(reference->usings());
// If we are dealling with a template type, more work is required, since we need to
// construct all instantiation data.
diff --git a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp
index f4dbd24c1a..3587fc366b 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp
@@ -50,6 +50,8 @@
#include "qmt/tasks/diagramscenecontroller.h"
#include "qmt/tasks/ielementtasks.h"
+#include <utils/algorithm.h>
+
#include <QSet>
#include <QGraphicsItem>
#include <QGraphicsSceneMouseEvent>
@@ -514,8 +516,8 @@ bool DiagramSceneModel::exportSvg(const QString &fileName, bool selectedElements
return true;
#else // QT_NO_SVG
- Q_UNUSED(fileName);
- Q_UNUSED(selectedElements);
+ Q_UNUSED(fileName)
+ Q_UNUSED(selectedElements)
return false;
#endif // QT_NO_SVG
}
@@ -639,7 +641,7 @@ void DiagramSceneModel::keyReleaseEvent(QKeyEvent *event)
void DiagramSceneModel::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- updateFocusItem(QSet<QGraphicsItem *>::fromList(m_graphicsScene->selectedItems()));
+ updateFocusItem(Utils::toSet(m_graphicsScene->selectedItems()));
m_latchController->mousePressEventLatching(event);
mousePressEventReparenting(event);
}
@@ -681,7 +683,7 @@ void DiagramSceneModel::mouseReleaseEventReparenting(QGraphicsSceneMouseEvent *e
if (event->modifiers() & Qt::AltModifier) {
ModelController *modelController = diagramController()->modelController();
MPackage *newOwner = nullptr;
- QSet<QGraphicsItem *> selectedItemSet = m_graphicsScene->selectedItems().toSet();
+ QSet<QGraphicsItem *> selectedItemSet = Utils::toSet(m_graphicsScene->selectedItems());
QList<QGraphicsItem *> itemsUnderMouse = m_graphicsScene->items(event->scenePos());
foreach (QGraphicsItem *item, itemsUnderMouse) {
if (!selectedItemSet.contains(item)) {
@@ -840,7 +842,7 @@ void DiagramSceneModel::onSelectionChanged()
bool selectionChanged = false;
// collect and update all primary selected items (selected by user)
- QSet<QGraphicsItem *> newSelectedItems = QSet<QGraphicsItem *>::fromList(m_graphicsScene->selectedItems());
+ QSet<QGraphicsItem *> newSelectedItems = Utils::toSet(m_graphicsScene->selectedItems());
updateFocusItem(newSelectedItems);
foreach (QGraphicsItem *item, m_selectedItems) {
if (!newSelectedItems.contains(item)) {
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/classitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/classitem.cpp
index 04b3acd77e..9c5345c417 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/classitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/classitem.cpp
@@ -52,6 +52,8 @@
#include "qmt/tasks/diagramscenecontroller.h"
#include "qmt/tasks/ielementtasks.h"
+#include <utils/algorithm.h>
+
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include <QGraphicsSimpleTextItem>
@@ -346,7 +348,7 @@ void ClassItem::relationDrawn(const QString &id, ObjectItem *targetItem, const Q
{ CustomRelation::Relationship::Aggregation, MAssociationEnd::Aggregation },
{ CustomRelation::Relationship::Composition, MAssociationEnd::Composition } };
diagramSceneController->modelController()->startUpdateRelation(mAssociation);
- mAssociation->setStereotypes(customRelation.stereotypes().toList());
+ mAssociation->setStereotypes(Utils::toList(customRelation.stereotypes()));
mAssociation->setName(customRelation.name());
MAssociationEnd endA;
endA.setCardinality(customRelation.endA().cardinality());
diff --git a/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp b/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp
index 9d1640ff6a..ae1974717b 100644
--- a/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp
+++ b/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp
@@ -130,7 +130,7 @@ QList<QString> StereotypeController::knownStereotypes(StereotypeIcon::Element st
if (icon.elements().isEmpty() || icon.elements().contains(stereotypeElement))
stereotypes += icon.stereotypes();
}
- QList<QString> list = stereotypes.toList();
+ QList<QString> list = Utils::toList(stereotypes);
std::sort(list.begin(), list.end());
return list;
}
diff --git a/src/libs/qmldebug/qmldebugconnection.cpp b/src/libs/qmldebug/qmldebugconnection.cpp
index 143277b379..629360a8bc 100644
--- a/src/libs/qmldebug/qmldebugconnection.cpp
+++ b/src/libs/qmldebug/qmldebugconnection.cpp
@@ -35,6 +35,8 @@
#include <QTcpServer>
#include <QTcpSocket>
+Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError)
+
namespace QmlDebug {
const int protocolVersion = 1;
@@ -244,6 +246,11 @@ void QmlDebugConnection::protocolReadyRead()
QmlDebugConnection::QmlDebugConnection(QObject *parent)
: QObject(parent), d_ptr(new QmlDebugConnectionPrivate)
{
+ static const int metaTypes[] = {
+ qRegisterMetaType<QAbstractSocket::SocketError>(),
+ qRegisterMetaType<QLocalSocket::LocalSocketError>()
+ };
+ Q_UNUSED(metaTypes);
}
QmlDebugConnection::~QmlDebugConnection()
@@ -343,9 +350,10 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
this, [this](QAbstractSocket::SocketError error) {
emit logError(socketErrorToString(error));
socketDisconnected();
- });
+ }, Qt::QueuedConnection);
connect(socket, &QAbstractSocket::connected, this, &QmlDebugConnection::socketConnected);
- connect(socket, &QAbstractSocket::disconnected, this, &QmlDebugConnection::socketDisconnected);
+ connect(socket, &QAbstractSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
+ Qt::QueuedConnection);
socket->connectToHost(hostName.isEmpty() ? QString("localhost") : hostName, port);
}
@@ -376,13 +384,14 @@ void QmlDebugConnection::newConnection()
QObject::connect(d->protocol, &QPacketProtocol::readyRead,
this, &QmlDebugConnection::protocolReadyRead);
- connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected);
+ connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
+ Qt::QueuedConnection);
connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
this, [this](QLocalSocket::LocalSocketError error) {
emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
socketDisconnected();
- });
+ }, Qt::QueuedConnection);
connect(socket, &QLocalSocket::stateChanged,
this, [this](QLocalSocket::LocalSocketState state) {
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index e5243830cd..cd6d024443 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -29,6 +29,7 @@
#include "qmljsutils.h"
#include "parser/qmljsast_p.h"
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QColor>
@@ -666,7 +667,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
_isQtQuick2 = isQtQuick2();
}
- _enabledMessages = Message::allMessageTypes().toSet();
+ _enabledMessages = Utils::toSet(Message::allMessageTypes());
disableMessage(HintAnonymousFunctionSpacing);
disableMessage(HintDeclareVarsInOneLine);
disableMessage(HintDeclarationsShouldBeAtStartOfFunction);
@@ -1539,7 +1540,7 @@ void Check::scanCommentsForAnnotations()
// enable all checks annotation
if (comment.contains("@enable-all-checks"))
- _enabledMessages = Message::allMessageTypes().toSet();
+ _enabledMessages = Utils::toSet(Message::allMessageTypes());
// find all disable annotations
int lastOffset = -1;
diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp
index afa8d58b3a..3f17846dab 100644
--- a/src/libs/qmljs/qmljsimportdependencies.cpp
+++ b/src/libs/qmljs/qmljsimportdependencies.cpp
@@ -27,6 +27,7 @@
#include "qmljsinterpreter.h"
#include "qmljsviewercontext.h"
+#include <utils/algorithm.h>
#include <utils/qrcparser.h>
#include <utils/qtcassert.h>
@@ -521,7 +522,7 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
{
QCryptographicHash hash(QCryptographicHash::Sha1);
rootImport.addToHash(hash);
- QStringList coreImports = allCoreImports.toList();
+ QStringList coreImports = Utils::toList(allCoreImports);
coreImports.sort();
foreach (const QString importId, coreImports) {
hash.addData(reinterpret_cast<const char*>(importId.constData()), importId.size() * sizeof(QChar));
@@ -529,9 +530,9 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
hash.addData(coreImportFingerprint);
}
hash.addData("/", 1);
- QList<ImportKey> imports(allImports.toList());
+ QList<ImportKey> imports = Utils::toList(allImports);
std::sort(imports.begin(), imports.end());
- foreach (const ImportKey &k, imports)
+ for (const ImportKey &k : qAsConst(imports))
k.addToHash(hash);
return hash.result();
}
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp
index aeef89372f..2c6afb61c0 100644
--- a/src/libs/qmljs/qmljsplugindumper.cpp
+++ b/src/libs/qmljs/qmljsplugindumper.cpp
@@ -29,8 +29,8 @@
#include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljsviewercontext.h>
-//#include <projectexplorer/session.h>
-//#include <coreplugin/messagemanager.h>
+
+#include <utils/algorithm.h>
#include <utils/filesystemwatcher.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
@@ -437,7 +437,7 @@ void PluginDumper::loadDependencies(const QStringList &dependencies,
}
QStringList newDependencies;
loadQmlTypeDescription(dependenciesPaths, errors, warnings, objects, 0, &newDependencies);
- newDependencies = (newDependencies.toSet() - *visitedPtr).toList();
+ newDependencies = Utils::toList(Utils::toSet(newDependencies) - *visitedPtr);
if (!newDependencies.isEmpty())
loadDependencies(newDependencies, errors, warnings, objects, visitedPtr.take());
}
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h
index 4b7231cca0..1e821a4bcb 100644
--- a/src/libs/utils/algorithm.h
+++ b/src/libs/utils/algorithm.h
@@ -1259,4 +1259,27 @@ OutputIterator set_union(InputIterator1 first1,
return Utils::set_union_impl(
first1, last1, first2, last2, result, std::less<typename InputIterator1::value_type>{});
}
+
+// Replacement for deprecated Qt functionality
+
+template <class T>
+QSet<T> toSet(const QList<T> &list)
+{
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ return list.toSet();
+#else
+ return QSet<T>(list.begin(), list.end());
+#endif
+}
+
+template <class T>
+QList<T> toList(const QSet<T> &set)
+{
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ return set.toList();
+#else
+ return QList<T>(set.begin(), set.end());
+#endif
+}
+
} // namespace Utils
diff --git a/src/libs/utils/codegeneration.cpp b/src/libs/utils/codegeneration.cpp
index 5843e843d9..697d876e0b 100644
--- a/src/libs/utils/codegeneration.cpp
+++ b/src/libs/utils/codegeneration.cpp
@@ -121,23 +121,23 @@ void writeQtIncludeSection(const QStringList &qt4,
qt4Only.subtract(common);
qt5Only.subtract(common);
- qtSection(common.toList(), str);
+ qtSection(Utils::toList(common), str);
if (!qt4Only.isEmpty() || !qt5Only.isEmpty()) {
if (addQtVersionCheck)
writeBeginQtVersionCheck(str);
- qtSection(qt5Only.toList(), str);
+ qtSection(Utils::toList(qt5Only), str);
if (addQtVersionCheck)
str << QLatin1String("#else\n");
- qtSection(qt4Only.toList(), str);
+ qtSection(Utils::toList(qt4Only), str);
if (addQtVersionCheck)
str << QLatin1String("#endif\n");
}
} else {
if (!qt5Only.isEmpty()) // default to Qt5
- qtSection(qt5Only.toList(), str);
+ qtSection(Utils::toList(qt5Only), str);
else
- qtSection(qt4Only.toList(), str);
+ qtSection(Utils::toList(qt4Only), str);
}
}
diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp
index 82004b8729..f197494b4c 100644
--- a/src/libs/utils/synchronousprocess.cpp
+++ b/src/libs/utils/synchronousprocess.cpp
@@ -24,16 +24,18 @@
****************************************************************************/
#include "synchronousprocess.h"
-#include "qtcassert.h"
+#include "executeondestruction.h"
#include "hostosinfo.h"
-#include "fileutils.h"
+#include "qtcassert.h"
+#include "qtcprocess.h"
#include <QDebug>
-#include <QTimer>
-#include <QTextCodec>
#include <QDir>
+#include <QLoggingCategory>
#include <QMessageBox>
+#include <QTextCodec>
#include <QThread>
+#include <QTimer>
#include <QApplication>
@@ -82,6 +84,8 @@ enum { defaultMaxHangTimerCount = 10 };
namespace Utils {
+Q_LOGGING_CATEGORY(processLog, "qtc.utils.synchronousprocess", QtWarningMsg);
+
// A special QProcess derivative allowing for terminal control.
class TerminalControllingProcess : public QProcess {
public:
@@ -445,8 +449,10 @@ static bool isGuiThread()
SynchronousProcessResponse SynchronousProcess::run(const CommandLine &cmd,
const QByteArray &writeData)
{
- if (debug)
- qDebug() << '>' << Q_FUNC_INFO << cmd.toUserOutput();
+ qCDebug(processLog).noquote() << "Starting:" << cmd.toUserOutput();
+ ExecuteOnDestruction logResult([this] {
+ qCDebug(processLog) << d->m_result;
+ });
d->clearForRun();
@@ -492,13 +498,16 @@ SynchronousProcessResponse SynchronousProcess::run(const CommandLine &cmd,
QApplication::restoreOverrideCursor();
}
- if (debug)
- qDebug() << '<' << Q_FUNC_INFO << cmd.executable().toString() << d->m_result;
return d->m_result;
}
SynchronousProcessResponse SynchronousProcess::runBlocking(const CommandLine &cmd)
{
+ qCDebug(processLog).noquote() << "Starting blocking:" << cmd.toUserOutput();
+ ExecuteOnDestruction logResult([this] {
+ qCDebug(processLog) << d->m_result;
+ });
+
d->clearForRun();
// On Windows, start failure is triggered immediately if the
diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp
index 09368133f3..632f68e9cf 100644
--- a/src/plugins/android/androiddebugsupport.cpp
+++ b/src/plugins/android/androiddebugsupport.cpp
@@ -82,15 +82,15 @@ static QStringList qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
paths.insert(it.fileInfo().absolutePath());
}
}
- return paths.toList();
+ return Utils::toList(paths);
}
static QStringList uniquePaths(const QStringList &files)
{
QSet<QString> paths;
- foreach (const QString &file, files)
- paths<<QFileInfo(file).absolutePath();
- return paths.toList();
+ for (const QString &file : files)
+ paths << QFileInfo(file).absolutePath();
+ return Utils::toList(paths);
}
static QStringList getSoLibSearchPath(const ProjectNode *node)
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index 72ab0c9984..d8e8b003c6 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -45,6 +45,7 @@
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditor.h>
+
#include <utils/algorithm.h>
#include <utils/utilsicons.h>
@@ -924,7 +925,7 @@ void AndroidManifestEditorWidget::parseManifest(QXmlStreamReader &reader, QXmlSt
QXmlStreamAttributes result = modifyXmlStreamAttributes(attributes, keys, values);
writer.writeAttributes(result);
- QSet<QString> permissions = m_permissionsModel->permissions().toSet();
+ QSet<QString> permissions = Utils::toSet(m_permissionsModel->permissions());
bool foundUsesSdk = false;
bool foundPermissionComment = false;
diff --git a/src/plugins/android/androidsdkmodel.cpp b/src/plugins/android/androidsdkmodel.cpp
index b72810688b..5506ad2378 100644
--- a/src/plugins/android/androidsdkmodel.cpp
+++ b/src/plugins/android/androidsdkmodel.cpp
@@ -306,7 +306,7 @@ void AndroidSdkModel::selectMissingEssentials()
QList<const AndroidSdkPackage *> AndroidSdkModel::userSelection() const
{
- return m_changeState.toList();
+ return Utils::toList(m_changeState);
}
void AndroidSdkModel::resetSelection()
diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp
index 8297289407..49f151da58 100644
--- a/src/plugins/autotest/gtest/gtestconfiguration.cpp
+++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp
@@ -58,18 +58,18 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted)
"--gtest_print_time="
};
- QSet<QString> allowed = Utils::filtered(provided.toSet(), [] (const QString &arg) {
+ QSet<QString> allowed = Utils::filtered(Utils::toSet(provided), [] (const QString &arg) {
return Utils::allOf(knownInterferingOptions, [&arg] (const QString &interfering) {
return !arg.startsWith(interfering);
});
});
if (omitted) {
- QSet<QString> providedSet = provided.toSet();
+ QSet<QString> providedSet = Utils::toSet(provided);
providedSet.subtract(allowed);
- omitted->append(providedSet.toList());
+ omitted->append(Utils::toList(providedSet));
}
- return allowed.toList();
+ return Utils::toList(allowed);
}
QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp
index ddedf4dc52..f03d9da923 100644
--- a/src/plugins/autotest/qtest/qttestparser.cpp
+++ b/src/plugins/autotest/qtest/qttestparser.cpp
@@ -239,7 +239,7 @@ static void fetchAndMergeBaseTestFunctions(const QSet<QString> &baseClasses,
const CPlusPlus::Document::Ptr &doc,
const CPlusPlus::Snapshot &snapshot)
{
- QList<QString> bases = baseClasses.toList();
+ QList<QString> bases = Utils::toList(baseClasses);
while (!bases.empty()) {
const QString base = bases.takeFirst();
TestVisitor baseVisitor(base, snapshot);
@@ -250,7 +250,7 @@ static void fetchAndMergeBaseTestFunctions(const QSet<QString> &baseClasses,
baseVisitor.accept(declaringDoc->globalNamespace());
if (!baseVisitor.resultValid())
continue;
- bases.append(baseVisitor.baseClasses().toList());
+ bases.append(Utils::toList(baseVisitor.baseClasses()));
mergeTestFunctions(testFunctions, baseVisitor.privateSlots());
}
}
diff --git a/src/plugins/baremetal/iarewtoolchain.cpp b/src/plugins/baremetal/iarewtoolchain.cpp
index ad70d78b16..79ed42e14e 100644
--- a/src/plugins/baremetal/iarewtoolchain.cpp
+++ b/src/plugins/baremetal/iarewtoolchain.cpp
@@ -87,7 +87,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id lang
CommandLine cmd(compiler, {fakeIn.fileName()});
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
- cmd.addArg("--ec++");
+ cmd.addArg("--c++");
cmd.addArg("--predef_macros");
cmd.addArg(outpath);
@@ -132,7 +132,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id lang
CommandLine cmd(compiler, {fakeIn.fileName()});
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
- cmd.addArg("--ec++");
+ cmd.addArg("--c++");
cmd.addArg("--preinclude");
cmd.addArg(".");
diff --git a/src/plugins/clangcodemodel/clangbackendcommunicator.cpp b/src/plugins/clangcodemodel/clangbackendcommunicator.cpp
index 28a31f0553..c411e0cfdf 100644
--- a/src/plugins/clangcodemodel/clangbackendcommunicator.cpp
+++ b/src/plugins/clangcodemodel/clangbackendcommunicator.cpp
@@ -252,7 +252,7 @@ void BackendCommunicator::documentsChangedFromCppEditorDocument(const QString &f
documentsChanged(filePath, document->contents(), document->revision());
}
-void BackendCommunicator::unsavedFielsUpdatedFromCppEditorDocument(const QString &filePath)
+void BackendCommunicator::unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath)
{
const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
QTC_ASSERT(document, return);
@@ -387,7 +387,7 @@ void BackendCommunicator::unsavedFilesUpdated(Core::IDocument *document)
{
QTC_ASSERT(document, return);
- unsavedFielsUpdatedFromCppEditorDocument(document->filePath().toString());
+ unsavedFilesUpdatedFromCppEditorDocument(document->filePath().toString());
}
void BackendCommunicator::onConnectedToBackend()
diff --git a/src/plugins/clangcodemodel/clangbackendcommunicator.h b/src/plugins/clangcodemodel/clangbackendcommunicator.h
index 58435d48a6..81f151581d 100644
--- a/src/plugins/clangcodemodel/clangbackendcommunicator.h
+++ b/src/plugins/clangcodemodel/clangbackendcommunicator.h
@@ -79,7 +79,7 @@ public:
const QByteArray &contents,
uint documentRevision);
void unsavedFilesUpdated(const FileContainers &fileContainers);
- void unsavedFielsUpdatedFromCppEditorDocument(const QString &filePath);
+ void unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath);
void unsavedFilesRemoved(const FileContainers &fileContainers);
void requestCompletions(ClangCompletionAssistProcessor *assistProcessor,
diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp
index 03917ebd13..4f7d34d800 100644
--- a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp
+++ b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp
@@ -96,10 +96,6 @@ public:
SymbolQuery<QuerySqliteReadStatementFactory> symbolQuery{statementFactory};
ClangBackEnd::ProjectPartsStorage<Sqlite::Database> projectPartsStorage{database};
RefactoringEngine engine{connectionClient.serverProxy(), refactoringClient, filePathCache, symbolQuery};
- QtCreatorSearch qtCreatorSearch;
- QtCreatorClangQueryFindFilter qtCreatorfindFilter{connectionClient.serverProxy(),
- qtCreatorSearch,
- refactoringClient};
QtCreatorRefactoringProjectUpdater projectUpdate{connectionClient.serverProxy(),
ClangPchManagerPlugin::pchManagerClient(),
filePathCache,
@@ -123,7 +119,6 @@ bool ClangRefactoringPlugin::initialize(const QStringList & /*arguments*/, QStri
d->refactoringClient.setRefactoringEngine(&d->engine);
d->refactoringClient.setRefactoringConnectionClient(&d->connectionClient);
- ExtensionSystem::PluginManager::addObject(&d->qtCreatorfindFilter);
connectBackend();
startBackend();
@@ -142,7 +137,6 @@ void ClangRefactoringPlugin::extensionsInitialized()
ExtensionSystem::IPlugin::ShutdownFlag ClangRefactoringPlugin::aboutToShutdown()
{
- ExtensionSystem::PluginManager::removeObject(&d->qtCreatorfindFilter);
CppTools::CppModelManager::removeRefactoringEngine(
CppTools::RefactoringEngineType::ClangRefactoring);
d->refactoringClient.setRefactoringConnectionClient(nullptr);
diff --git a/src/plugins/clangrefactoring/qtcreatorclangqueryfindfilter.cpp b/src/plugins/clangrefactoring/qtcreatorclangqueryfindfilter.cpp
index b4ab35e851..05c378b196 100644
--- a/src/plugins/clangrefactoring/qtcreatorclangqueryfindfilter.cpp
+++ b/src/plugins/clangrefactoring/qtcreatorclangqueryfindfilter.cpp
@@ -130,7 +130,8 @@ void QtCreatorClangQueryFindFilter::prepareFind()
const CppTools::ProjectInfo projectInfo = CppTools::CppModelManager::instance()->projectInfo(currentProject);
- setProjectParts(projectInfo.projectParts().toStdVector());
+ const QVector<CppTools::ProjectPart::Ptr> parts = projectInfo.projectParts();
+ setProjectParts({parts.begin(), parts.end()});
setUnsavedContent(createUnsavedContents());
}
diff --git a/src/plugins/clangrefactoring/refactoringclient.cpp b/src/plugins/clangrefactoring/refactoringclient.cpp
index 3bdeb9dd53..e39e27a22a 100644
--- a/src/plugins/clangrefactoring/refactoringclient.cpp
+++ b/src/plugins/clangrefactoring/refactoringclient.cpp
@@ -40,16 +40,6 @@ void RefactoringClient::alive()
m_connectionClient->resetProcessAliveTimer();
}
-void RefactoringClient::sourceLocationsForRenamingMessage(
- ClangBackEnd::SourceLocationsForRenamingMessage &&message)
-{
- m_localRenamingCallback(message.symbolName.toQString(),
- message.sourceLocations,
- message.textDocumentRevision);
-
- m_refactoringEngine->setRefactoringEngineAvailable(true);
-}
-
void RefactoringClient::sourceRangesAndDiagnosticsForQueryMessage(
ClangBackEnd::SourceRangesAndDiagnosticsForQueryMessage &&message)
{
@@ -64,12 +54,6 @@ void RefactoringClient::sourceRangesForQueryMessage(ClangBackEnd::SourceRangesFo
setResultCounterAndSendSearchIsFinishedIfFinished();
}
-void RefactoringClient::setLocalRenamingCallback(
- CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback)
-{
- m_localRenamingCallback = std::move(localRenamingCallback);
-}
-
void RefactoringClient::progress(ClangBackEnd::ProgressMessage &&message)
{
m_progressManager.setProgress(message.progress, message.total);
@@ -100,11 +84,6 @@ void RefactoringClient::setClangQueryHighlighter(ClangQueryHighlighter *highligh
m_clangQueryHighlighter = highlighter;
}
-bool RefactoringClient::hasValidLocalRenamingCallback() const
-{
- return bool(m_localRenamingCallback);
-}
-
void RefactoringClient::setExpectedResultCount(uint count)
{
m_expectedResultCount = count;
diff --git a/src/plugins/clangrefactoring/refactoringclient.h b/src/plugins/clangrefactoring/refactoringclient.h
index f3d9e218e5..a68fe39211 100644
--- a/src/plugins/clangrefactoring/refactoringclient.h
+++ b/src/plugins/clangrefactoring/refactoringclient.h
@@ -54,15 +54,11 @@ public:
{}
void alive() override;
- void sourceLocationsForRenamingMessage(
- ClangBackEnd::SourceLocationsForRenamingMessage &&message) override;
void sourceRangesAndDiagnosticsForQueryMessage(
ClangBackEnd::SourceRangesAndDiagnosticsForQueryMessage &&message) override;
void sourceRangesForQueryMessage(
ClangBackEnd::SourceRangesForQueryMessage &&message) override;
- void setLocalRenamingCallback(
- CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback) override;
void progress(ClangBackEnd::ProgressMessage &&message) override;
void setRefactoringEngine(ClangRefactoring::RefactoringEngine *refactoringEngine);
@@ -71,8 +67,6 @@ public:
void setClangQueryExampleHighlighter(ClangQueryExampleHighlighter *highlighter);
void setClangQueryHighlighter(ClangQueryHighlighter *highlighter);
- bool hasValidLocalRenamingCallback() const;
-
void setExpectedResultCount(uint count);
uint expectedResultCount() const;
uint resultCounter() const;
@@ -90,7 +84,6 @@ private:
void sendSearchIsFinished();
private:
- CppTools::RefactoringEngineInterface::RenameCallback m_localRenamingCallback;
ClangBackEnd::RefactoringConnectionClient *m_connectionClient = nullptr;
SearchHandle *m_searchHandle = nullptr;
RefactoringEngine *m_refactoringEngine = nullptr;
diff --git a/src/plugins/clangrefactoring/refactoringengine.cpp b/src/plugins/clangrefactoring/refactoringengine.cpp
index 38f857ef1c..cc9121331d 100644
--- a/src/plugins/clangrefactoring/refactoringengine.cpp
+++ b/src/plugins/clangrefactoring/refactoringengine.cpp
@@ -28,7 +28,6 @@
#include <filepath.h>
#include <refactoringserverinterface.h>
-#include <requestsourcelocationforrenamingmessage.h>
#include <cpptools/compileroptionsbuilder.h>
#include <cpptools/cpptoolsreuse.h>
@@ -47,7 +46,6 @@
namespace ClangRefactoring {
-using ClangBackEnd::RequestSourceLocationsForRenamingMessage;
RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &server,
ClangBackEnd::RefactoringClientInterface &client,
@@ -62,34 +60,10 @@ RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &s
RefactoringEngine::~RefactoringEngine() = default;
-void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
- CppTools::ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback)
+void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &,
+ CppTools::ProjectPart *,
+ RenameCallback &&)
{
- using CppTools::CompilerOptionsBuilder;
-
- setRefactoringEngineAvailable(false);
-
- m_client.setLocalRenamingCallback(std::move(renameSymbolsCallback));
-
- QString filePath = data.filePath().toString();
- QTextCursor textCursor = data.cursor();
- CompilerOptionsBuilder optionsBuilder{*projectPart, CppTools::UseSystemHeader::Yes};
- Utils::SmallStringVector commandLine{optionsBuilder.build(
- fileKindInProjectPart(projectPart, filePath),
- CppTools::getPchUsage())};
-
- commandLine.push_back(filePath);
-
- RequestSourceLocationsForRenamingMessage message(ClangBackEnd::FilePath(filePath),
- uint(textCursor.blockNumber() + 1),
- uint(textCursor.positionInBlock() + 1),
- textCursor.document()->toPlainText(),
- std::move(commandLine),
- textCursor.document()->revision());
-
-
- m_server.requestSourceLocationsForRenamingMessage(std::move(message));
}
CppTools::Usages RefactoringEngine::locationsAt(const CppTools::CursorInEditor &data) const
diff --git a/src/plugins/clangtools/clangtoolsprojectsettings.cpp b/src/plugins/clangtools/clangtoolsprojectsettings.cpp
index 55573c8ee6..862030b950 100644
--- a/src/plugins/clangtools/clangtoolsprojectsettings.cpp
+++ b/src/plugins/clangtools/clangtoolsprojectsettings.cpp
@@ -128,10 +128,10 @@ void ClangToolsProjectSettings::store()
m_project->setNamedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG, m_diagnosticConfig.toSetting());
m_project->setNamedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS, m_buildBeforeAnalysis);
- const QStringList dirs = Utils::transform(m_selectedDirs.toList(), &Utils::FilePath::toString);
+ const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString);
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs);
- const QStringList files = Utils::transform(m_selectedFiles.toList(), &Utils::FilePath::toString);
+ const QStringList files = Utils::transform<QList>(m_selectedFiles, &Utils::FilePath::toString);
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_FILES, files);
QVariantList list;
diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp
index 34b6de2950..0ba865c7f2 100644
--- a/src/plugins/classview/classviewparser.cpp
+++ b/src/plugins/classview/classviewparser.cpp
@@ -587,8 +587,7 @@ void Parser::clearCache()
void Parser::setFileList(const QStringList &fileList)
{
- d->fileList.clear();
- d->fileList = QSet<QString>::fromList(fileList);
+ d->fileList = ::Utils::toSet(fileList);
}
/*!
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 9379875e64..5544965ece 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -339,7 +339,7 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
{
CMakeConfigItem paths;
paths.key = "ANDROID_SO_LIBS_PATHS";
- paths.values = res.toList();
+ paths.values = Utils::toList(res);
patchedConfig.append(paths);
}
diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.cpp b/src/plugins/cmakeprojectmanager/tealeafreader.cpp
index fb941604dd..a98d5b1eef 100644
--- a/src/plugins/cmakeprojectmanager/tealeafreader.cpp
+++ b/src/plugins/cmakeprojectmanager/tealeafreader.cpp
@@ -273,7 +273,7 @@ std::unique_ptr<CMakeProjectNode> TeaLeafReader::generateProjectTree(
= Utils::filtered(bt.includeFiles, [this](const Utils::FilePath &fn) {
return fn.isChildOf(m_parameters.sourceDirectory);
});
- allIncludePathSet.unite(QSet<FilePath>::fromList(targetIncludePaths));
+ allIncludePathSet.unite(Utils::toSet(targetIncludePaths));
}
const QList<FilePath> allIncludePaths = allIncludePathSet.toList();
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index bde6f8a4a8..3939703cb6 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -43,6 +43,7 @@
#include <extensionsystem/pluginmanager.h>
+#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/globalfilechangeblocker.h>
#include <utils/hostosinfo.h>
@@ -743,7 +744,7 @@ QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter
}
}
- QStringList filters = uniqueFilters.toList();
+ QStringList filters = Utils::toList(uniqueFilters);
filters.sort();
const QString allFiles = Utils::allFilesFilterString();
if (allFilesFilter)
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index a3b4493991..2c26d50214 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1424,7 +1424,7 @@ bool EditorManagerPrivate::closeEditors(const QList<IEditor*> &editors, CloseFla
return false;
if (!rejectedList.isEmpty()) {
closingFailed = true;
- QSet<IEditor*> skipSet = DocumentModel::editorsForDocuments(rejectedList).toSet();
+ QSet<IEditor*> skipSet = Utils::toSet(DocumentModel::editorsForDocuments(rejectedList));
acceptedEditors = acceptedEditors.subtract(skipSet);
}
}
@@ -1490,7 +1490,7 @@ bool EditorManagerPrivate::closeEditors(const QList<IEditor*> &editors, CloseFla
}
}
- emit m_instance->editorsClosed(acceptedEditors.toList());
+ emit m_instance->editorsClosed(Utils::toList(acceptedEditors));
foreach (IEditor *editor, acceptedEditors)
delete editor;
diff --git a/src/plugins/coreplugin/id.cpp b/src/plugins/coreplugin/id.cpp
index 6e081746ae..8e3523b6b9 100644
--- a/src/plugins/coreplugin/id.cpp
+++ b/src/plugins/coreplugin/id.cpp
@@ -241,12 +241,12 @@ Id Id::versionedId(const QByteArray &prefix, int major, int minor)
QSet<Id> Id::fromStringList(const QStringList &list)
{
- return QSet<Id>::fromList(Utils::transform(list, &Id::fromString));
+ return Utils::transform<QSet<Id>>(list, &Id::fromString);
}
QStringList Id::toStringList(const QSet<Id> &ids)
{
- QList<Id> idList = ids.toList();
+ QList<Id> idList = Utils::toList(ids);
Utils::sort(idList);
return Utils::transform(idList, &Id::toString);
}
diff --git a/src/plugins/coreplugin/jsexpander.cpp b/src/plugins/coreplugin/jsexpander.cpp
index 4ee72752e5..22a4562685 100644
--- a/src/plugins/coreplugin/jsexpander.cpp
+++ b/src/plugins/coreplugin/jsexpander.cpp
@@ -36,6 +36,7 @@
#include <unordered_map>
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
namespace std {
template<> struct hash<QString>
{
@@ -47,6 +48,7 @@ template<> struct hash<QString>
}
};
} // namespace std
+#endif
using ExtensionMap = std::unordered_map<QString, Core::JsExpander::ObjectFactory>;
Q_GLOBAL_STATIC(ExtensionMap, globalJsExtensions);
diff --git a/src/plugins/coreplugin/locator/locatorsettingspage.cpp b/src/plugins/coreplugin/locator/locatorsettingspage.cpp
index d1b2df2183..5e35f2058c 100644
--- a/src/plugins/coreplugin/locator/locatorsettingspage.cpp
+++ b/src/plugins/coreplugin/locator/locatorsettingspage.cpp
@@ -31,6 +31,8 @@
#include "locatorconstants.h"
#include <coreplugin/coreconstants.h>
+
+#include <utils/algorithm.h>
#include <utils/categorysortfiltermodel.h>
#include <utils/headerviewstretcher.h>
#include <utils/qtcassert.h>
@@ -287,7 +289,7 @@ void LocatorSettingsPage::initializeModel()
ILocatorFilter::msgIncludeByDefaultToolTip()
});
m_model->clear();
- QSet<ILocatorFilter *> customFilterSet = m_customFilters.toSet();
+ QSet<ILocatorFilter *> customFilterSet = Utils::toSet(m_customFilters);
auto builtIn = new CategoryItem(tr("Built-in"), 0/*order*/);
for (ILocatorFilter *filter : qAsConst(m_filters))
if (!filter->isHidden() && !customFilterSet.contains(filter))
diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp
index e55ac8a665..6877497884 100644
--- a/src/plugins/cppeditor/cppeditorwidget.cpp
+++ b/src/plugins/cppeditor/cppeditorwidget.cpp
@@ -382,7 +382,7 @@ static void onReplaceUsagesClicked(const QString &text,
const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
if (!fileNames.isEmpty()) {
- modelManager->updateSourceFiles(fileNames.toSet());
+ modelManager->updateSourceFiles(Utils::toSet(fileNames));
SearchResultWindow::instance()->hide();
}
}
diff --git a/src/plugins/cppeditor/cppinsertvirtualmethods.cpp b/src/plugins/cppeditor/cppinsertvirtualmethods.cpp
index 748c48cf0b..1f2650ac63 100644
--- a/src/plugins/cppeditor/cppinsertvirtualmethods.cpp
+++ b/src/plugins/cppeditor/cppinsertvirtualmethods.cpp
@@ -36,6 +36,8 @@
#include <cplusplus/CppRewriter.h>
#include <cplusplus/Overview.h>
+
+#include <utils/algorithm.h>
#include <utils/changeset.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
@@ -1086,11 +1088,11 @@ void InsertVirtualMethodsDialog::saveSettings()
m_settings->overrideReplacementIndex = m_overrideReplacementComboBox->currentIndex();
if (m_overrideReplacementComboBox && m_overrideReplacementComboBox->isEnabled())
m_settings->overrideReplacement = m_overrideReplacementComboBox->currentText().trimmed();
- QSet<QString> addedReplacements = m_availableOverrideReplacements.toSet();
+ QSet<QString> addedReplacements = Utils::toSet(m_availableOverrideReplacements);
addedReplacements.insert(m_settings->overrideReplacement);
- addedReplacements.subtract(defaultOverrideReplacements().toSet());
+ addedReplacements.subtract(Utils::toSet(defaultOverrideReplacements()));
m_settings->userAddedOverrideReplacements =
- sortedAndTrimmedStringListWithoutEmptyElements(addedReplacements.toList());
+ sortedAndTrimmedStringListWithoutEmptyElements(Utils::toList(addedReplacements));
m_settings->write();
}
diff --git a/src/plugins/cpptools/builtineditordocumentparser.cpp b/src/plugins/cpptools/builtineditordocumentparser.cpp
index a8f44e1e0c..4af8cb9028 100644
--- a/src/plugins/cpptools/builtineditordocumentparser.cpp
+++ b/src/plugins/cpptools/builtineditordocumentparser.cpp
@@ -29,6 +29,7 @@
#include <projectexplorer/projectmacro.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
using namespace CPlusPlus;
@@ -269,7 +270,7 @@ void BuiltinEditorDocumentParser::addFileAndDependencies(Snapshot *snapshot,
toRemove->insert(fileName);
if (fileName != Utils::FilePath::fromString(filePath())) {
Utils::FilePathList deps = snapshot->filesDependingOn(fileName);
- toRemove->unite(QSet<Utils::FilePath>::fromList(deps));
+ toRemove->unite(Utils::toSet(deps));
}
}
diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp
index 3677cefc29..484c3adcd5 100644
--- a/src/plugins/cpptools/builtinindexingsupport.cpp
+++ b/src/plugins/cpptools/builtinindexingsupport.cpp
@@ -197,7 +197,7 @@ void index(QFutureInterface<void> &indexingFuture,
const int sourceCount = sources.size();
QStringList files = sources + headers;
- sourceProcessor->setTodo(files.toSet());
+ sourceProcessor->setTodo(Utils::toSet(files));
const QString conf = CppModelManager::configurationFileName();
bool processingHeaders = false;
diff --git a/src/plugins/cpptools/clangdiagnosticconfigswidget.cpp b/src/plugins/cpptools/clangdiagnosticconfigswidget.cpp
index 01164bfb1a..58589a5308 100644
--- a/src/plugins/cpptools/clangdiagnosticconfigswidget.cpp
+++ b/src/plugins/cpptools/clangdiagnosticconfigswidget.cpp
@@ -381,7 +381,7 @@ private:
levelNode->childDirectories.append(checkNode);
- m_topics.unite(check.topics.toSet());
+ m_topics.unite(Utils::toSet(check.topics));
}
}
@@ -1003,7 +1003,7 @@ void ClangDiagnosticConfigsWidget::setupTabs()
setupTreeView(m_clazyChecks->checksView, m_clazySortFilterProxyModel, 2);
m_clazyChecks->checksView->setSortingEnabled(true);
m_clazyChecks->checksView->sortByColumn(0, Qt::AscendingOrder);
- auto topicsModel = new QStringListModel(m_clazyTreeModel->topics().toList(), this);
+ auto topicsModel = new QStringListModel(Utils::toList(m_clazyTreeModel->topics()), this);
topicsModel->sort(0);
m_clazyChecks->topicsView->setModel(topicsModel);
connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, [this](){
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index b8dd817835..b8ba85fc15 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -388,7 +388,7 @@ void CppToolsPlugin::test_global_completion()
QVERIFY(test.succeededSoFar());
const QStringList completions = test.getCompletions();
QVERIFY(isProbablyGlobalCompletion(completions));
- QVERIFY(completions.toSet().contains(requiredCompletionItems.toSet()));
+ QVERIFY(Utils::toSet(completions).contains(Utils::toSet(requiredCompletionItems)));
}
void CppToolsPlugin::test_doxygen_tag_completion_data()
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index e277edeb4f..f5c4405acd 100644
--- a/src/plugins/cpptools/cppfindreferences.cpp
+++ b/src/plugins/cpptools/cppfindreferences.cpp
@@ -402,7 +402,7 @@ void CppFindReferences::onReplaceButtonClicked(const QString &text,
{
const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
if (!fileNames.isEmpty()) {
- m_modelManager->updateSourceFiles(fileNames.toSet());
+ m_modelManager->updateSourceFiles(Utils::toSet(fileNames));
SearchResultWindow::instance()->hide();
}
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index c82355b31b..ea083c8eb6 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -479,7 +479,7 @@ void CppModelManager::initCppTools()
this, &CppModelManager::updateModifiedSourceFiles);
connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedInternally,
[this](const QStringList &files) {
- updateSourceFiles(files.toSet());
+ updateSourceFiles(Utils::toSet(files));
});
connect(this, &CppModelManager::documentUpdated,
@@ -925,7 +925,7 @@ public:
{
QSet<QString> removed = projectPartIds(m_old.projectParts());
removed.subtract(projectPartIds(m_new.projectParts()));
- return removed.toList();
+ return Utils::toList(removed);
}
/// Returns a list of common files that have a changed timestamp.
@@ -1020,7 +1020,7 @@ void CppModelManager::updateCppEditorDocuments(bool projectsUpdated) const
// Mark invisible documents dirty
QSet<Core::IDocument *> invisibleCppEditorDocuments
- = Core::DocumentModel::openedDocuments().toSet();
+ = Utils::toSet(Core::DocumentModel::openedDocuments());
invisibleCppEditorDocuments.subtract(visibleCppEditorDocuments);
foreach (Core::IDocument *document, invisibleCppEditorDocuments) {
const QString filePath = document->filePath().toString();
@@ -1085,7 +1085,7 @@ QFuture<void> CppModelManager::updateProjectInfo(QFutureInterface<void> &futureI
const QSet<QString> removedFiles = comparer.removedFiles();
if (!removedFiles.isEmpty()) {
filesRemoved = true;
- emit aboutToRemoveFiles(removedFiles.toList());
+ emit aboutToRemoveFiles(Utils::toList(removedFiles));
removeFilesFromSnapshot(removedFiles);
}
}
@@ -1150,9 +1150,8 @@ QList<ProjectPart::Ptr> CppModelManager::projectPartFromDependencies(
const Utils::FilePathList deps = snapshot().filesDependingOn(fileName);
QMutexLocker locker(&d->m_projectMutex);
- foreach (const Utils::FilePath &dep, deps) {
- parts.unite(QSet<ProjectPart::Ptr>::fromList(d->m_fileToProjectParts.value(dep)));
- }
+ for (const Utils::FilePath &dep : deps)
+ parts.unite(Utils::toSet(d->m_fileToProjectParts.value(dep)));
return parts.values();
}
@@ -1218,10 +1217,10 @@ void CppModelManager::delayedGC()
static QStringList removedProjectParts(const QStringList &before, const QStringList &after)
{
- QSet<QString> b = before.toSet();
- b.subtract(after.toSet());
+ QSet<QString> b = Utils::toSet(before);
+ b.subtract(Utils::toSet(after));
- return b.toList();
+ return Utils::toList(b);
}
void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index ceab10028e..02586943da 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -568,7 +568,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
{"foo.h", "foo.cpp", "main.cpp"});
refreshedFiles = helper.updateProjectInfo(project1.projectInfo);
- QCOMPARE(refreshedFiles, project1.projectFiles.toSet());
+ QCOMPARE(refreshedFiles, Utils::toSet(project1.projectFiles));
const int snapshotSizeAfterProject1 = mm->snapshot().size();
foreach (const QString &file, project1.projectFiles)
@@ -580,7 +580,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
{"bar.h", "bar.cpp", "main.cpp"});
refreshedFiles = helper.updateProjectInfo(project2.projectInfo);
- QCOMPARE(refreshedFiles, project2.projectFiles.toSet());
+ QCOMPARE(refreshedFiles, Utils::toSet(project2.projectFiles));
const int snapshotSizeAfterProject2 = mm->snapshot().size();
QVERIFY(snapshotSizeAfterProject2 > snapshotSizeAfterProject1);
diff --git a/src/plugins/cpptools/symbolsfindfilter.cpp b/src/plugins/cpptools/symbolsfindfilter.cpp
index 93f4643587..404a4209a6 100644
--- a/src/plugins/cpptools/symbolsfindfilter.cpp
+++ b/src/plugins/cpptools/symbolsfindfilter.cpp
@@ -129,7 +129,7 @@ void SymbolsFindFilter::startSearch(SearchResult *search)
QSet<QString> projectFileNames;
if (parameters.scope == SymbolSearcher::SearchProjectsOnly) {
for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects())
- projectFileNames += Utils::transform(project->files(ProjectExplorer::Project::AllFiles), &Utils::FilePath::toString).toSet();
+ projectFileNames += Utils::transform<QSet>(project->files(ProjectExplorer::Project::AllFiles), &Utils::FilePath::toString);
}
auto watcher = new QFutureWatcher<SearchResultItem>;
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 2fd197c618..ec8c062b04 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -2439,7 +2439,7 @@ GlobalBreakpoints BreakpointManager::findBreakpointsByIndex(const QList<QModelIn
if (GlobalBreakpoint gbp = findBreakpointByIndex(index))
items.insert(gbp);
}
- return items.toList();
+ return Utils::toList(items);
}
GlobalBreakpoint BreakpointManager::createBreakpoint(const BreakpointParameters &params)
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index 82bb009cc2..561c9e6e95 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -506,7 +506,7 @@ void DebuggerMainWindow::savePersistentSettings()
QSettings *settings = ICore::settings();
settings->beginGroup(MAINWINDOW_KEY);
- settings->setValue(CHANGED_DOCK_KEY, QStringList(changedDocks.toList()));
+ settings->setValue(CHANGED_DOCK_KEY, QStringList(Utils::toList(changedDocks)));
settings->setValue(STATE_KEY, states);
settings->setValue(AUTOHIDE_TITLEBARS_KEY, theMainWindow->autoHideTitleBars());
settings->setValue(SHOW_CENTRALWIDGET_KEY, theMainWindow->isCentralWidgetShown());
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index 2ad12ff682..611e714abd 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -259,13 +259,13 @@ ToolTipWatchItem::ToolTipWatchItem(TreeItem *item)
{
const QAbstractItemModel *model = item->model();
QModelIndex idx = item->index();
- name = model->data(idx.sibling(idx.row(), 0), Qt::DisplayRole).toString();
- value = model->data(idx.sibling(idx.row(), 1), Qt::DisplayRole).toString();
- type = model->data(idx.sibling(idx.row(), 2), Qt::DisplayRole).toString();
- iname = model->data(idx.sibling(idx.row(), 0), LocalsINameRole).toString();
- valueColor = model->data(idx.sibling(idx.row(), 1), Qt::ForegroundRole).value<QColor>();
+ name = model->data(idx.sibling(idx.row(), WatchModelBase::NameColumn), Qt::DisplayRole).toString();
+ value = model->data(idx.sibling(idx.row(), WatchModelBase::ValueColumn), Qt::DisplayRole).toString();
+ type = model->data(idx.sibling(idx.row(), WatchModelBase::TypeColumn), Qt::DisplayRole).toString();
+ iname = model->data(idx.sibling(idx.row(), WatchModelBase::NameColumn), LocalsINameRole).toString();
+ valueColor = model->data(idx.sibling(idx.row(), WatchModelBase::ValueColumn), Qt::ForegroundRole).value<QColor>();
expandable = model->hasChildren(idx);
- expression = model->data(idx.sibling(idx.row(), 0), Qt::EditRole).toString();
+ expression = model->data(idx.sibling(idx.row(), WatchModelBase::NameColumn), Qt::EditRole).toString();
for (TreeItem *child : *item)
appendChild(new ToolTipWatchItem(child));
}
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 955f3f6062..adb77c7c0d 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -4139,6 +4139,8 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
// Process input for a sub-mode.
if (input.isEscape()) {
handled = handleEscape();
+ } else if (m_wasReadOnly) {
+ return EventUnhandled;
} else if (g.subsubmode != NoSubSubMode) {
handled = handleCommandSubSubMode(input);
} else if (g.submode == NoSubMode) {
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp
index bf74f7b32c..8af16f80ee 100644
--- a/src/plugins/git/branchmodel.cpp
+++ b/src/plugins/git/branchmodel.cpp
@@ -602,15 +602,15 @@ void BranchModel::removeTag(const QModelIndex &idx)
removeNode(idx);
}
-void BranchModel::checkoutBranch(const QModelIndex &idx)
+VcsCommand *BranchModel::checkoutBranch(const QModelIndex &idx)
{
QString branch = fullName(idx, !isLocal(idx));
if (branch.isEmpty())
- return;
+ return nullptr;
// No StashGuard since this function for now is only used with clean working dir.
// If it is ever used from another place, please add StashGuard here
- d->client->checkout(d->workingDirectory, branch, GitClient::StashMode::NoStash);
+ return d->client->checkout(d->workingDirectory, branch, GitClient::StashMode::NoStash);
}
bool BranchModel::branchIsMerged(const QModelIndex &idx)
diff --git a/src/plugins/git/branchmodel.h b/src/plugins/git/branchmodel.h
index 5c163801fd..2a0de65bbe 100644
--- a/src/plugins/git/branchmodel.h
+++ b/src/plugins/git/branchmodel.h
@@ -30,6 +30,8 @@
#include <QAbstractListModel>
#include <QVariant>
+namespace VcsBase { class VcsCommand; }
+
namespace Git {
namespace Internal {
@@ -78,7 +80,7 @@ public:
void removeBranch(const QModelIndex &idx);
void removeTag(const QModelIndex &idx);
- void checkoutBranch(const QModelIndex &idx);
+ VcsBase::VcsCommand *checkoutBranch(const QModelIndex &idx);
bool branchIsMerged(const QModelIndex &idx);
QModelIndex addBranch(const QString &name, bool track, const QModelIndex &trackedBranch);
void setRemoteTracking(const QModelIndex &trackingIndex);
diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp
index 21f9c63e14..686e3f796a 100644
--- a/src/plugins/git/branchview.cpp
+++ b/src/plugins/git/branchview.cpp
@@ -41,6 +41,7 @@
#include <utils/navigationtreeview.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
+#include <vcsbase/vcscommand.h>
#include <vcsbase/vcsoutputwindow.h>
#include <QDir>
@@ -382,21 +383,28 @@ bool BranchView::checkout()
return false;
}
- m_model->checkoutBranch(selected);
-
- QString stashName;
- client->synchronousStashList(m_repository, &stashes);
- for (const Stash &stash : qAsConst(stashes)) {
- if (stash.message.startsWith(popMessageStart)) {
- stashName = stash.name;
- break;
- }
+ VcsBase::VcsCommand *command = m_model->checkoutBranch(selected);
+ const bool moveChanges = branchCheckoutDialog.moveLocalChangesToNextBranch();
+ const bool popStash = branchCheckoutDialog.popStashOfNextBranch();
+ if (command && (moveChanges || popStash)) {
+ connect(command, &VcsBase::VcsCommand::finished,
+ this, [this, client, popMessageStart, moveChanges, popStash] {
+ if (moveChanges) {
+ client->endStashScope(m_repository);
+ } else if (popStash) {
+ QList<Stash> stashes;
+ QString stashName;
+ client->synchronousStashList(m_repository, &stashes);
+ for (const Stash &stash : qAsConst(stashes)) {
+ if (stash.message.startsWith(popMessageStart)) {
+ stashName = stash.name;
+ break;
+ }
+ }
+ client->synchronousStashRestore(m_repository, stashName, true);
+ }
+ });
}
-
- if (branchCheckoutDialog.moveLocalChangesToNextBranch())
- client->endStashScope(m_repository);
- else if (branchCheckoutDialog.popStashOfNextBranch())
- client->synchronousStashRestore(m_repository, stashName, true);
}
if (QTC_GUARD(m_branchView))
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 9ddcdd77e3..c57a291ac1 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1163,11 +1163,11 @@ VcsBaseEditorWidget *GitClient::annotate(
return editor;
}
-void GitClient::checkout(const QString &workingDirectory, const QString &ref,
- StashMode stashMode)
+VcsCommand *GitClient::checkout(const QString &workingDirectory, const QString &ref,
+ StashMode stashMode)
{
if (stashMode == StashMode::TryStash && !beginStashScope(workingDirectory, "Checkout"))
- return;
+ return nullptr;
QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
VcsCommand *command = vcsExec(
workingDirectory, arguments, nullptr, true,
@@ -1179,6 +1179,7 @@ void GitClient::checkout(const QString &workingDirectory, const QString &ref,
if (success)
updateSubmodulesIfNeeded(workingDirectory, true);
});
+ return command;
}
/* method used to setup arguments for checkout, in case user wants to create local branch */
@@ -2848,9 +2849,9 @@ GitClient::RevertResult GitClient::revertI(QStringList files,
QStringList stagedFiles = allStagedFiles;
QStringList unstagedFiles = allUnstagedFiles;
if (!isDirectory) {
- const QSet<QString> filesSet = files.toSet();
- stagedFiles = allStagedFiles.toSet().intersect(filesSet).toList();
- unstagedFiles = allUnstagedFiles.toSet().intersect(filesSet).toList();
+ const QSet<QString> filesSet = Utils::toSet(files);
+ stagedFiles = Utils::toList(Utils::toSet(allStagedFiles).intersect(filesSet));
+ unstagedFiles = Utils::toList(Utils::toSet(allUnstagedFiles).intersect(filesSet));
}
if ((!revertStaging || stagedFiles.empty()) && unstagedFiles.empty())
return RevertUnchanged;
@@ -2933,7 +2934,7 @@ void GitClient::pull(const QString &workingDirectory, bool rebase)
abortCommand = "merge";
}
- VcsCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase);
+ VcsCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase, abortCommand);
connect(command, &VcsCommand::success, this,
[this, workingDirectory] { updateSubmodulesIfNeeded(workingDirectory, true); },
Qt::QueuedConnection);
@@ -3135,11 +3136,13 @@ void GitClient::revert(const QString &workingDirectory, const QString &argument)
// Stashing is handled prior to this call.
VcsCommand *GitClient::vcsExecAbortable(const QString &workingDirectory,
const QStringList &arguments,
- bool isRebase)
+ bool isRebase,
+ QString abortCommand)
{
QTC_ASSERT(!arguments.isEmpty(), return nullptr);
- QString abortCommand = arguments.at(0);
+ if (abortCommand.isEmpty())
+ abortCommand = arguments.at(0);
VcsCommand *command = createCommand(workingDirectory, nullptr, VcsWindowOutputBind);
command->setCookie(workingDirectory);
command->addFlags(VcsCommand::SshPasswordPrompt
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 2c67f87d96..c5e9a0df4f 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -126,7 +126,8 @@ public:
VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory,
const QStringList &arguments,
- bool isRebase = false);
+ bool isRebase = false,
+ QString abortCommand = QString());
QString findRepositoryForDirectory(const QString &directory) const;
QString findGitDirForRepository(const QString &repositoryDir) const;
@@ -174,8 +175,8 @@ public:
QString revision = QString(), QString *errorMessage = nullptr,
bool revertStaging = true);
enum class StashMode { NoStash, TryStash };
- void checkout(const QString &workingDirectory, const QString &ref,
- StashMode stashMode = StashMode::TryStash);
+ VcsBase::VcsCommand *checkout(const QString &workingDirectory, const QString &ref,
+ StashMode stashMode = StashMode::TryStash);
QStringList setupCheckoutArguments(const QString &workingDirectory, const QString &ref);
void updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt);
diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp
index 51a8a7f330..36b9665e04 100644
--- a/src/plugins/help/docsettingspage.cpp
+++ b/src/plugins/help/docsettingspage.cpp
@@ -210,7 +210,7 @@ void DocSettingsPage::addDocumentation()
// file with the same namespace but a different path, we need to unregister the namespace before
// we can register the new one. Help engine allows just one registered namespace.
if (m_filesToUnregister.contains(nameSpace)) {
- QSet<QString> values = m_filesToUnregister.values(nameSpace).toSet();
+ QSet<QString> values = Utils::toSet(m_filesToUnregister.values(nameSpace));
values.remove(filePath);
m_filesToUnregister.remove(nameSpace);
foreach (const QString &value, values)
diff --git a/src/plugins/help/filtersettingspage.cpp b/src/plugins/help/filtersettingspage.cpp
index 83d0d365f7..cfd184dfc9 100644
--- a/src/plugins/help/filtersettingspage.cpp
+++ b/src/plugins/help/filtersettingspage.cpp
@@ -32,6 +32,8 @@
#include <coreplugin/helpmanager.h>
+#include <utils/algorithm.h>
+
#include <QCoreApplication>
#include <QFileDialog>
#include <QMessageBox>
@@ -99,7 +101,7 @@ void FilterSettingsPage::updateFilterPage()
QSet<QString> attributes;
filters = HelpManager::filters();
for (it = filters.constBegin(); it != filters.constEnd(); ++it)
- attributes += it.value().toSet();
+ attributes += Utils::toSet(it.value());
foreach (const QString &attribute, attributes)
new QTreeWidgetItem(m_ui.attributeWidget, QStringList(attribute));
diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp
index 68bedb5779..d6dfef6b20 100644
--- a/src/plugins/help/helpmanager.cpp
+++ b/src/plugins/help/helpmanager.cpp
@@ -372,12 +372,12 @@ void HelpManager::setupHelpManager()
d->cleanUpDocumentation();
if (!d->m_nameSpacesToUnregister.isEmpty()) {
- m_instance->unregisterDocumentation(d->m_nameSpacesToUnregister.toList());
+ m_instance->unregisterDocumentation(Utils::toList(d->m_nameSpacesToUnregister));
d->m_nameSpacesToUnregister.clear();
}
if (!d->m_filesToRegister.isEmpty()) {
- m_instance->registerDocumentation(d->m_filesToRegister.toList());
+ m_instance->registerDocumentation(Utils::toList(d->m_filesToRegister));
d->m_filesToRegister.clear();
}
@@ -432,13 +432,13 @@ const QStringList HelpManagerPrivate::documentationFromInstaller()
void HelpManagerPrivate::readSettings()
{
- m_userRegisteredFiles = ICore::settings()->value(QLatin1String(kUserDocumentationKey))
- .toStringList().toSet();
+ m_userRegisteredFiles = Utils::toSet(ICore::settings()->value(QLatin1String(kUserDocumentationKey))
+ .toStringList());
}
void HelpManagerPrivate::writeSettings()
{
- const QStringList list = m_userRegisteredFiles.toList();
+ const QStringList list = Utils::toList(m_userRegisteredFiles);
ICore::settings()->setValue(QLatin1String(kUserDocumentationKey), list);
}
diff --git a/src/plugins/ios/iosconfigurations.cpp b/src/plugins/ios/iosconfigurations.cpp
index e91304d272..909a81e25a 100644
--- a/src/plugins/ios/iosconfigurations.cpp
+++ b/src/plugins/ios/iosconfigurations.cpp
@@ -167,11 +167,11 @@ static QHash<XcodePlatform::ToolchainTarget, ToolChainPair> findToolChains(const
static QSet<Kit *> existingAutoDetectedIosKits()
{
- return Utils::filtered(KitManager::kits(), [](Kit *kit) -> bool {
+ return Utils::toSet(Utils::filtered(KitManager::kits(), [](Kit *kit) -> bool {
Core::Id deviceKind = DeviceTypeKitAspect::deviceTypeId(kit);
return kit->isAutoDetected() && (deviceKind == Constants::IOS_DEVICE_TYPE
|| deviceKind == Constants::IOS_SIMULATOR_TYPE);
- }).toSet();
+ }));
}
static void printKits(const QSet<Kit *> &kits)
@@ -249,9 +249,9 @@ void IosConfigurations::updateAutomaticKitList()
// target -> tool chain
const auto targetToolChainHash = findToolChains(platforms);
- const auto qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) {
+ const auto qtVersions = Utils::toSet(QtVersionManager::versions([](const BaseQtVersion *v) {
return v->isValid() && v->type() == Constants::IOSQT;
- }).toSet();
+ }));
const DebuggerItem *possibleDebugger = DebuggerItemManager::findByEngineType(LldbEngineType);
const QVariant debuggerId = (possibleDebugger ? possibleDebugger->id() : QVariant());
diff --git a/src/plugins/ios/iosprobe.cpp b/src/plugins/ios/iosprobe.cpp
index 2564846a2d..384d14e90a 100644
--- a/src/plugins/ios/iosprobe.cpp
+++ b/src/plugins/ios/iosprobe.cpp
@@ -25,6 +25,7 @@
#include "iosprobe.h"
+#include <utils/algorithm.h>
#include <utils/synchronousprocess.h>
#include <QDir>
@@ -120,7 +121,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath)
const QFileInfo sdkPathInfo(sdk.path.toString());
if (sdkPathInfo.exists() && sdkPathInfo.isDir()) {
clangProfile.sdks.push_back(sdk);
- allArchitectures += sdk.architectures.toSet();
+ allArchitectures += Utils::toSet(sdk.architectures);
}
}
diff --git a/src/plugins/modeleditor/pxnodecontroller.cpp b/src/plugins/modeleditor/pxnodecontroller.cpp
index 86e3b63a5b..c30b1df9e5 100644
--- a/src/plugins/modeleditor/pxnodecontroller.cpp
+++ b/src/plugins/modeleditor/pxnodecontroller.cpp
@@ -42,6 +42,8 @@
#include "qmt/tasks/diagramscenecontroller.h"
#include <projectexplorer/projectnodes.h>
+
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QAction>
@@ -154,7 +156,7 @@ void PxNodeController::addFileSystemEntry(const QString &filePath, int line, int
auto menu = new QMenu;
menu->addAction(new MenuAction(tr("Add Component %1").arg(elementName), elementName,
MenuAction::TYPE_ADD_COMPONENT, menu));
- QStringList classNames = d->classViewController->findClassDeclarations(filePath, line, column).toList();
+ QStringList classNames = Utils::toList(d->classViewController->findClassDeclarations(filePath, line, column));
if (!classNames.empty()) {
menu->addSeparator();
int index = 0;
diff --git a/src/plugins/projectexplorer/deploymentdata.cpp b/src/plugins/projectexplorer/deploymentdata.cpp
index 7cdc4a1185..acb8878de6 100644
--- a/src/plugins/projectexplorer/deploymentdata.cpp
+++ b/src/plugins/projectexplorer/deploymentdata.cpp
@@ -64,7 +64,7 @@ DeployableFile DeploymentData::deployableForLocalFile(const QString &localFilePa
bool DeploymentData::operator==(const DeploymentData &other) const
{
- return m_files.toSet() == other.m_files.toSet()
+ return Utils::toSet(m_files) == Utils::toSet(other.m_files)
&& m_localInstallRoot == other.m_localInstallRoot;
}
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index fff0606889..d6521cde99 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -908,6 +908,115 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
categoryCompile)
)
<< QString();
+ QTest::newRow("GCC 9 output")
+ << QString("In file included from /usr/include/qt/QtCore/qlocale.h:43,\n"
+ " from /usr/include/qt/QtCore/qtextstream.h:46,\n"
+ " from /qtc/src/shared/proparser/proitems.cpp:31:\n"
+ "/usr/include/qt/QtCore/qvariant.h: In constructor ‘QVariant::QVariant(QVariant&&)’:\n"
+ "/usr/include/qt/QtCore/qvariant.h:273:25: warning: implicitly-declared ‘constexpr QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]\n"
+ " 273 | { other.d = Private(); }\n"
+ " | ^\n"
+ "/usr/include/qt/QtCore/qvariant.h:399:16: note: because ‘QVariant::Private’ has user-provided ‘QVariant::Private::Private(const QVariant::Private&)’\n"
+ " 399 | inline Private(const Private &other) Q_DECL_NOTHROW\n"
+ " | ^~~~~~~)\n"
+ "t.cc: In function ‘int test(const shape&, const shape&)’:\n"
+ "t.cc:15:4: error: no match for ‘operator+’ (operand types are ‘boxed_value<double>’ and ‘boxed_value<double>’)\n"
+ " 14 | return (width(s1) * height(s1)\n"
+ " | ~~~~~~~~~~~~~~~~~~~~~~\n"
+ " | |\n"
+ " | boxed_value<[...]>\n"
+ " 15 | + width(s2) * height(s2));\n"
+ " | ^ ~~~~~~~~~~~~~~~~~~~~~~\n"
+ " | |\n"
+ " | boxed_value<[...]>\n"
+ "incomplete.c:1:6: error: ‘string’ in namespace ‘std’ does not name a type\n"
+ " 1 | std::string test(void)\n"
+ " | ^~~~~~\n"
+ "incomplete.c:1:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?\n"
+ " +++ |+#include <string>\n"
+ " 1 | std::string test(void)\n"
+ "param-type-mismatch.c: In function ‘caller’:\n"
+ "param-type-mismatch.c:5:24: warning: passing argument 2 of ‘callee’ makes pointer from integer without a cast [-Wint-conversion]\n"
+ " 5 | return callee(first, second, third);\n"
+ " | ^~~~~~\n"
+ " | |\n"
+ " | int\n"
+ "param-type-mismatch.c:1:40: note: expected ‘const char *’ but argument is of type ‘int’\n"
+ " 1 | extern int callee(int one, const char *two, float three);\n"
+ " | ~~~~~~~~~~~~^~~"
+ )
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << Tasks{Task(Task::Unknown,
+ "In file included from /usr/include/qt/QtCore/qlocale.h:43,",
+ Utils::FilePath::fromUserInput("/usr/include/qt/QtCore/qlocale.h"), 43,
+ categoryCompile),
+ Task(Task::Unknown,
+ "from /usr/include/qt/QtCore/qtextstream.h:46,",
+ Utils::FilePath::fromUserInput("/usr/include/qt/QtCore/qtextstream.h"), 46,
+ categoryCompile),
+ Task(Task::Unknown,
+ "from /qtc/src/shared/proparser/proitems.cpp:31:",
+ Utils::FilePath::fromUserInput("/qtc/src/shared/proparser/proitems.cpp"), 31,
+ categoryCompile),
+ Task(Task::Unknown,
+ "In constructor ‘QVariant::QVariant(QVariant&&)’:",
+ Utils::FilePath::fromUserInput("/usr/include/qt/QtCore/qvariant.h"), -1,
+ categoryCompile),
+ Task(Task::Warning,
+ "implicitly-declared ‘constexpr QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]\n"
+ " 273 | { other.d = Private(); }\n"
+ " | ^",
+ Utils::FilePath::fromUserInput("/usr/include/qt/QtCore/qvariant.h"), 273,
+ categoryCompile),
+ Task(Task::Unknown,
+ "because ‘QVariant::Private’ has user-provided ‘QVariant::Private::Private(const QVariant::Private&)’\n"
+ " 399 | inline Private(const Private &other) Q_DECL_NOTHROW\n"
+ " | ^~~~~~~)",
+ Utils::FilePath::fromUserInput("/usr/include/qt/QtCore/qvariant.h"), 399,
+ categoryCompile),
+ Task(Task::Unknown,
+ "In function ‘int test(const shape&, const shape&)’:",
+ Utils::FilePath::fromUserInput("t.cc"), -1,
+ categoryCompile),
+ Task(Task::Error,
+ "no match for ‘operator+’ (operand types are ‘boxed_value<double>’ and ‘boxed_value<double>’)\n"
+ " 14 | return (width(s1) * height(s1)\n"
+ " | ~~~~~~~~~~~~~~~~~~~~~~\n"
+ " | |\n"
+ " | boxed_value<[...]>\n"
+ " 15 | + width(s2) * height(s2));\n"
+ " | ^ ~~~~~~~~~~~~~~~~~~~~~~\n"
+ " | |\n"
+ " | boxed_value<[...]>",
+ Utils::FilePath::fromUserInput("t.cc"), 15,
+ categoryCompile),
+ Task(Task::Error,
+ "‘string’ in namespace ‘std’ does not name a type\n"
+ " 1 | std::string test(void)\n"
+ " | ^~~~~~",
+ Utils::FilePath::fromUserInput("incomplete.c"), 1, categoryCompile),
+ Task(Task::Unknown,
+ "‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?\n"
+ " +++ |+#include <string>\n"
+ " 1 | std::string test(void)",
+ Utils::FilePath::fromUserInput("incomplete.c"), 1, categoryCompile),
+ Task(Task::Unknown,
+ "In function ‘caller’:",
+ Utils::FilePath::fromUserInput("param-type-mismatch.c"), -1, categoryCompile),
+ Task(Task::Warning,
+ "passing argument 2 of ‘callee’ makes pointer from integer without a cast [-Wint-conversion]\n"
+ " 5 | return callee(first, second, third);\n"
+ " | ^~~~~~\n"
+ " | |\n"
+ " | int",
+ Utils::FilePath::fromUserInput("param-type-mismatch.c"), 5, categoryCompile),
+ Task(Task::Unknown,
+ "expected ‘const char *’ but argument is of type ‘int’\n"
+ " 1 | extern int callee(int one, const char *two, float three);\n"
+ " | ~~~~~~~~~~~~^~~",
+ Utils::FilePath::fromUserInput("param-type-mismatch.c"), 1, categoryCompile)}
+ << QString();
}
void ProjectExplorerPlugin::testGccOutputParsers()
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
index a168fea084..c8ae9aa013 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
@@ -190,8 +190,7 @@ Core::GeneratedFiles JsonWizardFileGenerator::fileList(Utils::MacroExpander *exp
std::tie(fileList, dirList)
= Utils::partition(concreteFiles, [](const File &f) { return !QFileInfo(f.source).isDir(); });
- const QSet<QString> knownFiles
- = QSet<QString>::fromList(Utils::transform(fileList, &File::target));
+ const QSet<QString> knownFiles = Utils::transform<QSet>(fileList, &File::target);
foreach (const File &dir, dirList) {
QDir sourceDir(dir.source);
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp
index cf84f8b5e4..ae3e6aaa52 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp
@@ -215,7 +215,7 @@ JsonWizardGenerator::OverwriteResult JsonWizardGenerator::promptForOverwrite(Jso
if (overwriteDialog.exec() != QDialog::Accepted)
return OverwriteCanceled;
- const QSet<QString> existingFilesToKeep = QSet<QString>::fromList(overwriteDialog.uncheckedFiles());
+ const QSet<QString> existingFilesToKeep = Utils::toSet(overwriteDialog.uncheckedFiles());
if (existingFilesToKeep.size() == files->size()) // All exist & all unchecked->Cancel.
return OverwriteCanceled;
diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp
index 88e2e65ada..bb44b6bec8 100644
--- a/src/plugins/projectexplorer/kit.cpp
+++ b/src/plugins/projectexplorer/kit.cpp
@@ -228,13 +228,11 @@ Kit *Kit::clone(bool keepName) const
void Kit::copyFrom(const Kit *k)
{
- KitGuard g(this);
copyKitCommon(this, k);
d->m_autodetected = k->d->m_autodetected;
d->m_autoDetectionSource = k->d->m_autoDetectionSource;
d->m_unexpandedDisplayName = k->d->m_unexpandedDisplayName;
d->m_fileSystemFriendlyName = k->d->m_fileSystemFriendlyName;
- d->m_mustNotify = true;
}
bool Kit::isValid() const
diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp
index 562e090806..c091d0d870 100644
--- a/src/plugins/projectexplorer/kitinformation.cpp
+++ b/src/plugins/projectexplorer/kitinformation.cpp
@@ -226,14 +226,14 @@ public:
layout->setContentsMargins(0, 0, 0, 0);
layout->setColumnStretch(1, 2);
- QList<Core::Id> languageList = ToolChainManager::allLanguages().toList();
+ QList<Core::Id> languageList = Utils::toList(ToolChainManager::allLanguages());
Utils::sort(languageList, [](Core::Id l1, Core::Id l2) {
return ToolChainManager::displayNameOfLanguageId(l1)
< ToolChainManager::displayNameOfLanguageId(l2);
});
QTC_ASSERT(!languageList.isEmpty(), return);
int row = 0;
- foreach (Core::Id l, languageList) {
+ for (Core::Id l : qAsConst(languageList)) {
layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0);
auto cb = new QComboBox;
cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
@@ -385,7 +385,7 @@ Tasks ToolChainKitAspect::validate(const Kit *k) const
}
if (targetAbis.count() != 1) {
result << Task(Task::Error, tr("Compilers produce code for different ABIs: %1")
- .arg(Utils::transform(targetAbis, &Abi::toString).toList().join(", ")),
+ .arg(Utils::transform<QList>(targetAbis, &Abi::toString).join(", ")),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
@@ -606,7 +606,7 @@ QList<ToolChain *> ToolChainKitAspect::toolChains(const Kit *k)
const QVariantMap value = k->value(ToolChainKitAspect::id()).toMap();
const QList<ToolChain *> tcList
- = Utils::transform(ToolChainManager::allLanguages().toList(),
+ = Utils::transform<QList>(ToolChainManager::allLanguages(),
[&value](Core::Id l) -> ToolChain * {
return ToolChainManager::findToolChain(value.value(l.toString()).toByteArray());
});
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 03b19765c7..41f00ea779 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -3502,7 +3502,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
}
if (!failedProjects.empty()) {
const QString message = tr("The following subprojects could not be added to project "
- "\"%2\":").arg(projectNode->managingProject()->displayName());
+ "\"%1\":").arg(projectNode->managingProject()->displayName());
QMessageBox::warning(ICore::mainWindow(), tr("Adding Subproject Failed"),
message + "\n " + failedProjects.join("\n "));
return;
diff --git a/src/plugins/projectexplorer/selectablefilesmodel.cpp b/src/plugins/projectexplorer/selectablefilesmodel.cpp
index 28d6f4ef23..71077cf570 100644
--- a/src/plugins/projectexplorer/selectablefilesmodel.cpp
+++ b/src/plugins/projectexplorer/selectablefilesmodel.cpp
@@ -55,7 +55,7 @@ SelectableFilesModel::SelectableFilesModel(QObject *parent) : QAbstractItemModel
void SelectableFilesModel::setInitialMarkedFiles(const Utils::FilePathList &files)
{
- m_files = files.toSet();
+ m_files = Utils::toSet(files);
m_allFiles = files.isEmpty();
}
@@ -320,14 +320,14 @@ void SelectableFilesModel::collectPaths(Tree *root, Utils::FilePathList *result)
Utils::FilePathList SelectableFilesModel::selectedFiles() const
{
- Utils::FilePathList result = m_outOfBaseDirFiles.toList();
+ Utils::FilePathList result = Utils::toList(m_outOfBaseDirFiles);
collectFiles(m_root, &result);
return result;
}
Utils::FilePathList SelectableFilesModel::preservedFiles() const
{
- return m_outOfBaseDirFiles.toList();
+ return Utils::toList(m_outOfBaseDirFiles);
}
bool SelectableFilesModel::hasCheckedFiles() const
diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp
index 5724985eb7..ae7b563dbd 100644
--- a/src/plugins/projectexplorer/target.cpp
+++ b/src/plugins/projectexplorer/target.cpp
@@ -347,7 +347,7 @@ DeploymentData Target::deploymentData() const
void Target::setApplicationTargets(const QList<BuildTargetInfo> &appTargets)
{
- if (appTargets.toSet() != d->m_appTargets.toSet()) {
+ if (Utils::toSet(appTargets) != Utils::toSet(d->m_appTargets)) {
d->m_appTargets = appTargets;
emit applicationTargetsChanged();
}
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp
index 6831a3d74c..cc6d37413c 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.cpp
+++ b/src/plugins/projectexplorer/targetsettingspanel.cpp
@@ -95,8 +95,10 @@ protected:
void keyPressEvent(QKeyEvent *event) override
{
- if (m_targetSetupPage && m_targetSetupPage->importLineEditHasFocus())
+ if ((m_targetSetupPage && m_targetSetupPage->importLineEditHasFocus())
+ || (m_configureButton && !m_configureButton->isEnabled())) {
return;
+ }
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
event->accept();
if (m_targetSetupPage)
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp
index a16c6f216e..7a005b40bb 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.cpp
+++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp
@@ -97,7 +97,7 @@ public:
}
case Qt::ToolTipRole:
if (!toolChain->isValid())
- return ToolChainOptionsPage::tr("This toolchain is no longer valid.");
+ return ToolChainOptionsPage::tr("This toolchain is invalid.");
return ToolChainOptionsPage::tr("<nobr><b>ABI:</b> %1").arg(
changed ? ToolChainOptionsPage::tr("not up-to-date")
: toolChain->targetAbi().toString());
@@ -190,7 +190,7 @@ public:
m_addButton = new QPushButton(ToolChainOptionsPage::tr("Add"), this);
auto addMenu = new QMenu;
foreach (ToolChainFactory *factory, m_factories) {
- QList<Core::Id> languages = factory->supportedLanguages().toList();
+ QList<Core::Id> languages = Utils::toList(factory->supportedLanguages());
if (languages.isEmpty())
continue;
diff --git a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp
index 1d8ea687b3..64d458e2e5 100644
--- a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp
+++ b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp
@@ -89,7 +89,7 @@ static QList<ToolChain *> makeUniqueByEqual(const QList<ToolChain *> &a)
static QList<ToolChain *> makeUniqueByPointerEqual(const QList<ToolChain *> &a)
{
- return QSet<ToolChain *>::fromList(a).toList();
+ return Utils::toList(Utils::toSet(a));
}
static QList<ToolChain *> subtractById(const QList<ToolChain *> &a, const QList<ToolChain *> &b)
@@ -478,12 +478,12 @@ void ProjectExplorerPlugin::testToolChainMerging()
Internal::ToolChainOperations ops = Internal::mergeToolChainLists(system, user, autodetect);
- QSet<ToolChain *> expToRegister = QSet<ToolChain *>::fromList(toRegister);
- QSet<ToolChain *> expToDemote = QSet<ToolChain *>::fromList(toDemote);
+ QSet<ToolChain *> expToRegister = Utils::toSet(toRegister);
+ QSet<ToolChain *> expToDemote = Utils::toSet(toDemote);
- QSet<ToolChain *> actToRegister = QSet<ToolChain *>::fromList(ops.toRegister);
- QSet<ToolChain *> actToDemote = QSet<ToolChain *>::fromList(ops.toDemote);
- QSet<ToolChain *> actToDelete = QSet<ToolChain *>::fromList(ops.toDelete);
+ QSet<ToolChain *> actToRegister = Utils::toSet(ops.toRegister);
+ QSet<ToolChain *> actToDemote = Utils::toSet(ops.toDemote);
+ QSet<ToolChain *> actToDelete = Utils::toSet(ops.toDelete);
QCOMPARE(actToRegister.count(), ops.toRegister.count()); // no dups!
QCOMPARE(actToDemote.count(), ops.toDemote.count()); // no dups!
@@ -499,12 +499,12 @@ void ProjectExplorerPlugin::testToolChainMerging()
tmp = actToRegister;
tmp.unite(actToDelete);
- QCOMPARE(tmp, QSet<ToolChain *>::fromList(system + user + autodetect)); // All input is accounted for
+ QCOMPARE(tmp, Utils::toSet(system + user + autodetect)); // All input is accounted for
QCOMPARE(expToRegister, actToRegister);
QCOMPARE(expToDemote, actToDemote);
- QCOMPARE(QSet<ToolChain *>::fromList(system + user + autodetect),
- QSet<ToolChain *>::fromList(ops.toRegister + ops.toDemote + ops.toDelete));
+ QCOMPARE(Utils::toSet(system + user + autodetect),
+ Utils::toSet(ops.toRegister + ops.toDemote + ops.toDelete));
}
} // namespace ProjectExplorer
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index bae2a90f7b..00f5639eb8 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -384,7 +384,7 @@ static QStringList readLinesJson(const Utils::FilePath &projectFile,
for (const auto &file : files_array)
visited.insert(file.toString());
- lines.append(visited.toList());
+ lines.append(Utils::toList(visited));
}
return lines;
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
index b9dd48d49e..e562638838 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
@@ -1914,8 +1914,9 @@ InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader,
bool fixInstallPrefix = (installPrefix != devInstallPrefix);
foreach (const QString &item, itemList) {
- bool active = !reader->values(item + QLatin1String(".CONFIG"))
- .contains(QLatin1String("no_default_install"));
+ const QStringList config = reader->values(item + ".CONFIG");
+ const bool active = !config.contains("no_default_install");
+ const bool executable = config.contains("executable");
const QString pathVar = item + QLatin1String(".path");
const QStringList &itemPaths = reader->values(pathVar);
if (itemPaths.count() != 1) {
@@ -1943,7 +1944,7 @@ InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader,
} else {
const auto &itemFiles = reader->fixifiedValues(
item + QLatin1String(".files"), projectDir, buildDir, true);
- result.items << InstallsItem(itemPath, itemFiles, active);
+ result.items << InstallsItem(itemPath, itemFiles, active, executable);
}
}
return result;
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
index 601400f47b..465f472c07 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
@@ -266,11 +266,12 @@ public:
class QMAKEPROJECTMANAGER_EXPORT InstallsItem {
public:
InstallsItem() = default;
- InstallsItem(QString p, QVector<ProFileEvaluator::SourceFile> f, bool a)
- : path(p), files(f), active(a) {}
+ InstallsItem(QString p, QVector<ProFileEvaluator::SourceFile> f, bool a, bool e)
+ : path(p), files(f), active(a), executable(e) {}
QString path;
QVector<ProFileEvaluator::SourceFile> files;
bool active = false;
+ bool executable = false;
};
class QMAKEPROJECTMANAGER_EXPORT InstallsList {
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index 6f5925b51b..205782b1df 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -930,7 +930,7 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
QSet<QString> alreadyAdded = m_watcher.directories().toSet();
tmp.subtract(alreadyAdded);
if (!tmp.isEmpty())
- m_watcher.addPaths(tmp.toList());
+ m_watcher.addPaths(Utils::toList(tmp));
m_recursiveWatchedFolders += tmp;
}
@@ -1063,8 +1063,10 @@ void QmakeProject::collectData(const QmakeProFile *file, DeploymentData &deploym
for (const InstallsItem &item : installsList.items) {
if (!item.active)
continue;
- foreach (const auto &localFile, item.files)
- deploymentData.addFile(localFile.fileName, item.path);
+ for (const auto &localFile : item.files) {
+ deploymentData.addFile(localFile.fileName, item.path, item.executable
+ ? DeployableFile::TypeExecutable : DeployableFile::TypeNormal);
+ }
}
switch (file->projectType()) {
diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h
index 28d2a21a5c..3a785624bd 100644
--- a/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h
+++ b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h
@@ -65,8 +65,6 @@ private:
QRectF m_rect;
QTimer m_timer;
-
- GraphicsView *m_view;
};
} // End namespace DesignTools.
diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/selector.h b/src/plugins/qmldesigner/components/curveeditor/detail/selector.h
index e8f53d9d59..1c955de5be 100644
--- a/src/plugins/qmldesigner/components/curveeditor/detail/selector.h
+++ b/src/plugins/qmldesigner/components/curveeditor/detail/selector.h
@@ -70,8 +70,6 @@ private:
Shortcut m_shortcut;
- SelectionMode m_mode = SelectionMode::Undefined;
-
SelectionTool m_tool = SelectionTool::Rectangle;
QPoint m_mouseInit = QPoint();
diff --git a/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp b/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp
index 26c1390217..22e1c86dbc 100644
--- a/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/contentnoteditableindicator.cpp
@@ -26,6 +26,8 @@
#include "contentnoteditableindicator.h"
#include "nodemetainfo.h"
+#include <utils/algorithm.h>
+
#include <QSet>
#include <QPen>
@@ -68,9 +70,9 @@ void ContentNotEditableIndicator::setItems(const QList<FormEditorItem*> &itemLis
void ContentNotEditableIndicator::updateItems(const QList<FormEditorItem *> &itemList)
{
QSet<FormEditorItem*> affectedFormEditorItemItems;
- affectedFormEditorItemItems.unite(itemList.toSet());
+ affectedFormEditorItemItems.unite(Utils::toSet(itemList));
foreach (FormEditorItem *formEditorItem, itemList)
- affectedFormEditorItemItems.unite(formEditorItem->offspringFormEditorItems().toSet());
+ affectedFormEditorItemItems.unite(Utils::toSet(formEditorItem->offspringFormEditorItems()));
foreach (const EntryPair &entryPair, m_entryList) {
foreach (FormEditorItem *formEditorItem, affectedFormEditorItemItems) {
diff --git a/src/plugins/qmldesigner/components/formeditor/rubberbandselectionmanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/rubberbandselectionmanipulator.cpp
index 05d13e29e7..ccd5813a9f 100644
--- a/src/plugins/qmldesigner/components/formeditor/rubberbandselectionmanipulator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/rubberbandselectionmanipulator.cpp
@@ -27,6 +27,8 @@
#include "formeditorscene.h"
+#include <utils/algorithm.h>
+
namespace QmlDesigner {
RubberBandSelectionManipulator::RubberBandSelectionManipulator(LayerItem *layerItem, FormEditorView *editorView)
@@ -125,9 +127,9 @@ void RubberBandSelectionManipulator::select(SelectionType selectionType)
}
break;
case RemoveFromSelection: {
- QSet<QmlItemNode> oldSelectionSet(m_oldSelectionList.toSet());
- QSet<QmlItemNode> newSelectionSet(newNodeList.toSet());
- nodeList.append(oldSelectionSet.subtract(newSelectionSet).toList());
+ QSet<QmlItemNode> oldSelectionSet = Utils::toSet(m_oldSelectionList);
+ const QSet<QmlItemNode> newSelectionSet = Utils::toSet(newNodeList);
+ nodeList.append(Utils::toList(oldSelectionSet.subtract(newSelectionSet)));
}
}
diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
index 8c89acb7c8..08d2454bb1 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
@@ -634,7 +634,7 @@ static QList<ModelNode> collectParents(const QList<ModelNode> &modelNodes)
}
}
- return parents.toList();
+ return Utils::toList(parents);
}
QList<QPersistentModelIndex> NavigatorTreeModel::nodesToPersistentIndex(const QList<ModelNode> &modelNodes)
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
index 8fdab5a821..d553ccca22 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
@@ -35,6 +35,8 @@
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
+#include <QApplication>
+#include <QCursor>
#include <QQmlContext>
static uchar fromHex(const uchar c, const uchar c2)
@@ -386,4 +388,22 @@ void PropertyEditorContextObject::setHasAliasExport(bool hasAliasExport)
emit hasAliasExportChanged();
}
+void PropertyEditorContextObject::hideCursor()
+{
+ if (QApplication::overrideCursor())
+ return;
+
+ QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
+ m_lastPos = QCursor::pos();
+}
+
+void PropertyEditorContextObject::restoreCursor()
+{
+ if (!QApplication::overrideCursor())
+ return;
+
+ QCursor::setPos(m_lastPos);
+ QApplication::restoreOverrideCursor();
+}
+
} //QmlDesigner
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
index 42f4951a58..150800feba 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
@@ -32,6 +32,7 @@
#include <QQmlPropertyMap>
#include <QQmlComponent>
#include <QColor>
+#include <QPoint>
namespace QmlDesigner {
@@ -85,6 +86,9 @@ public:
Q_INVOKABLE void changeTypeName(const QString &typeName);
Q_INVOKABLE void insertKeyframe(const QString &propertyName);
+ Q_INVOKABLE void hideCursor();
+ Q_INVOKABLE void restoreCursor();
+
int majorVersion() const;
int majorQtQuickVersion() const;
int minorQtQuickVersion() const;
@@ -157,6 +161,8 @@ private:
QQmlComponent *m_qmlComponent;
QQmlContext *m_qmlContext;
+ QPoint m_lastPos;
+
Model *m_model = nullptr;
bool m_aliasExport = false;
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
index 12f12ed2bc..ae47586641 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
@@ -401,6 +401,39 @@ QString PropertyEditorQmlBackend::propertyEditorResourcesPath() {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/propertyEditorQmlSources");
}
+inline bool dotPropertyHeuristic(const QmlObjectNode &node, const NodeMetaInfo &type, const PropertyName &name)
+{
+ if (!name.contains("."))
+ return true;
+
+ if (name.count('.') > 1)
+ return false;
+
+ QList<QByteArray> list =name.split('.');
+ const PropertyName parentProperty = list.first();
+ const PropertyName itemProperty = list.last();
+
+ TypeName typeName = type.propertyTypeName(parentProperty);
+
+ NodeMetaInfo itemInfo = node.view()->model()->metaInfo("QtQuick.Item");
+ NodeMetaInfo textInfo = node.view()->model()->metaInfo("QtQuick.Text");
+ NodeMetaInfo rectangleInfo = node.view()->model()->metaInfo("QtQuick.Rectangle");
+
+ if (itemInfo.hasProperty(itemProperty))
+ return false;
+
+ if (typeName == "font")
+ return false;
+
+ if (textInfo.isSubclassOf(typeName))
+ return false;
+
+ if (rectangleInfo.isSubclassOf(typeName))
+ return false;
+
+ return true;
+}
+
QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
const NodeMetaInfo &superType,
const QmlObjectNode &node)
@@ -461,9 +494,9 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
auto nodes = templateConfiguration()->children();
- if (!superType.hasProperty(name) && type.propertyIsWritable(name) && !name.contains(".")) {
+ if (!superType.hasProperty(name) && type.propertyIsWritable(name) && dotPropertyHeuristic(node, type, name)) {
- foreach (const QmlJS::SimpleReaderNode::Ptr &node, nodes)
+ for (const QmlJS::SimpleReaderNode::Ptr &node : nodes) {
if (variantToStringList(node->property(QStringLiteral("typeNames"))).contains(QString::fromLatin1(typeName))) {
const QString fileName = propertyTemplatesPath() + node->property(QStringLiteral("sourceFile")).toString();
QFile file(fileName);
@@ -472,10 +505,6 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
file.close();
const bool section = node->propertyNames().contains("separateSection");
if (section) {
- qmlTemplate += "Section {\n";
- qmlTemplate += "anchors.left: parent.left\n";
- qmlTemplate += "anchors.right: parent.right\n";
- qmlTemplate += QString("caption: \"%1\"\n").arg(QString::fromUtf8(properName));
} else if (!sectionStarted) {
qmlTemplate += QStringLiteral("Section {\n");
qmlTemplate += QStringLiteral("caption: \"%1\"\n").arg(QString::fromUtf8(type.simplifiedTypeName()));
@@ -486,13 +515,12 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
}
qmlTemplate += source.arg(QString::fromUtf8(name)).arg(QString::fromUtf8(properName));
- if (section)
- qmlTemplate += "}\n";
emptyTemplate = false;
} else {
qWarning().nospace() << "template definition source file not found:" << fileName;
}
}
+ }
}
}
if (sectionStarted) {
@@ -666,3 +694,4 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const
} //QmlDesigner
+
diff --git a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp
index 862d16ba22..e475b982d7 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp
@@ -58,4 +58,31 @@ void Quick2PropertyEditorView::registerQmlTypes()
}
}
+bool Quick2PropertyEditorView::event(QEvent *e)
+{
+ static std::vector<QKeySequence> overrideSequences = { QKeySequence(Qt::SHIFT + Qt::Key_Up),
+ QKeySequence(Qt::SHIFT + Qt::Key_Down),
+ QKeySequence(Qt::CTRL + Qt::Key_Up),
+ QKeySequence(Qt::CTRL + Qt::Key_Down)
+ };
+
+ if (e->type() == QEvent::ShortcutOverride) {
+ auto keyEvent = static_cast<QKeyEvent *>(e);
+
+ static const Qt::KeyboardModifiers relevantModifiers = Qt::ShiftModifier
+ | Qt::ControlModifier
+ | Qt::AltModifier
+ | Qt::MetaModifier;
+
+ QKeySequence keySqeuence(keyEvent->key() | (keyEvent->modifiers() & relevantModifiers));
+ for (const QKeySequence &overrideSequence : overrideSequences)
+ if (keySqeuence.matches(overrideSequence)) {
+ keyEvent->accept();
+ return true;
+ }
+ }
+
+ return QQuickWidget::event(e);
+}
+
} //QmlDesigner
diff --git a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.h b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.h
index 7bfc6f1558..c2c0ba9f36 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.h
@@ -38,6 +38,9 @@ public:
explicit Quick2PropertyEditorView(QWidget *parent = nullptr);
static void registerQmlTypes();
+
+protected:
+ bool event(QEvent *e) override;
};
} //QmlDesigner
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h b/src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h
index 4bc11675c2..0830facfbf 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h
@@ -75,9 +75,6 @@ protected:
void setClampedXPosition(qreal x, qreal min, qreal max);
TimelineGraphicsScene *timelineScene() const;
-
-private:
- bool m_multiSelectedMove = false;
};
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index 62f12d910c..c48bfedce1 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -25,10 +25,6 @@
#include "nodeinstanceview.h"
-#include <QUrl>
-#include <QMultiHash>
-#include <QTimerEvent>
-
#include <model.h>
#include <modelnode.h>
#include <metainfo.h>
@@ -72,6 +68,12 @@
#include "nodeinstanceserverproxy.h"
+#include <utils/algorithm.h>
+
+#include <QUrl>
+#include <QMultiHash>
+#include <QTimerEvent>
+
enum {
debug = false
};
@@ -1189,7 +1191,7 @@ void NodeInstanceView::pixmapChanged(const PixmapChangedCommand &command)
m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(renderImageChangeSet.count()));
if (!renderImageChangeSet.isEmpty())
- emitInstancesRenderImageChanged(renderImageChangeSet.toList().toVector());
+ emitInstancesRenderImageChanged(Utils::toList(renderImageChangeSet).toVector());
}
QMultiHash<ModelNode, InformationName> NodeInstanceView::informationChanged(const QVector<InformationContainer> &containerVector)
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index 25ff950644..8aacefff55 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -336,14 +336,14 @@ private:
static inline bool isValueType(const TypeName &type)
{
static const PropertyTypeList objectValuesList({"QFont", "QPoint", "QPointF",
- "QSize", "QSizeF", "QVector3D", "QVector2D"});
+ "QSize", "QSizeF", "QVector3D", "QVector2D", "font"});
return objectValuesList.contains(type);
}
static inline bool isValueType(const QString &type)
{
static const QStringList objectValuesList({"QFont", "QPoint", "QPointF",
- "QSize", "QSizeF", "QVector3D", "QVector2D"});
+ "QSize", "QSizeF", "QVector3D", "QVector2D", "font"});
return objectValuesList.contains(type);
}
diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp
index 4100d451ee..45e7519474 100644
--- a/src/plugins/qmldesigner/shortcutmanager.cpp
+++ b/src/plugins/qmldesigner/shortcutmanager.cpp
@@ -178,7 +178,13 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
m_deleteAction.setIcon(QIcon::fromTheme(QLatin1String("edit-cut"), Utils::Icons::EDIT_CLEAR_TOOLBAR.icon()));
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_DELETE, qmlDesignerMainContext);
- command->setDefaultKeySequence(QKeySequence::Delete);
+ if (Utils::HostOsInfo::isMacHost())
+ command->setDefaultKeySequence(QKeySequence::Backspace);
+ else
+ command->setDefaultKeySequence(QKeySequence::Delete);
+
+ Utils::HostOsInfo::isMacHost() ;
+
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
if (!Utils::HostOsInfo::isMacHost())
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
index 9f0a16a921..988c51dbfe 100644
--- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
@@ -25,6 +25,7 @@
#include "filefilteritems.h"
+#include <utils/algorithm.h>
#include <utils/filesystemwatcher.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
@@ -160,7 +161,7 @@ void FileFilterBaseItem::setPathsProperty(const QStringList &path)
QStringList FileFilterBaseItem::files() const
{
- return m_files.toList();
+ return Utils::toList(m_files);
}
/**
@@ -243,16 +244,16 @@ void FileFilterBaseItem::updateFileListNow()
}
// update watched directories
- const QSet<QString> oldDirs = watchedDirectories().toSet();
+ const QSet<QString> oldDirs = Utils::toSet(watchedDirectories());
const QSet<QString> unwatchDirs = oldDirs - dirsToBeWatched;
const QSet<QString> watchDirs = dirsToBeWatched - oldDirs;
if (!unwatchDirs.isEmpty()) {
QTC_ASSERT(m_dirWatcher, return);
- m_dirWatcher->removeDirectories(unwatchDirs.toList());
+ m_dirWatcher->removeDirectories(Utils::toList(unwatchDirs));
}
if (!watchDirs.isEmpty())
- dirWatcher()->addDirectories(watchDirs.toList(), Utils::FileSystemWatcher::WatchAllChanges);
+ dirWatcher()->addDirectories(Utils::toList(watchDirs), Utils::FileSystemWatcher::WatchAllChanges);
}
bool FileFilterBaseItem::fileMatches(const QString &fileName) const
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index ecfe48378b..114676b315 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -275,7 +275,7 @@ void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString
refresh(Files);
if (!removed.isEmpty()) {
if (auto modelManager = QmlJS::ModelManagerInterface::instance())
- modelManager->removeFiles(removed.toList());
+ modelManager->removeFiles(Utils::toList(removed));
}
refreshTargetDirectory();
}
diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp
index 613dddef4c..8fcee4b64d 100644
--- a/src/plugins/qtsupport/qtoutputformatter.cpp
+++ b/src/plugins/qtsupport/qtoutputformatter.cpp
@@ -242,7 +242,11 @@ void QtOutputFormatter::handleLink(const QString &href)
const QRegularExpressionMatch qmlLineMatch = qmlLineLink.match(href);
if (qmlLineMatch.hasMatch()) {
- const QUrl fileUrl = QUrl(qmlLineMatch.captured(1));
+ const char scheme[] = "file://";
+ const QString filePath = qmlLineMatch.captured(1);
+ QUrl fileUrl = QUrl(filePath);
+ if (!fileUrl.isValid() && filePath.startsWith(scheme))
+ fileUrl = QUrl::fromLocalFile(filePath.mid(strlen(scheme)));
const int line = qmlLineMatch.captured(2).toInt();
openEditor(getFileToOpen(fileUrl), line);
return;
@@ -418,15 +422,27 @@ void QtSupportPlugin::testQtOutputFormatter_data()
<< " Loc: [../TestProject/test.cpp(123)]"
<< 9 << 37 << "../TestProject/test.cpp(123)"
<< "../TestProject/test.cpp" << 123 << -1;
+
+ QTest::newRow("Unix relative file link")
+ << "file://../main.cpp:157"
+ << 0 << 22 << "file://../main.cpp:157"
+ << "../main.cpp" << 157 << -1;
+
if (HostOsInfo::isWindowsHost()) {
QTest::newRow("Windows failed QTest link")
<< "..\\TestProject\\test.cpp(123) : failure location"
<< 0 << 28 << "..\\TestProject\\test.cpp(123)"
<< "../TestProject/test.cpp" << 123 << -1;
+
QTest::newRow("Windows failed QTest link with carriage return")
<< "..\\TestProject\\test.cpp(123) : failure location\r"
<< 0 << 28 << "..\\TestProject\\test.cpp(123)"
<< "../TestProject/test.cpp" << 123 << -1;
+
+ QTest::newRow("Windows relative file link with native separator")
+ << "file://..\\main.cpp:157"
+ << 0 << 22 << "file://..\\main.cpp:157"
+ << "../main.cpp" << 157 << -1;
}
}
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 36e720a8f0..7256d33915 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -422,7 +422,7 @@ static FilePathList gatherQmakePathsFromQtChooser()
if (!possibleQMake.isEmpty())
foundQMakes << possibleQMake;
}
- return foundQMakes.toList();
+ return Utils::toList(foundQMakes);
}
static void findSystemQt()
diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp
index 508ab20b83..57edb46327 100644
--- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp
+++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp
@@ -92,6 +92,11 @@ public:
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
}
+ Q_INVOKABLE int get(int)
+ {
+ return -1;
+ }
+
Q_INVOKABLE void showHelp()
{
QDesktopServices::openUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/index.html"));
diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp
index f6c134e02c..b3feef13f0 100644
--- a/src/plugins/texteditor/basefilefind.cpp
+++ b/src/plugins/texteditor/basefilefind.cpp
@@ -507,7 +507,7 @@ QStringList BaseFileFind::replaceAll(const QString &text,
// Query the user for permissions
if (!roFiles.isEmpty()) {
- ReadOnlyFilesDialog roDialog(roFiles.toList(), ICore::mainWindow());
+ ReadOnlyFilesDialog roDialog(Utils::toList(roFiles), ICore::mainWindow());
roDialog.setShowFailWarning(true, tr("Aborting replace."));
if (roDialog.exec() == ReadOnlyFilesDialog::RO_Cancel)
return QStringList();
diff --git a/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp b/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp
index ee0deab71c..50a04ba88f 100644
--- a/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp
+++ b/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp
@@ -32,6 +32,7 @@
#include "iassistprocessor.h"
#include "../snippets/snippetassistcollector.h"
+#include <utils/algorithm.h>
#include <utils/runextensions.h>
#include <QElapsedTimer>
@@ -104,7 +105,7 @@ static void createProposal(QFutureInterface<QStringList> &future, const QString
words.insert(word);
}
- future.reportResult(words.toList());
+ future.reportResult(Utils::toList(words));
}
IAssistProposal *DocumentContentCompletionProcessor::perform(const AssistInterface *interface)
diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp
index c2f958bb4e..9c8d921567 100644
--- a/src/plugins/todo/todoitemsprovider.cpp
+++ b/src/plugins/todo/todoitemsprovider.cpp
@@ -123,7 +123,7 @@ void TodoItemsProvider::createScanners()
void TodoItemsProvider::setItemsListWithinStartupProject()
{
QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash);
- const auto filePaths = QSet<FilePath>::fromList(m_startupProject->files(Project::SourceFiles));
+ const auto filePaths = Utils::toSet(m_startupProject->files(Project::SourceFiles));
QVariantMap settings = m_startupProject->namedSettings(Constants::SETTINGS_NAME_KEY).toMap();
@@ -159,8 +159,7 @@ void TodoItemsProvider::setItemsListWithinSubproject()
});
// files must be both in the current subproject and the startup-project.
- const auto fileNames
- = QSet<FilePath>::fromList(m_startupProject->files(Project::SourceFiles));
+ const auto fileNames = Utils::toSet(m_startupProject->files(Project::SourceFiles));
QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash);
while (it.hasNext()) {
it.next();
diff --git a/src/plugins/vcsbase/baseannotationhighlighter.cpp b/src/plugins/vcsbase/baseannotationhighlighter.cpp
index 32a0377040..ac23e85394 100644
--- a/src/plugins/vcsbase/baseannotationhighlighter.cpp
+++ b/src/plugins/vcsbase/baseannotationhighlighter.cpp
@@ -24,9 +24,12 @@
****************************************************************************/
#include "baseannotationhighlighter.h"
+
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
+#include <utils/algorithm.h>
+
#include <QDebug>
#include <QColor>
#include <QTextDocument>
@@ -68,7 +71,7 @@ void BaseAnnotationHighlighterPrivate::updateOtherFormats()
.toTextCharFormat(TextEditor::C_TEXT)
.brushProperty(QTextFormat::BackgroundBrush)
.color();
- q->setChangeNumbers(m_changeNumberMap.keys().toSet());
+ q->setChangeNumbers(Utils::toSet(m_changeNumberMap.keys()));
}
BaseAnnotationHighlighter::BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index c6b5ed8fbe..885b0c7cd1 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -157,7 +157,8 @@ VcsBaseEditor::VcsBaseEditor()
void VcsBaseEditor::finalizeInitialization()
{
- QTC_CHECK(qobject_cast<VcsBaseEditorWidget *>(editorWidget()));
+ QTC_ASSERT(qobject_cast<VcsBaseEditorWidget *>(editorWidget()), return);
+ editorWidget()->setReadOnly(true);
}
// ----------- VcsBaseEditorPrivate
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index 3017ae03b9..3d07ced719 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -37,17 +37,21 @@
#include <aggregation/aggregate.h>
#include <cpptools/cppmodelmanager.h>
+
+#include <coreplugin/find/basetextfind.h>
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
+
+#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
#include <utils/completingtextedit.h>
-#include <utils/synchronousprocess.h>
#include <utils/fileutils.h>
#include <utils/icon.h>
-#include <utils/theme/theme.h>
#include <utils/qtcassert.h>
+#include <utils/synchronousprocess.h>
#include <utils/temporarydirectory.h>
-#include <coreplugin/find/basetextfind.h>
+#include <utils/theme/theme.h>
+
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
@@ -459,7 +463,7 @@ void VcsBaseSubmitEditor::setFileModel(SubmitFileModel *model)
// Populate completer with symbols
if (!uniqueSymbols.isEmpty()) {
QCompleter *completer = d->m_widget->descriptionEdit()->completer();
- QStringList symbolsList = uniqueSymbols.toList();
+ QStringList symbolsList = Utils::toList(uniqueSymbols);
symbolsList.sort();
completer->setModel(new QStringListModel(symbolsList, completer));
}
diff --git a/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp b/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp
index bcf05e5d04..5a634f8fe1 100644
--- a/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp
+++ b/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp
@@ -221,11 +221,13 @@ struct Data // because we have a cycle dependency
database};
ClangBackEnd::PchTaskGenerator pchTaskGenerator{buildDependencyProvider,
pchTaskMerger,
- dependencyCreationProgressCounter};
+ dependencyCreationProgressCounter,
+ pchTaskQueue};
PchManagerServer clangPchManagerServer{includeWatcher,
pchTaskGenerator,
projectParts,
- generatedFiles};
+ generatedFiles,
+ buildDependencyStorage};
TaskScheduler systemTaskScheduler{pchCreatorManager,
pchTaskQueue,
pchCreationProgressCounter,
diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h
index 187a27cf89..00bb429dba 100644
--- a/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h
+++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h
@@ -71,6 +71,11 @@ public:
return fetchPchSourcesStatement.template values<FilePathId>(1024, projectPartId.projectPathId);
}
+ FilePathIds fetchSources(ProjectPartId projectPartId) const override
+ {
+ return fetchSourcesStatement.template values<FilePathId>(1024, projectPartId.projectPathId);
+ }
+
void insertOrUpdateFileStatuses(const FileStatuses &fileStatuses) override
{
WriteStatement &statement = insertOrUpdateFileStatusesStatement;
@@ -144,6 +149,94 @@ public:
transaction.commit();
}
+ void insertOrUpdateIndexingTimeStamps(const FilePathIds &filePathIds,
+ TimeStamp indexingTimeStamp) override
+ {
+ try {
+ Sqlite::ImmediateTransaction transaction{database};
+
+ for (FilePathId filePathId : filePathIds) {
+ inserOrUpdateIndexingTimesStampStatement.write(filePathId.filePathId,
+ indexingTimeStamp.value);
+ }
+
+ transaction.commit();
+ } catch (const Sqlite::StatementIsBusy &) {
+ insertOrUpdateIndexingTimeStamps(filePathIds, indexingTimeStamp);
+ }
+ }
+
+ void insertOrUpdateIndexingTimeStamps(const FileStatuses &fileStatuses) override
+ {
+ for (FileStatus fileStatus : fileStatuses) {
+ inserOrUpdateIndexingTimesStampStatement.write(fileStatus.filePathId.filePathId,
+ fileStatus.lastModified);
+ }
+ }
+
+ SourceTimeStamps fetchIndexingTimeStamps() const override
+ {
+ try {
+ Sqlite::DeferredTransaction transaction{database};
+
+ auto timeStamps = fetchIndexingTimeStampsStatement.template values<SourceTimeStamp, 2>(
+ 1024);
+
+ transaction.commit();
+
+ return timeStamps;
+ } catch (const Sqlite::StatementIsBusy &) {
+ return fetchIndexingTimeStamps();
+ }
+ }
+
+ SourceTimeStamps fetchIncludedIndexingTimeStamps(FilePathId sourcePathId) const override
+ {
+ try {
+ Sqlite::DeferredTransaction transaction{database};
+
+ auto timeStamps = fetchIncludedIndexingTimeStampsStatement
+ .template values<SourceTimeStamp, 2>(1024, sourcePathId.filePathId);
+
+ transaction.commit();
+
+ return timeStamps;
+ } catch (const Sqlite::StatementIsBusy &) {
+ return fetchIncludedIndexingTimeStamps(sourcePathId);
+ }
+ }
+
+ FilePathIds fetchDependentSourceIds(const FilePathIds &sourcePathIds) const override
+ {
+ try {
+ FilePathIds dependentSourceIds;
+
+ Sqlite::DeferredTransaction transaction{database};
+
+ for (FilePathId sourcePathId : sourcePathIds) {
+ FilePathIds newDependentSourceIds;
+ newDependentSourceIds.reserve(dependentSourceIds.size() + 1024);
+
+ auto newIds = fetchDependentSourceIdsStatement
+ .template values<FilePathId>(1024, sourcePathId.filePathId);
+
+ std::set_union(dependentSourceIds.begin(),
+ dependentSourceIds.end(),
+ newIds.begin(),
+ newIds.end(),
+ std::back_inserter(newDependentSourceIds));
+
+ dependentSourceIds = std::move(newDependentSourceIds);
+ }
+
+ transaction.commit();
+
+ return dependentSourceIds;
+ } catch (const Sqlite::StatementIsBusy &) {
+ return fetchDependentSourceIds(sourcePathIds);
+ }
+ }
+
static Utils::SmallString toJson(const Utils::SmallStringVector &strings)
{
QJsonDocument document;
@@ -255,6 +348,8 @@ public:
"SELECT sourceId FROM projectPartsFiles WHERE projectPartId = ? AND sourceType IN (0, 1, "
"3, 4) ORDER BY sourceId",
database};
+ mutable ReadStatement fetchSourcesStatement{
+ "SELECT sourceId FROM projectPartsFiles WHERE projectPartId = ? ORDER BY sourceId", database};
mutable ReadStatement fetchSourceDependenciesStatement{
"WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION "
"SELECT dependencySourceId FROM sourceDependencies, "
@@ -279,5 +374,24 @@ public:
database};
WriteStatement deleteAllProjectPartsFilesWithProjectPartNameStatement{
"DELETE FROM projectPartsFiles WHERE projectPartId = ?", database};
+ WriteStatement inserOrUpdateIndexingTimesStampStatement{
+ "INSERT INTO fileStatuses(sourceId, indexingTimeStamp) VALUES (?001, ?002) ON "
+ "CONFLICT(sourceId) DO UPDATE SET indexingTimeStamp = ?002",
+ database};
+ mutable ReadStatement fetchIncludedIndexingTimeStampsStatement{
+ "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT "
+ "dependencySourceId FROM sourceDependencies, collectedDependencies WHERE "
+ "sourceDependencies.sourceId == collectedDependencies.sourceId) SELECT DISTINCT sourceId, "
+ "indexingTimeStamp FROM collectedDependencies NATURAL JOIN fileStatuses ORDER BY sourceId",
+ database};
+ mutable ReadStatement fetchIndexingTimeStampsStatement{
+ "SELECT sourceId, indexingTimeStamp FROM fileStatuses", database};
+ mutable ReadStatement fetchDependentSourceIdsStatement{
+ "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT "
+ "sourceDependencies.sourceId FROM sourceDependencies, collectedDependencies WHERE "
+ "sourceDependencies.dependencySourceId == collectedDependencies.sourceId) SELECT sourceId "
+ "FROM collectedDependencies WHERE sourceId NOT IN (SELECT dependencySourceId FROM "
+ "sourceDependencies) ORDER BY sourceId",
+ database};
};
}
diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h
index a1c20811aa..953f2cca42 100644
--- a/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h
+++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h
@@ -57,6 +57,12 @@ public:
virtual ProjectPartId fetchProjectPartId(Utils::SmallStringView projectPartName) = 0;
virtual void updatePchCreationTimeStamp(long long pchCreationTimeStamp, ProjectPartId projectPartId) = 0;
virtual FilePathIds fetchPchSources(ProjectPartId projectPartId) const = 0;
+ virtual FilePathIds fetchSources(ProjectPartId projectPartId) const = 0;
+ virtual void insertOrUpdateIndexingTimeStamps(const FilePathIds &filePathIds, TimeStamp indexingTimeStamp) = 0;
+ virtual void insertOrUpdateIndexingTimeStamps(const FileStatuses &fileStatuses) = 0;
+ virtual SourceTimeStamps fetchIndexingTimeStamps() const = 0;
+ virtual SourceTimeStamps fetchIncludedIndexingTimeStamps(FilePathId sourcePathId) const = 0;
+ virtual FilePathIds fetchDependentSourceIds(const FilePathIds &sourcePathIds) const = 0;
protected:
~BuildDependenciesStorageInterface() = default;
diff --git a/src/tools/clangpchmanagerbackend/source/pchcreator.cpp b/src/tools/clangpchmanagerbackend/source/pchcreator.cpp
index 15c9a19547..46562c39a9 100644
--- a/src/tools/clangpchmanagerbackend/source/pchcreator.cpp
+++ b/src/tools/clangpchmanagerbackend/source/pchcreator.cpp
@@ -45,6 +45,8 @@
#include <QProcess>
#include <QTemporaryFile>
+#include <iostream>
+
namespace ClangBackEnd {
namespace {
@@ -110,11 +112,28 @@ Utils::SmallStringVector PchCreator::generateClangCompilerArguments(const PchTas
return builder.commandLine;
}
+FilePathIds PchCreator::existingSources(FilePathIds sources) const
+{
+ FilePathIds existingSources;
+ existingSources.reserve(sources.size());
+ std::set_difference(sources.begin(),
+ sources.end(),
+ m_generatedFilePathIds.begin(),
+ m_generatedFilePathIds.end(),
+ std::back_inserter(existingSources));
+
+ return existingSources;
+}
+
void PchCreator::generatePch(PchTask &&pchTask)
{
m_projectPartPch.projectPartId = pchTask.projectPartId();
m_projectPartPch.lastModified = QDateTime::currentSecsSinceEpoch();
- m_sources = std::move(pchTask.sources);
+ m_watchedSystemIncludes = std::move(pchTask.watchedSystemIncludes);
+ m_watchedProjectIncludes = std::move(pchTask.watchedProjectIncludes);
+ m_watchedUserIncludes = std::move(pchTask.watchedUserIncludes);
+ m_watchedSources = std::move(pchTask.watchedUserSources);
+
if (pchTask.includes.empty())
return;
@@ -166,23 +185,26 @@ void PchCreator::clear()
{
m_clangTool = ClangTool{};
m_projectPartPch = {};
- m_sources.clear();
+ m_watchedSystemIncludes.clear();
+ m_watchedProjectIncludes.clear();
+ m_watchedUserIncludes.clear();
+ m_watchedSources.clear();
}
void PchCreator::doInMainThreadAfterFinished()
{
if (m_projectPartPch.projectPartId.isValid()) {
- FilePathIds existingSources;
- existingSources.reserve(m_sources.size());
- std::set_difference(m_sources.begin(),
- m_sources.end(),
- m_generatedFilePathIds.begin(),
- m_generatedFilePathIds.end(),
- std::back_inserter(existingSources));
m_buildDependenciesStorage.updatePchCreationTimeStamp(m_projectPartPch.lastModified,
m_projectPartPch.projectPartId);
- m_clangPathwatcher.updateIdPaths({{m_projectPartPch.projectPartId, existingSources}});
- m_pchManagerClient.precompiledHeadersUpdated({m_projectPartPch.projectPartId});
+ m_clangPathwatcher.updateIdPaths({{{m_projectPartPch.projectPartId, SourceType::Source},
+ existingSources(m_watchedSources)}});
+ m_clangPathwatcher.updateIdPaths({{{m_projectPartPch.projectPartId, SourceType::UserInclude},
+ existingSources(m_watchedUserIncludes)}});
+ m_clangPathwatcher.updateIdPaths({{{m_projectPartPch.projectPartId, SourceType::ProjectInclude},
+ existingSources(m_watchedProjectIncludes)}});
+ m_clangPathwatcher.updateIdPaths({{{m_projectPartPch.projectPartId, SourceType::SystemInclude},
+ existingSources(m_watchedSystemIncludes)}});
+ m_pchManagerClient.precompiledHeadersUpdated(m_projectPartPch.projectPartId);
}
}
diff --git a/src/tools/clangpchmanagerbackend/source/pchcreator.h b/src/tools/clangpchmanagerbackend/source/pchcreator.h
index f1fadcd33a..c30e011011 100644
--- a/src/tools/clangpchmanagerbackend/source/pchcreator.h
+++ b/src/tools/clangpchmanagerbackend/source/pchcreator.h
@@ -80,19 +80,24 @@ public:
static Utils::SmallStringVector generateClangCompilerArguments(const PchTask &pchTask,
FilePathView pchPath);
- const ClangTool &clangTool() const
- {
- return m_clangTool;
- }
+ const ClangTool &clangTool() const { return m_clangTool; }
- const FilePathIds &sources() const { return m_sources; }
+ FilePathIds existingSources(FilePathIds sources) const;
+
+ const FilePathIds &watchedSystemIncludes() const { return m_watchedSystemIncludes; }
+ const FilePathIds &watchedProjectIncludes() const { return m_watchedProjectIncludes; }
+ const FilePathIds &watchedUserIncludes() const { return m_watchedUserIncludes; }
+ const FilePathIds &watchedSources() const { return m_watchedSources; }
private:
mutable std::mt19937_64 randomNumberGenator{std::random_device{}()};
ClangTool m_clangTool;
ProjectPartPch m_projectPartPch;
FilePathCaching m_filePathCache;
- FilePathIds m_sources;
+ FilePathIds m_watchedSystemIncludes;
+ FilePathIds m_watchedProjectIncludes;
+ FilePathIds m_watchedUserIncludes;
+ FilePathIds m_watchedSources;
FilePathIds m_generatedFilePathIds;
Environment &m_environment;
PchManagerClientInterface &m_pchManagerClient;
diff --git a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp
index 9cce6ef469..ec0d89d2c6 100644
--- a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp
+++ b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp
@@ -25,10 +25,11 @@
#include "pchmanagerserver.h"
+#include <builddependenciesstorage.h>
#include <pchmanagerclientinterface.h>
+#include <pchtaskgeneratorinterface.h>
#include <precompiledheadersupdatedmessage.h>
#include <progressmessage.h>
-#include <pchtaskgeneratorinterface.h>
#include <removegeneratedfilesmessage.h>
#include <removeprojectpartsmessage.h>
#include <updategeneratedfilesmessage.h>
@@ -39,16 +40,20 @@
#include <QApplication>
+#include <algorithm>
+
namespace ClangBackEnd {
PchManagerServer::PchManagerServer(ClangPathWatcherInterface &fileSystemWatcher,
PchTaskGeneratorInterface &pchTaskGenerator,
ProjectPartsManagerInterface &projectParts,
- GeneratedFilesInterface &generatedFiles)
+ GeneratedFilesInterface &generatedFiles,
+ BuildDependenciesStorageInterface &buildDependenciesStorage)
: m_fileSystemWatcher(fileSystemWatcher)
, m_pchTaskGenerator(pchTaskGenerator)
, m_projectPartsManager(projectParts)
, m_generatedFiles(generatedFiles)
+ , m_buildDependenciesStorage(buildDependenciesStorage)
{
m_fileSystemWatcher.setNotifier(this);
}
@@ -130,18 +135,92 @@ void PchManagerServer::removeGeneratedFiles(RemoveGeneratedFilesMessage &&messag
m_generatedFiles.remove(message.takeGeneratedFiles());
}
-void PchManagerServer::pathsWithIdsChanged(const ProjectPartIds &ids)
+namespace {
+struct FilterResults
{
- ArgumentsEntries entries = m_toolChainsArgumentsCache.arguments(ids);
+ ProjectPartIds systemIds;
+ ProjectPartIds projectIds;
+ ProjectPartIds userIds;
+};
- for (ArgumentsEntry &entry : entries) {
- m_pchTaskGenerator.addProjectParts(m_projectPartsManager.projects(entry.ids),
- std::move(entry.arguments));
+ProjectPartIds removeIds(const ProjectPartIds &subtrahend, const ProjectPartIds &minuend)
+{
+ ProjectPartIds difference;
+ difference.reserve(subtrahend.size());
+
+ std::set_difference(subtrahend.begin(),
+ subtrahend.end(),
+ minuend.begin(),
+ minuend.end(),
+ std::back_inserter(difference));
+
+ return difference;
+}
+
+FilterResults pchProjectPartIds(const std::vector<IdPaths> &idPaths)
+{
+ ProjectPartIds changedUserProjectPartIds;
+ changedUserProjectPartIds.reserve(idPaths.size());
+
+ ProjectPartIds changedSystemPchProjectPartIds;
+ changedSystemPchProjectPartIds.reserve(idPaths.size());
+
+ ProjectPartIds changedProjectPchProjectPartIds;
+ changedProjectPchProjectPartIds.reserve(idPaths.size());
+
+ for (const IdPaths &idPath : idPaths) {
+ switch (idPath.id.sourceType) {
+ case SourceType::TopSystemInclude:
+ case SourceType::SystemInclude:
+ changedSystemPchProjectPartIds.push_back(idPath.id.id);
+ break;
+ case SourceType::TopProjectInclude:
+ case SourceType::ProjectInclude:
+ changedProjectPchProjectPartIds.push_back(idPath.id.id);
+ break;
+ case SourceType::UserInclude:
+ case SourceType::Source:
+ changedUserProjectPartIds.push_back(idPath.id.id);
+ break;
+ }
}
+
+ changedSystemPchProjectPartIds.erase(std::unique(changedSystemPchProjectPartIds.begin(),
+ changedSystemPchProjectPartIds.end()),
+ changedSystemPchProjectPartIds.end());
+ changedProjectPchProjectPartIds.erase(std::unique(changedProjectPchProjectPartIds.begin(),
+ changedProjectPchProjectPartIds.end()),
+ changedProjectPchProjectPartIds.end());
+ changedUserProjectPartIds.erase(std::unique(changedUserProjectPartIds.begin(),
+ changedUserProjectPartIds.end()),
+ changedUserProjectPartIds.end());
+
+ changedProjectPchProjectPartIds = removeIds(changedProjectPchProjectPartIds,
+ changedSystemPchProjectPartIds);
+
+ changedUserProjectPartIds = removeIds(changedUserProjectPartIds, changedSystemPchProjectPartIds);
+ changedUserProjectPartIds = removeIds(changedUserProjectPartIds, changedProjectPchProjectPartIds);
+
+ return {std::move(changedSystemPchProjectPartIds),
+ std::move(changedProjectPchProjectPartIds),
+ std::move(changedUserProjectPartIds)};
}
+} // namespace
-void PchManagerServer::pathsChanged(const FilePathIds &/*filePathIds*/)
+void PchManagerServer::pathsWithIdsChanged(const std::vector<IdPaths> &idPaths)
{
+ auto changedProjectPartIds = pchProjectPartIds(idPaths);
+
+ addCompleteProjectParts(changedProjectPartIds.systemIds);
+
+ addNonSystemProjectParts(changedProjectPartIds.projectIds);
+
+ client()->precompiledHeadersUpdated(std::move(changedProjectPartIds.userIds));
+}
+
+void PchManagerServer::pathsChanged(const FilePathIds &filePathIds)
+{
+ m_buildDependenciesStorage.insertOrUpdateIndexingTimeStamps(filePathIds, 0);
}
void PchManagerServer::setPchCreationProgress(int progress, int total)
@@ -154,4 +233,24 @@ void PchManagerServer::setDependencyCreationProgress(int progress, int total)
client()->progress({ProgressType::DependencyCreation, progress, total});
}
+void PchManagerServer::addCompleteProjectParts(const ProjectPartIds &projectPartIds)
+{
+ ArgumentsEntries entries = m_toolChainsArgumentsCache.arguments(projectPartIds);
+
+ for (ArgumentsEntry &entry : entries) {
+ m_pchTaskGenerator.addProjectParts(m_projectPartsManager.projects(entry.ids),
+ std::move(entry.arguments));
+ }
+}
+
+void PchManagerServer::addNonSystemProjectParts(const ProjectPartIds &projectPartIds)
+{
+ ArgumentsEntries entries = m_toolChainsArgumentsCache.arguments(projectPartIds);
+
+ for (ArgumentsEntry &entry : entries) {
+ m_pchTaskGenerator.addNonSystemProjectParts(m_projectPartsManager.projects(entry.ids),
+ std::move(entry.arguments));
+ }
+}
+
} // namespace ClangBackEnd
diff --git a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h
index cc9daa7aa4..c8e5be4de5 100644
--- a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h
+++ b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h
@@ -39,6 +39,7 @@ namespace ClangBackEnd {
class SourceRangesAndDiagnosticsForQueryMessage;
class PchTaskGeneratorInterface;
+class BuildDependenciesStorageInterface;
class PchManagerServer : public PchManagerServerInterface,
public ClangPathWatcherNotifier,
@@ -49,7 +50,8 @@ public:
PchManagerServer(ClangPathWatcherInterface &fileSystemWatcher,
PchTaskGeneratorInterface &pchTaskGenerator,
ProjectPartsManagerInterface &projectParts,
- GeneratedFilesInterface &generatedFiles);
+ GeneratedFilesInterface &generatedFiles,
+ BuildDependenciesStorageInterface &buildDependenciesStorage);
void end() override;
void updateProjectParts(UpdateProjectPartsMessage &&message) override;
@@ -57,17 +59,22 @@ public:
void updateGeneratedFiles(UpdateGeneratedFilesMessage &&message) override;
void removeGeneratedFiles(RemoveGeneratedFilesMessage &&message) override;
- void pathsWithIdsChanged(const ProjectPartIds &ids) override;
+ void pathsWithIdsChanged(const std::vector<IdPaths> &idPaths) override;
void pathsChanged(const FilePathIds &filePathIds) override;
void setPchCreationProgress(int progress, int total);
void setDependencyCreationProgress(int progress, int total);
private:
+ void addCompleteProjectParts(const ProjectPartIds &projectPartIds);
+ void addNonSystemProjectParts(const ProjectPartIds &projectPartIds);
+
+private:
ClangPathWatcherInterface &m_fileSystemWatcher;
PchTaskGeneratorInterface &m_pchTaskGenerator;
ProjectPartsManagerInterface &m_projectPartsManager;
GeneratedFilesInterface &m_generatedFiles;
+ BuildDependenciesStorageInterface &m_buildDependenciesStorage;
ToolChainsArgumentsCache m_toolChainsArgumentsCache;
};
diff --git a/src/tools/clangpchmanagerbackend/source/pchtask.h b/src/tools/clangpchmanagerbackend/source/pchtask.h
index 74b410831e..f71a2745ad 100644
--- a/src/tools/clangpchmanagerbackend/source/pchtask.h
+++ b/src/tools/clangpchmanagerbackend/source/pchtask.h
@@ -42,7 +42,10 @@ class PchTask
public:
PchTask(ProjectPartId projectPartId,
FilePathIds &&includes,
- FilePathIds &&sources,
+ FilePathIds &&watchedSystemIncludes,
+ FilePathIds &&watchedProjectIncludes,
+ FilePathIds &&watchedUserIncludes,
+ FilePathIds &&watchedUserSources,
CompilerMacros &&compilerMacros,
Utils::SmallStringVector &&usedMacros, // TODO remove
Utils::SmallStringVector toolChainArguments,
@@ -53,7 +56,10 @@ public:
Utils::LanguageExtension languageExtension = Utils::LanguageExtension::None)
: projectPartIds({projectPartId})
, includes(includes)
- , sources(sources)
+ , watchedSystemIncludes(watchedSystemIncludes)
+ , watchedProjectIncludes(watchedProjectIncludes)
+ , watchedUserIncludes(watchedUserIncludes)
+ , watchedUserSources(watchedUserSources)
, compilerMacros(compilerMacros)
, systemIncludeSearchPaths(std::move(systemIncludeSearchPaths))
, projectIncludeSearchPaths(std::move(projectIncludeSearchPaths))
@@ -65,7 +71,10 @@ public:
PchTask(ProjectPartIds &&projectPartIds,
FilePathIds &&includes,
- FilePathIds &&sources,
+ FilePathIds &&watchedSystemIncludes,
+ FilePathIds &&watchedProjectIncludes,
+ FilePathIds &&watchedUserIncludes,
+ FilePathIds &&watchedUserSources,
CompilerMacros &&compilerMacros,
Utils::SmallStringVector &&usedMacros, // TODO remove
Utils::SmallStringVector toolChainArguments,
@@ -76,7 +85,10 @@ public:
Utils::LanguageExtension languageExtension = Utils::LanguageExtension::None)
: projectPartIds(std::move(projectPartIds))
, includes(includes)
- , sources(sources)
+ , watchedSystemIncludes(watchedSystemIncludes)
+ , watchedProjectIncludes(watchedProjectIncludes)
+ , watchedUserIncludes(watchedUserIncludes)
+ , watchedUserSources(watchedUserSources)
, compilerMacros(compilerMacros)
, systemIncludeSearchPaths(std::move(systemIncludeSearchPaths))
, projectIncludeSearchPaths(std::move(projectIncludeSearchPaths))
@@ -90,6 +102,10 @@ public:
{
return first.systemPchPath == second.systemPchPath
&& first.projectPartIds == second.projectPartIds && first.includes == second.includes
+ && first.watchedSystemIncludes == second.watchedSystemIncludes
+ && first.watchedProjectIncludes == second.watchedProjectIncludes
+ && first.watchedUserIncludes == second.watchedUserIncludes
+ && first.watchedUserSources == second.watchedUserSources
&& first.compilerMacros == second.compilerMacros
&& first.systemIncludeSearchPaths == second.systemIncludeSearchPaths
&& first.projectIncludeSearchPaths == second.projectIncludeSearchPaths
@@ -105,7 +121,10 @@ public:
FilePath systemPchPath;
ProjectPartIds projectPartIds;
FilePathIds includes;
- FilePathIds sources;
+ FilePathIds watchedSystemIncludes;
+ FilePathIds watchedProjectIncludes;
+ FilePathIds watchedUserIncludes;
+ FilePathIds watchedUserSources;
CompilerMacros compilerMacros;
IncludeSearchPaths systemIncludeSearchPaths;
IncludeSearchPaths projectIncludeSearchPaths;
diff --git a/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp
index c0a42eae39..7fe75d4779 100644
--- a/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp
+++ b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp
@@ -26,6 +26,7 @@
#include "pchtaskgenerator.h"
#include "builddependenciesproviderinterface.h"
+#include "pchtaskqueueinterface.h"
#include "pchtasksmergerinterface.h"
#include "usedmacrofilter.h"
@@ -52,6 +53,9 @@ void PchTaskGenerator::addProjectParts(ProjectPartContainers &&projectParts,
pchTaskSets.emplace_back(PchTask{projectPart.projectPartId,
std::move(filter.topSystemIncludes),
{},
+ {},
+ {},
+ {},
std::move(filter.systemCompilerMacros),
std::move(filter.systemUsedMacros),
projectPart.toolChainArguments,
@@ -62,6 +66,9 @@ void PchTaskGenerator::addProjectParts(ProjectPartContainers &&projectParts,
projectPart.languageExtension},
PchTask{projectPart.projectPartId,
std::move(filter.topProjectIncludes),
+ std::move(filter.systemIncludes),
+ std::move(filter.projectIncludes),
+ std::move(filter.userIncludes),
std::move(filter.sources),
std::move(filter.projectCompilerMacros),
std::move(filter.projectUsedMacros),
@@ -82,4 +89,38 @@ void PchTaskGenerator::removeProjectParts(const ProjectPartIds &projectsPartIds)
m_pchTasksMergerInterface.removePchTasks(projectsPartIds);
}
+void PchTaskGenerator::addNonSystemProjectParts(ProjectPartContainers &&projectParts,
+ Utils::SmallStringVector &&)
+{
+ PchTasks pchTasks;
+ pchTasks.reserve(projectParts.size());
+
+ m_progressCounter.addTotal(static_cast<int>(projectParts.size()));
+
+ for (auto &projectPart : projectParts) {
+ BuildDependency buildDependency = m_buildDependenciesProvider.create(projectPart);
+ UsedMacroFilter filter{buildDependency.sources,
+ buildDependency.usedMacros,
+ projectPart.compilerMacros};
+
+ pchTasks.emplace_back(projectPart.projectPartId,
+ std::move(filter.topProjectIncludes),
+ std::move(filter.systemIncludes),
+ std::move(filter.projectIncludes),
+ std::move(filter.userIncludes),
+ std::move(filter.sources),
+ std::move(filter.projectCompilerMacros),
+ std::move(filter.projectUsedMacros),
+ projectPart.toolChainArguments,
+ projectPart.systemIncludeSearchPaths,
+ projectPart.projectIncludeSearchPaths,
+ projectPart.language,
+ projectPart.languageVersion,
+ projectPart.languageExtension);
+ m_progressCounter.addProgress(1);
+ }
+
+ m_pchTaskQueue.addProjectPchTasks(std::move(pchTasks));
+}
+
} // namespace ClangBackEnd
diff --git a/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h
index dc7d201cde..be3d91c892 100644
--- a/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h
+++ b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h
@@ -35,6 +35,7 @@ namespace ClangBackEnd {
class PchTasksMergerInterface;
class BuildDependenciesProviderInterface;
+class PchTaskQueueInterface;
class ProgressCounter;
class PchTaskGenerator : public PchTaskGeneratorInterface
@@ -42,21 +43,26 @@ class PchTaskGenerator : public PchTaskGeneratorInterface
public:
PchTaskGenerator(BuildDependenciesProviderInterface &buildDependenciesProvider,
PchTasksMergerInterface &pchTasksMergerInterface,
- ProgressCounter &progressCounter)
+ ProgressCounter &progressCounter,
+ PchTaskQueueInterface &pchTaskQueue)
: m_buildDependenciesProvider(buildDependenciesProvider)
, m_pchTasksMergerInterface(pchTasksMergerInterface)
, m_progressCounter(progressCounter)
+ , m_pchTaskQueue(pchTaskQueue)
{}
void addProjectParts(ProjectPartContainers &&projectParts,
Utils::SmallStringVector &&toolChainArguments) override;
void removeProjectParts(const ProjectPartIds &projectsPartIds) override;
+ void addNonSystemProjectParts(ProjectPartContainers &&projectParts,
+ Utils::SmallStringVector &&toolChainArguments) override;
private:
BuildDependenciesProviderInterface &m_buildDependenciesProvider;
PchTasksMergerInterface &m_pchTasksMergerInterface;
ProgressCounter &m_progressCounter;
+ PchTaskQueueInterface &m_pchTaskQueue;
};
} // namespace ClangBackEnd
diff --git a/src/tools/clangpchmanagerbackend/source/pchtaskgeneratorinterface.h b/src/tools/clangpchmanagerbackend/source/pchtaskgeneratorinterface.h
index abb25d2ef1..302789ae9a 100644
--- a/src/tools/clangpchmanagerbackend/source/pchtaskgeneratorinterface.h
+++ b/src/tools/clangpchmanagerbackend/source/pchtaskgeneratorinterface.h
@@ -35,6 +35,9 @@ public:
virtual void addProjectParts(ProjectPartContainers &&projectParts,
Utils::SmallStringVector &&toolChainArguments)
= 0;
+ virtual void addNonSystemProjectParts(ProjectPartContainers &&projectParts,
+ Utils::SmallStringVector &&toolChainArguments)
+ = 0;
virtual void removeProjectParts(const ProjectPartIds &projectsPartIds) = 0;
protected:
diff --git a/src/tools/clangpchmanagerbackend/source/pchtasksmerger.cpp b/src/tools/clangpchmanagerbackend/source/pchtasksmerger.cpp
index 68a8e4a642..6436c0a0b4 100644
--- a/src/tools/clangpchmanagerbackend/source/pchtasksmerger.cpp
+++ b/src/tools/clangpchmanagerbackend/source/pchtasksmerger.cpp
@@ -98,8 +98,8 @@ bool PchTasksMerger::mergePchTasks(PchTask &firstTask, PchTask &secondTask)
firstTask.projectPartIds = merge(std::move(firstTask.projectPartIds),
std::move(secondTask.projectPartIds));
firstTask.includes = merge(std::move(firstTask.includes), std::move(secondTask.includes));
- firstTask.sources = merge(std::move(firstTask.sources),
- std::move(secondTask.sources));
+ firstTask.watchedSystemIncludes = merge(std::move(firstTask.watchedSystemIncludes),
+ std::move(secondTask.watchedSystemIncludes));
firstTask.compilerMacros = std::move(macros);
firstTask.systemIncludeSearchPaths = mergeIncludeSearchPaths(
std::move(firstTask.systemIncludeSearchPaths),
diff --git a/src/tools/clangpchmanagerbackend/source/usedmacrofilter.h b/src/tools/clangpchmanagerbackend/source/usedmacrofilter.h
index 2d16b484a1..63bb503e75 100644
--- a/src/tools/clangpchmanagerbackend/source/usedmacrofilter.h
+++ b/src/tools/clangpchmanagerbackend/source/usedmacrofilter.h
@@ -99,6 +99,7 @@ public:
projectIncludes.reserve(sources.size());
topSystemIncludes.reserve(sources.size() / 10);
topProjectIncludes.reserve(sources.size() / 10);
+ userIncludes.reserve(sources.size());
this->sources.reserve(sources.size());
for (SourceEntry source : sources)
@@ -128,23 +129,22 @@ private:
case SourceType::TopSystemInclude:
topSystemIncludes.emplace_back(source.sourceId);
systemIncludes.emplace_back(source.sourceId);
- sources.emplace_back(source.sourceId);
break;
case SourceType::SystemInclude:
systemIncludes.emplace_back(source.sourceId);
- sources.emplace_back(source.sourceId);
break;
case SourceType::TopProjectInclude:
topProjectIncludes.emplace_back(source.sourceId);
projectIncludes.emplace_back(source.sourceId);
- sources.emplace_back(source.sourceId);
break;
case SourceType::ProjectInclude:
projectIncludes.emplace_back(source.sourceId);
- sources.emplace_back(source.sourceId);
break;
case SourceType::UserInclude:
+ userIncludes.emplace_back(source.sourceId);
+ break;
case SourceType::Source:
+ sources.emplace_back(source.sourceId);
break;
}
@@ -215,6 +215,7 @@ private:
public:
FilePathIds sources;
+ FilePathIds userIncludes;
FilePathIds projectIncludes;
FilePathIds systemIncludes;
FilePathIds topProjectIncludes;
diff --git a/src/tools/clangrefactoringbackend/source/CMakeLists.txt b/src/tools/clangrefactoringbackend/source/CMakeLists.txt
index d43472fd60..6c149bf9cd 100644
--- a/src/tools/clangrefactoringbackend/source/CMakeLists.txt
+++ b/src/tools/clangrefactoringbackend/source/CMakeLists.txt
@@ -18,8 +18,6 @@ add_qtc_library(clangrefactoringbackend_lib STATIC
collectmacrospreprocessorcallbacks.h
collectmacrossourcefilecallbacks.cpp collectmacrossourcefilecallbacks.h
collectsymbolsaction.cpp collectsymbolsaction.h
- filestatus.h
- filestatuscache.cpp filestatuscache.h
filestatuspreprocessorcallbacks.cpp filestatuspreprocessorcallbacks.h
findcursorusr.h
findlocationsofusrs.h
diff --git a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri
index a3da84d83b..9c51093632 100644
--- a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri
+++ b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri
@@ -26,11 +26,8 @@ HEADERS += \
!isEmpty(LIBTOOLING_LIBS) {
SOURCES += \
$$PWD/refactoringcompilationdatabase.cpp \
- $$PWD/symbolfinder.cpp \
- $$PWD/symbollocationfinderaction.cpp \
$$PWD/refactoringserver.cpp \
$$PWD/macropreprocessorcallbacks.cpp \
- $$PWD/findusrforcursoraction.cpp \
$$PWD/clangquery.cpp \
$$PWD/clangtool.cpp \
$$PWD/sourcerangeextractor.cpp \
@@ -44,14 +41,10 @@ SOURCES += \
HEADERS += \
$$PWD/refactoringcompilationdatabase.h \
- $$PWD/symbolfinder.h \
- $$PWD/symbollocationfinderaction.h \
$$PWD/refactoringserver.h \
$$PWD/macropreprocessorcallbacks.h \
$$PWD/sourcelocationsutils.h \
$$PWD/findcursorusr.h \
- $$PWD/findusrforcursoraction.h \
- $$PWD/findlocationsofusrs.h \
$$PWD/clangquery.h \
$$PWD/clangtool.h \
$$PWD/sourcerangeextractor.h \
diff --git a/src/tools/clangrefactoringbackend/source/findcursorusr.h b/src/tools/clangrefactoringbackend/source/findcursorusr.h
deleted file mode 100644
index 06777d8611..0000000000
--- a/src/tools/clangrefactoringbackend/source/findcursorusr.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangrefactoringbackend_global.h"
-
-#include <clang/AST/AST.h>
-#include <clang/AST/ASTContext.h>
-#include <clang/AST/RecursiveASTVisitor.h>
-#include <clang/Index/USRGeneration.h>
-#include <llvm/ADT/SmallVector.h>
-
-#include <vector>
-
-namespace ClangBackEnd {
-
-class FindNamedDeclarationASTVisitor : public clang::RecursiveASTVisitor<FindNamedDeclarationASTVisitor>
-{
-public:
- explicit FindNamedDeclarationASTVisitor(const clang::SourceManager &sourceManager,
- const clang::SourceLocation cursorSourceLocation)
- : m_sourceManager(sourceManager),
- m_cursorSourceLocation(cursorSourceLocation)
- {
- }
-
- bool shouldVisitTemplateInstantiations() const
- {
- return true;
- }
-
- bool VisitNamedDecl(const clang::NamedDecl *declaration)
- {
- auto name = declaration->getNameAsString();
-
- setResultIfCursorIsInBetween(declaration,
- declaration->getLocation(),
- declaration->getNameAsString().length());
-
- return true;
- }
-
- bool VisitDeclRefExpr(const clang::DeclRefExpr *expression)
- {
- if (!iterateNestedNameSpecifierLocation(expression->getQualifierLoc()))
- return false;
-
- const auto *declaration = expression->getFoundDecl();
- return setResultIfCursorIsInBetween(declaration,
- expression->getLocation(),
- declaration->getNameAsString().length());
- }
-
- bool VisitMemberExpr(const clang::MemberExpr *expression)
- {
- const auto *declaration = expression->getFoundDecl().getDecl();
- return setResultIfCursorIsInBetween(declaration,
- expression->getMemberLoc(),
- declaration->getNameAsString().length());
- }
-
- std::vector<const clang::NamedDecl*> takeNamedDecl()
- {
- return std::move(m_namedDeclarations);
- }
-
-private:
- bool canSetResult(const clang::NamedDecl *declaration,
- clang::SourceLocation location)
- {
- return declaration
- && !setResultIfCursorIsInBetween(declaration,
- location,
- declaration->getNameAsString().length());
- }
-
- bool iterateNestedNameSpecifierLocation(clang::NestedNameSpecifierLoc nameLocation) {
- while (nameLocation) {
- const auto *declaration = nameLocation.getNestedNameSpecifier()->getAsNamespace();
- if (canSetResult(declaration, nameLocation.getLocalBeginLoc()))
- return false;
-
- nameLocation = nameLocation.getPrefix();
- }
-
- return true;
- }
-
- bool isValidLocationWithCursorInside(clang::SourceLocation startLocation,
- clang::SourceLocation endLocation)
- {
- return startLocation.isValid()
- && startLocation.isFileID()
- && endLocation.isValid()
- && endLocation.isFileID()
- && isCursorLocationBetween(startLocation, endLocation);
- }
-
- bool setResultIfCursorIsInBetween(const clang::NamedDecl *declaration,
- clang::SourceLocation startLocation,
- clang::SourceLocation endLocation)
- {
- bool isValid = isValidLocationWithCursorInside(startLocation, endLocation);
-
- if (isValid)
- m_namedDeclarations.push_back(declaration);
-
- return !isValid;
- }
-
- bool setResultIfCursorIsInBetween(const clang::NamedDecl *declaration,
- clang::SourceLocation location,
- uint offset) {
- return offset == 0
- || setResultIfCursorIsInBetween(declaration, location, location.getLocWithOffset(offset - 1));
- }
-
- bool isCursorLocationBetween(const clang::SourceLocation startLocation,
- const clang::SourceLocation endLocation)
- {
- return m_cursorSourceLocation == startLocation
- || m_cursorSourceLocation == endLocation
- || (m_sourceManager.isBeforeInTranslationUnit(startLocation, m_cursorSourceLocation)
- && m_sourceManager.isBeforeInTranslationUnit(m_cursorSourceLocation, endLocation));
- }
-
- std::vector<const clang::NamedDecl*> m_namedDeclarations;
- const clang::SourceManager &m_sourceManager;
- const clang::SourceLocation m_cursorSourceLocation;
-};
-
-inline
-std::vector<const clang::NamedDecl *> namedDeclarationsAt(const clang::ASTContext &Context,
- const clang::SourceLocation cursorSourceLocation)
-{
- const auto &sourceManager = Context.getSourceManager();
- const auto currentFile = sourceManager.getFilename(cursorSourceLocation);
-
- FindNamedDeclarationASTVisitor visitor(sourceManager, cursorSourceLocation);
-
- auto declarations = Context.getTranslationUnitDecl()->decls();
- for (auto &currentDeclation : declarations) {
- const auto &fileLocation = currentDeclation->getBeginLoc();
- const auto &fileName = sourceManager.getFilename(fileLocation);
- if (fileName == currentFile) {
- visitor.TraverseDecl(currentDeclation);
- const auto &namedDeclarations = visitor.takeNamedDecl();
-
- if (!namedDeclarations.empty())
- return namedDeclarations;
- }
- }
-
- return std::vector<const clang::NamedDecl *>();
-}
-
-inline
-USRName USROfDeclaration(const clang::Decl *declaration)
-{
- USRName buffer;
-
- if (declaration == nullptr || clang::index::generateUSRForDecl(declaration, buffer))
- return buffer;
-
- return buffer;
-}
-
-} // namespace ClangBackend
diff --git a/src/tools/clangrefactoringbackend/source/findlocationsofusrs.h b/src/tools/clangrefactoringbackend/source/findlocationsofusrs.h
deleted file mode 100644
index b6662205da..0000000000
--- a/src/tools/clangrefactoringbackend/source/findlocationsofusrs.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "findcursorusr.h"
-
-#include <clang/AST/ASTContext.h>
-#include <clang/AST/RecursiveASTVisitor.h>
-#include <clang/Basic/SourceLocation.h>
-#include <clang/Index/USRGeneration.h>
-#include <llvm/ADT/SmallVector.h>
-
-#include <vector>
-
-namespace ClangBackEnd {
-
-class FindLocationsOfUSRsASTVisitor : public clang::RecursiveASTVisitor<FindLocationsOfUSRsASTVisitor>
-{
-public:
- explicit FindLocationsOfUSRsASTVisitor(const std::vector<USRName> &unifiedSymbolResolutions)
- : unifiedSymbolResolutions(unifiedSymbolResolutions)
- {
- }
-
- bool VisitNamedDecl(const clang::NamedDecl *declaration) {
- auto declarationUSR = USROfDeclaration(declaration);
-
- if (containsUSR(declarationUSR))
- foundLocations.push_back(declaration->getLocation());
-
- return true;
- }
-
- bool VisitDeclRefExpr(const clang::DeclRefExpr *expression) {
- const auto *declaration = expression->getFoundDecl();
-
- iterateNestedNameSpecifierLocation(expression->getQualifierLoc());
- auto declarationUSR = USROfDeclaration(declaration);
-
- if (containsUSR(declarationUSR))
- foundLocations.push_back(expression->getLocation());
-
- return true;
- }
-
- bool VisitMemberExpr(const clang::MemberExpr *expression) {
- const auto *declaration = expression->getFoundDecl().getDecl();
- auto declarationUSR = USROfDeclaration(declaration);
-
- if (containsUSR(declarationUSR))
- foundLocations.push_back(expression->getMemberLoc());
-
- return true;
- }
-
- bool shouldVisitTemplateInstantiations() const
- {
- return true;
- }
-
- std::vector<clang::SourceLocation> takeFoundLocations() const {
- return std::move(foundLocations);
- }
-
-private:
- void iterateNestedNameSpecifierLocation(clang::NestedNameSpecifierLoc nameLocation) {
- while (nameLocation) {
- const auto *declaration = nameLocation.getNestedNameSpecifier()->getAsNamespace();
- if (declaration && containsUSR(USROfDeclaration(declaration)))
- foundLocations.push_back(nameLocation.getLocalBeginLoc());
-
- nameLocation = nameLocation.getPrefix();
- }
- }
-
- bool containsUSR(const USRName &unifiedSymbolResolution)
- {
- auto found = std::find(unifiedSymbolResolutions.cbegin(),
- unifiedSymbolResolutions.cend(),
- unifiedSymbolResolution);
-
- return found != unifiedSymbolResolutions.cend();
- }
-
-private:
-
- // All the locations of the USR were found.
- const std::vector<USRName> unifiedSymbolResolutions;
- std::vector<clang::SourceLocation> foundLocations;
-};
-
-inline
-std::vector<clang::SourceLocation> takeLocationsOfUSRs(std::vector<USRName> &unifiedSymbolResolutions,
- clang::Decl *declartation)
-{
- FindLocationsOfUSRsASTVisitor visitor(unifiedSymbolResolutions);
-
- visitor.TraverseDecl(declartation);
-
- return visitor.takeFoundLocations();
-}
-
-} // namespace ClangBackend
diff --git a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp b/src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp
deleted file mode 100644
index 6fa964f531..0000000000
--- a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#include "findusrforcursoraction.h"
-
-#include "findcursorusr.h"
-
-#include <clang/AST/AST.h>
-#include <clang/AST/ASTConsumer.h>
-#include <clang/AST/ASTContext.h>
-
-#include <algorithm>
-#include <vector>
-
-namespace ClangBackEnd {
-
-namespace {
-
-std::vector<USRName> collectConstructorUnifiedSymbolResolutions(const clang::CXXRecordDecl *declarations)
-{
- std::vector<USRName> unifiedSymbolResolutions;
-
- const auto constructorDeclarations = declarations->getDefinition()->ctors();
-
- std::transform(constructorDeclarations.begin(),
- constructorDeclarations.end(),
- std::back_inserter(unifiedSymbolResolutions),
- USROfDeclaration);
-
- return unifiedSymbolResolutions;
-}
-
-void addUnifiedSymbolResolutionsForDeclaration(const std::vector<const clang::NamedDecl *> &declarations,
- std::vector<USRName> &usrs)
-{
-
- std::transform(declarations.begin(),
- declarations.end(),
- std::back_inserter(usrs),
- [&] (const clang::NamedDecl *declaration) {
- return USROfDeclaration(declaration);
- });
-}
-
-}
-
-class FindDeclarationsConsumer : public clang::ASTConsumer
-{
-public:
- FindDeclarationsConsumer(Utils::SmallString &symbolName,
- std::vector<USRName> &unifiedSymbolResolutions,
- uint line,
- uint column)
- : m_symbolName(symbolName),
- m_unifiedSymbolResolutions(unifiedSymbolResolutions),
- m_line(line),
- m_column(column)
- {
- }
-
- void HandleTranslationUnit(clang::ASTContext &astContext) override {
- const auto &sourceManager = astContext.getSourceManager();
- const auto cursorSourceLocation = sourceManager.translateLineCol(sourceManager.getMainFileID(),
- m_line,
- m_column);
-
- if (cursorSourceLocation.isValid())
- collectUnifiedSymbolResoltions(astContext, cursorSourceLocation);
- }
-
- void collectUnifiedSymbolResoltions(clang::ASTContext &astContext,
- const clang::SourceLocation &cursorSourceLocation)
- {
- const auto foundDeclarations = namedDeclarationsAt(astContext, cursorSourceLocation);
-
- if (!foundDeclarations.empty()) {
- const auto firstFoundDeclaration = foundDeclarations.front();
-
- if (const auto *constructorDecl = clang::dyn_cast<clang::CXXConstructorDecl>(firstFoundDeclaration)) {
- const clang::CXXRecordDecl *foundDeclarationParent = constructorDecl->getParent();
- m_unifiedSymbolResolutions = collectConstructorUnifiedSymbolResolutions(foundDeclarationParent);
- } else if (const auto *destructorDecl = clang::dyn_cast<clang::CXXDestructorDecl>(firstFoundDeclaration)) {
- const clang::CXXRecordDecl *foundDeclarationParent = destructorDecl->getParent();
- m_unifiedSymbolResolutions = collectConstructorUnifiedSymbolResolutions(foundDeclarationParent);
- } else if (const auto *recordDeclaration = clang::dyn_cast<clang::CXXRecordDecl>(firstFoundDeclaration)) {
- m_unifiedSymbolResolutions = collectConstructorUnifiedSymbolResolutions(recordDeclaration);
- }
-
- addUnifiedSymbolResolutionsForDeclaration(foundDeclarations, m_unifiedSymbolResolutions);
- m_symbolName = firstFoundDeclaration->getNameAsString();
- }
- }
-
-private:
- Utils::SmallString &m_symbolName;
- std::vector<USRName> &m_unifiedSymbolResolutions;
- uint m_line;
- uint m_column;
-};
-
-std::unique_ptr<clang::ASTConsumer>
-USRFindingAction::newASTConsumer() {
- return std::make_unique<FindDeclarationsConsumer>(m_symbolName, m_unifiedSymbolResolutions, m_line, m_column);
-}
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.h b/src/tools/clangrefactoringbackend/source/findusrforcursoraction.h
deleted file mode 100644
index bfa4a373a4..0000000000
--- a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangrefactoringbackend_global.h"
-
-#include <utils/smallstring.h>
-
-#include <clang/Frontend/FrontendAction.h>
-
-namespace clang {
-class ASTConsumer;
-class CompilerInstance;
-class NamedDecl;
-}
-
-namespace ClangBackEnd {
-
-class USRFindingAction
-{
-public:
- USRFindingAction(uint line, uint column)
- : m_line(line),
- m_column(column)
- {
- }
-
- std::unique_ptr<clang::ASTConsumer> newASTConsumer();
-
- std::string takeSymbolName()
- {
- return std::string(m_symbolName);
- }
-
- std::vector<USRName> takeUnifiedSymbolResolutions()
- {
- return std::move(m_unifiedSymbolResolutions);
- }
-
-private:
- Utils::SmallString m_symbolName;
- std::vector<USRName> m_unifiedSymbolResolutions;
- uint m_line;
- uint m_column;
-};
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/refactoringserver.cpp b/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
index 83aa5a31fd..387f850c0f 100644
--- a/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
+++ b/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
@@ -25,7 +25,6 @@
#include "refactoringserver.h"
-#include "symbolfinder.h"
#include "clangquery.h"
#include "symbolindexing.h"
@@ -58,21 +57,6 @@ void RefactoringServer::end()
QCoreApplication::exit();
}
-void RefactoringServer::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
-{
- SymbolFinder symbolFinder(message.line, message.column, m_filePathCache);
-
- symbolFinder.addFile(std::move(message.filePath),
- std::move(message.unsavedContent),
- std::move(message.commandLine));
-
- symbolFinder.findSymbol();
-
- client()->sourceLocationsForRenamingMessage({symbolFinder.takeSymbolName(),
- symbolFinder.takeSourceLocations(),
- message.textDocumentRevision});
-}
-
void RefactoringServer::requestSourceRangesAndDiagnosticsForQueryMessage(
RequestSourceRangesAndDiagnosticsForQueryMessage &&message)
{
diff --git a/src/tools/clangrefactoringbackend/source/refactoringserver.h b/src/tools/clangrefactoringbackend/source/refactoringserver.h
index 75b161f1ab..7934790518 100644
--- a/src/tools/clangrefactoringbackend/source/refactoringserver.h
+++ b/src/tools/clangrefactoringbackend/source/refactoringserver.h
@@ -60,7 +60,6 @@ public:
GeneratedFiles &generatedFiles);
void end() override;
- void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) override;
void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) override;
void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) override;
void updateProjectParts(UpdateProjectPartsMessage &&message) override;
diff --git a/src/tools/clangrefactoringbackend/source/symbolfinder.cpp b/src/tools/clangrefactoringbackend/source/symbolfinder.cpp
deleted file mode 100644
index 8f002f10a1..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbolfinder.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#include "symbolfinder.h"
-
-#include "locationsourcefilecallbacks.h"
-#include "symbollocationfinderaction.h"
-
-namespace ClangBackEnd {
-
-SymbolFinder::SymbolFinder(uint line, uint column, FilePathCachingInterface &filePathCache)
- : m_usrFindingAction(line, column),
- m_symbolLocationFinderAction(filePathCache),
- m_sourceFileCallbacks(line, column, filePathCache)
-{
-}
-
-void SymbolFinder::findSymbol()
-{
- clang::tooling::ClangTool tool = createTool();
-
- tool.run(clang::tooling::newFrontendActionFactory(&m_usrFindingAction, &m_sourceFileCallbacks).get());
-
- if (m_sourceFileCallbacks.hasSourceLocations()) {
- m_sourceLocations_ = m_sourceFileCallbacks.takeSourceLocations();
- m_symbolName = m_sourceFileCallbacks.takeSymbolName();
- } else {
- m_symbolLocationFinderAction.setUnifiedSymbolResolutions(m_usrFindingAction.takeUnifiedSymbolResolutions());
-
- tool.run(clang::tooling::newFrontendActionFactory(&m_symbolLocationFinderAction).get());
-
- m_sourceLocations_ = m_symbolLocationFinderAction.takeSourceLocations();
- m_symbolName = m_usrFindingAction.takeSymbolName();
- }
-}
-
-Utils::SmallString SymbolFinder::takeSymbolName()
-{
- return std::move(m_symbolName);
-}
-
-const std::vector<USRName> &SymbolFinder::unifiedSymbolResolutions()
-{
- return m_symbolLocationFinderAction.unifiedSymbolResolutions();
-}
-
-const SourceLocationsContainer &SymbolFinder::sourceLocations() const
-{
- return m_sourceLocations_;
-}
-
-SourceLocationsContainer SymbolFinder::takeSourceLocations()
-{
- return std::move(m_sourceLocations_);
-}
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbolfinder.h b/src/tools/clangrefactoringbackend/source/symbolfinder.h
deleted file mode 100644
index a3c9659032..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbolfinder.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangtool.h"
-#include "findusrforcursoraction.h"
-#include "symbollocationfinderaction.h"
-#include "locationsourcefilecallbacks.h"
-
-#include <filepathcachingfwd.h>
-#include <sourcelocationscontainer.h>
-
-namespace ClangBackEnd {
-
-class SymbolFinder : public ClangTool
-{
-public:
- SymbolFinder(uint line, uint column, FilePathCachingInterface &filePathCache);
-
- void findSymbol();
-
- Utils::SmallString takeSymbolName();
- const std::vector<USRName> &unifiedSymbolResolutions();
- const SourceLocationsContainer &sourceLocations() const;
- SourceLocationsContainer takeSourceLocations();
-
-private:
- Utils::SmallString m_symbolName;
- USRFindingAction m_usrFindingAction;
- SymbolLocationFinderAction m_symbolLocationFinderAction;
- LocationSourceFileCallbacks m_sourceFileCallbacks;
- ClangBackEnd::SourceLocationsContainer m_sourceLocations_;
-};
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
index 4f3a6f172f..4d042b3fd3 100644
--- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
+++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
@@ -98,7 +98,7 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
std::vector<SymbolIndexerTask> symbolIndexerTask;
symbolIndexerTask.reserve(projectPart.sourcePathIds.size());
for (FilePathId sourcePathId : projectPart.sourcePathIds) {
- SourceTimeStamps dependentTimeStamps = m_symbolStorage.fetchIncludedIndexingTimeStamps(
+ SourceTimeStamps dependentTimeStamps = m_buildDependencyStorage.fetchIncludedIndexingTimeStamps(
sourcePathId);
if (!m_modifiedTimeChecker.isUpToDate(dependentTimeStamps)) {
@@ -122,7 +122,8 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
auto store = [&] {
Sqlite::ImmediateTransaction transaction{m_transactionInterface};
- m_symbolStorage.insertOrUpdateIndexingTimeStamps(symbolsCollector.fileStatuses());
+ m_buildDependencyStorage.insertOrUpdateIndexingTimeStamps(
+ symbolsCollector.fileStatuses());
m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
symbolsCollector.sourceLocations());
transaction.commit();
@@ -144,28 +145,17 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
}
}
- m_pathWatcher.updateIdPaths(
- {{projectPartId, m_buildDependencyStorage.fetchPchSources(projectPartId)}});
+ m_pathWatcher.updateIdPaths({{{projectPartId, SourceType::Source},
+ m_buildDependencyStorage.fetchPchSources(projectPartId)}});
m_symbolIndexerTaskQueue.addOrUpdateTasks(std::move(symbolIndexerTask));
m_symbolIndexerTaskQueue.processEntries();
}
-void SymbolIndexer::pathsWithIdsChanged(const ProjectPartIds &) {}
+void SymbolIndexer::pathsWithIdsChanged(const std::vector<IdPaths> &) {}
void SymbolIndexer::pathsChanged(const FilePathIds &filePathIds)
{
m_modifiedTimeChecker.pathsChanged(filePathIds);
-
- FilePathIds dependentSourcePathIds = m_symbolStorage.fetchDependentSourceIds(filePathIds);
-
- std::vector<SymbolIndexerTask> symbolIndexerTask;
- symbolIndexerTask.reserve(dependentSourcePathIds.size());
-
- for (FilePathId dependentSourcePathId : dependentSourcePathIds)
- updateChangedPath(dependentSourcePathId, symbolIndexerTask);
-
- m_symbolIndexerTaskQueue.addOrUpdateTasks(std::move(symbolIndexerTask));
- m_symbolIndexerTaskQueue.processEntries();
}
void SymbolIndexer::updateChangedPath(FilePathId filePathId,
@@ -182,7 +172,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
ProjectPartId projectPartId = optionalArtefact->projectPartId;
- SourceTimeStamps dependentTimeStamps = m_symbolStorage.fetchIncludedIndexingTimeStamps(filePathId);
+ SourceTimeStamps dependentTimeStamps = m_buildDependencyStorage.fetchIncludedIndexingTimeStamps(
+ filePathId);
auto indexing = [optionalArtefact = std::move(optionalArtefact),
filePathId,
@@ -207,7 +198,7 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
auto store = [&] {
Sqlite::ImmediateTransaction transaction{m_transactionInterface};
- m_symbolStorage.insertOrUpdateIndexingTimeStamps(symbolsCollector.fileStatuses());
+ m_buildDependencyStorage.insertOrUpdateIndexingTimeStamps(symbolsCollector.fileStatuses());
m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
symbolsCollector.sourceLocations());
transaction.commit();
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.h b/src/tools/clangrefactoringbackend/source/symbolindexer.h
index d969cd8026..67da0c9774 100644
--- a/src/tools/clangrefactoringbackend/source/symbolindexer.h
+++ b/src/tools/clangrefactoringbackend/source/symbolindexer.h
@@ -60,7 +60,7 @@ public:
void updateProjectParts(ProjectPartContainers &&projectParts);
void updateProjectPart(ProjectPartContainer &&projectPart);
- void pathsWithIdsChanged(const ProjectPartIds &ids) override;
+ void pathsWithIdsChanged(const std::vector<IdPaths> &idPaths) override;
void pathsChanged(const FilePathIds &filePathIds) override;
void updateChangedPath(FilePathId filePath,
std::vector<SymbolIndexerTask> &symbolIndexerTask);
@@ -76,6 +76,9 @@ public:
const Utils::optional<ProjectPartArtefact> &optionalArtefact) const;
private:
+ FilePathIds filterProjectPartSources(const FilePathIds &filePathIds) const;
+
+private:
SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue;
SymbolStorageInterface &m_symbolStorage;
BuildDependenciesStorageInterface &m_buildDependencyStorage;
diff --git a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp b/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp
deleted file mode 100644
index eddcf683c7..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#include "symbollocationfinderaction.h"
-
-#include "sourcelocationsutils.h"
-#include "findlocationsofusrs.h"
-
-#include <filepathcachingfwd.h>
-
-#include <clang/AST/ASTConsumer.h>
-#include <clang/AST/ASTContext.h>
-
-#include <memory>
-
-namespace ClangBackEnd {
-
-class FindingSymbolsASTConsumer : public clang::ASTConsumer
-{
-public:
- FindingSymbolsASTConsumer(std::vector<USRName> &unifiedSymbolResolutions,
- FilePathCachingInterface &filePathCache)
- : m_unifiedSymbolResolutions(unifiedSymbolResolutions),
- m_filePathCache(filePathCache)
- {
- }
-
- void HandleTranslationUnit(clang::ASTContext &context) override
- {
- std::vector<clang::SourceLocation> sourceLocations;
-
-
- auto &&sourceLocationsOfUsr = takeLocationsOfUSRs(m_unifiedSymbolResolutions, context.getTranslationUnitDecl());
- sourceLocations.insert(sourceLocations.end(),
- sourceLocationsOfUsr.begin(),
- sourceLocationsOfUsr.end());
-
-
- std::sort(sourceLocations.begin(), sourceLocations.end());
- auto newEnd = std::unique(sourceLocations.begin(), sourceLocations.end());
- sourceLocations.erase(newEnd, sourceLocations.end());
-
- updateSourceLocations(sourceLocations, context.getSourceManager());
-
- }
-
- void updateSourceLocations(const std::vector<clang::SourceLocation> &sourceLocations,
- const clang::SourceManager &sourceManager)
- {
- appendSourceLocationsToSourceLocationsContainer(*m_sourceLocationsContainer,
- sourceLocations,
- sourceManager,
- m_filePathCache);
- }
-
- void setSourceLocations(ClangBackEnd::SourceLocationsContainer *sourceLocations)
- {
- m_sourceLocationsContainer = sourceLocations;
- }
-
-private:
- ClangBackEnd::SourceLocationsContainer *m_sourceLocationsContainer = nullptr;
- std::vector<USRName> &m_unifiedSymbolResolutions;
- FilePathCachingInterface &m_filePathCache;
-};
-
-std::unique_ptr<clang::ASTConsumer> SymbolLocationFinderAction::newASTConsumer()
-{
- auto consumer = std::make_unique<FindingSymbolsASTConsumer>(m_unifiedSymbolResolutions_,
- m_filePathCache);
-
- consumer->setSourceLocations(&m_sourceLocations);
-
- return consumer;
-}
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h b/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h
deleted file mode 100644
index e3f4c4a2f3..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangrefactoringbackend_global.h"
-
-#include <filepathcachingfwd.h>
-#include <sourcelocationscontainer.h>
-
-#include <clang/Tooling/Refactoring.h>
-
-namespace clang {
-class ASTConsumer;
-}
-
-namespace ClangBackEnd {
-
-class SymbolLocationFinderAction
-{
-public:
- SymbolLocationFinderAction(FilePathCachingInterface &filePathCache)
- : m_filePathCache(filePathCache)
- {}
-
- std::unique_ptr<clang::ASTConsumer> newASTConsumer();
-
- SourceLocationsContainer takeSourceLocations()
- {
- return std::move(m_sourceLocations);
- }
-
- void setUnifiedSymbolResolutions(std::vector<USRName> &&unifiedSymbolResolutions)
- {
- m_unifiedSymbolResolutions_ = std::move(unifiedSymbolResolutions);
- }
-
- const std::vector<USRName> &unifiedSymbolResolutions() const
- {
- return m_unifiedSymbolResolutions_;
- }
-
-private:
- ClangBackEnd::SourceLocationsContainer m_sourceLocations;
- std::vector<USRName> m_unifiedSymbolResolutions_;
- FilePathCachingInterface &m_filePathCache;
-};
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbolstorage.h b/src/tools/clangrefactoringbackend/source/symbolstorage.h
index 3d7d4c9784..cf7d64e800 100644
--- a/src/tools/clangrefactoringbackend/source/symbolstorage.h
+++ b/src/tools/clangrefactoringbackend/source/symbolstorage.h
@@ -70,93 +70,6 @@ public:
deleteNewLocationsTable();
}
- void insertOrUpdateIndexingTimeStamps(const FilePathIds &filePathIds, TimeStamp indexingTimeStamp) override
- {
- try {
- Sqlite::ImmediateTransaction transaction{database};
-
- for (FilePathId filePathId : filePathIds) {
- inserOrUpdateIndexingTimesStampStatement.write(filePathId.filePathId,
- indexingTimeStamp.value);
- }
-
- transaction.commit();
- } catch (const Sqlite::StatementIsBusy &) {
- insertOrUpdateIndexingTimeStamps(filePathIds, indexingTimeStamp);
- }
- }
-
- void insertOrUpdateIndexingTimeStamps(const FileStatuses &fileStatuses) override
- {
- for (FileStatus fileStatus : fileStatuses) {
- inserOrUpdateIndexingTimesStampStatement.write(fileStatus.filePathId.filePathId,
- fileStatus.lastModified);
- }
- }
-
- SourceTimeStamps fetchIndexingTimeStamps() const override
- {
- try {
- Sqlite::DeferredTransaction transaction{database};
-
- auto timeStamps = fetchIndexingTimeStampsStatement.template values<SourceTimeStamp, 2>(
- 1024);
-
- transaction.commit();
-
- return timeStamps;
- } catch (const Sqlite::StatementIsBusy &) {
- return fetchIndexingTimeStamps();
- }
- }
-
- SourceTimeStamps fetchIncludedIndexingTimeStamps(FilePathId sourcePathId) const override
- {
- try {
- Sqlite::DeferredTransaction transaction{database};
-
- auto timeStamps = fetchIncludedIndexingTimeStampsStatement
- .template values<SourceTimeStamp, 2>(1024, sourcePathId.filePathId);
-
- transaction.commit();
-
- return timeStamps;
- } catch (const Sqlite::StatementIsBusy &) {
- return fetchIncludedIndexingTimeStamps(sourcePathId);
- }
- }
-
- FilePathIds fetchDependentSourceIds(const FilePathIds &sourcePathIds) const override
- {
- try {
- FilePathIds dependentSourceIds;
-
- Sqlite::DeferredTransaction transaction{database};
-
- for (FilePathId sourcePathId : sourcePathIds) {
- FilePathIds newDependentSourceIds;
- newDependentSourceIds.reserve(dependentSourceIds.size() + 1024);
-
- auto newIds = fetchDependentSourceIdsStatement
- .template values<FilePathId>(1024, sourcePathId.filePathId);
-
- std::set_union(dependentSourceIds.begin(),
- dependentSourceIds.end(),
- newIds.begin(),
- newIds.end(),
- std::back_inserter(newDependentSourceIds));
-
- dependentSourceIds = std::move(newDependentSourceIds);
- }
-
- transaction.commit();
-
- return dependentSourceIds;
- } catch (const Sqlite::StatementIsBusy &) {
- return fetchDependentSourceIds(sourcePathIds);
- }
- }
-
void fillTemporarySymbolsTable(const SymbolEntries &symbolEntries)
{
WriteStatement &statement = insertSymbolsToNewSymbolsStatement;
@@ -278,25 +191,6 @@ public:
database};
WriteStatement deleteNewSymbolsTableStatement{"DELETE FROM newSymbols", database};
WriteStatement deleteNewLocationsTableStatement{"DELETE FROM newLocations", database};
- WriteStatement inserOrUpdateIndexingTimesStampStatement{
- "INSERT INTO fileStatuses(sourceId, indexingTimeStamp) VALUES (?001, ?002) ON "
- "CONFLICT(sourceId) DO UPDATE SET indexingTimeStamp = ?002",
- database};
- mutable ReadStatement fetchIncludedIndexingTimeStampsStatement{
- "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT "
- "dependencySourceId FROM sourceDependencies, collectedDependencies WHERE "
- "sourceDependencies.sourceId == collectedDependencies.sourceId) SELECT DISTINCT sourceId, "
- "indexingTimeStamp FROM collectedDependencies NATURAL JOIN fileStatuses ORDER BY sourceId",
- database};
- mutable ReadStatement fetchIndexingTimeStampsStatement{
- "SELECT sourceId, indexingTimeStamp FROM fileStatuses", database};
- mutable ReadStatement fetchDependentSourceIdsStatement{
- "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT "
- "sourceDependencies.sourceId FROM sourceDependencies, collectedDependencies WHERE "
- "sourceDependencies.dependencySourceId == collectedDependencies.sourceId) SELECT sourceId "
- "FROM collectedDependencies WHERE sourceId NOT IN (SELECT dependencySourceId FROM "
- "sourceDependencies) ORDER BY sourceId",
- database};
};
} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h b/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h
index d3c8035e8c..1d0328e9f8 100644
--- a/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h
+++ b/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h
@@ -48,11 +48,6 @@ public:
virtual void addSymbolsAndSourceLocations(const SymbolEntries &symbolEntries,
const SourceLocationEntries &sourceLocations)
= 0;
- virtual void insertOrUpdateIndexingTimeStamps(const FilePathIds &filePathIds, TimeStamp indexingTimeStamp) = 0;
- virtual void insertOrUpdateIndexingTimeStamps(const FileStatuses &fileStatuses) = 0;
- virtual SourceTimeStamps fetchIndexingTimeStamps() const = 0;
- virtual SourceTimeStamps fetchIncludedIndexingTimeStamps(FilePathId sourcePathId) const = 0;
- virtual FilePathIds fetchDependentSourceIds(const FilePathIds &sourcePathIds) const = 0;
protected:
~SymbolStorageInterface() = default;