diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-06-14 11:47:51 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-06-15 10:07:57 +0000 |
commit | baa83725f640419bc2c17cd28b91e1604255a3dc (patch) | |
tree | 0c1819d1398aea3ad448e12e1b595d96a58dacab /src/libs/clangsupport | |
parent | 9e5ba5d679323540f410c1deafa9b6715ca127bd (diff) |
Remove ClangRefactoring and ClangPchManager
This removes the plugins and tools, and removes all the tests that would
fail to build because of that.
Fixes: QTCREATORBUG-25659
Change-Id: I8adb5d503fc8eea313bcaada421f309dbbfa8c26
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/libs/clangsupport')
119 files changed, 10 insertions, 10391 deletions
diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt index 93487a9f94..032284a10a 100644 --- a/src/libs/clangsupport/CMakeLists.txt +++ b/src/libs/clangsupport/CMakeLists.txt @@ -14,7 +14,6 @@ add_qtc_library(ClangSupport alivemessage.cpp alivemessage.h annotationsmessage.cpp annotationsmessage.h baseserverproxy.cpp baseserverproxy.h - cancelmessage.cpp cancelmessage.h clangcodemodelclientinterface.cpp clangcodemodelclientinterface.h clangcodemodelclientmessages.h clangcodemodelclientproxy.cpp clangcodemodelclientproxy.h @@ -22,124 +21,48 @@ add_qtc_library(ClangSupport clangcodemodelserverinterface.cpp clangcodemodelserverinterface.h clangcodemodelservermessages.h clangcodemodelserverproxy.cpp clangcodemodelserverproxy.h - clangpathwatcher.h - clangpathwatcherinterface.h - clangpathwatchernotifier.h - clangrefactoringclientmessages.h - clangrefactoringmessages.h - clangrefactoringservermessages.h clangsupport_global.h clangsupportdebugutils.cpp clangsupportdebugutils.h - clangsupportexceptions.h codecompletion.cpp codecompletion.h codecompletionchunk.cpp codecompletionchunk.h - commandlinebuilder.h - compilermacro.h completionsmessage.cpp completionsmessage.h 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 documentvisibilitychangedmessage.cpp documentvisibilitychangedmessage.h - dynamicastmatcherdiagnosticcontainer.cpp dynamicastmatcherdiagnosticcontainer.h - dynamicastmatcherdiagnosticcontextcontainer.cpp dynamicastmatcherdiagnosticcontextcontainer.h - dynamicastmatcherdiagnosticmessagecontainer.cpp dynamicastmatcherdiagnosticmessagecontainer.h - dynamicmatcherdiagnostics.h echomessage.cpp echomessage.h endmessage.cpp endmessage.h - environment.h - executeinloop.h filecontainer.cpp filecontainer.h - filecontainerv2.cpp filecontainerv2.h - filepath.cpp filepath.h - filepathcache.h - filepathcaching.cpp filepathcaching.h - filepathcachingfwd.h - filepathcachinginterface.h - filepathexceptions.h - filepathid.cpp filepathid.h - filepathstorage.h - 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 - generatedfilesinterface.h - idpaths.h - includesearchpath.h ipcclientinterface.h ipcclientprovider.h ipcinterface.h ipcserverinterface.h lineprefixer.cpp lineprefixer.h messageenvelop.cpp messageenvelop.h - modifiedtimechecker.h - modifiedtimecheckerinterface.h - nativefilepath.h - pchmanagerclientinterface.cpp pchmanagerclientinterface.h - pchmanagerclientproxy.cpp pchmanagerclientproxy.h - pchmanagerserverinterface.cpp pchmanagerserverinterface.h - pchmanagerserverproxy.cpp pchmanagerserverproxy.h - pchpaths.h - precompiledheadersupdatedmessage.cpp precompiledheadersupdatedmessage.h processcreator.cpp processcreator.h processexception.cpp processexception.h processhandle.h processstartedevent.cpp processstartedevent.h - progresscounter.h - progressmessage.h - projectmanagementserverinterface.h - projectpartartefact.cpp projectpartartefact.h - projectpartcontainer.cpp projectpartcontainer.h - projectpartid.h - projectpartpch.cpp projectpartpch.h - projectpartsstorage.h - projectpartsstorageinterface.h readmessageblock.cpp readmessageblock.h - refactoringclientinterface.cpp refactoringclientinterface.h - refactoringclientproxy.cpp refactoringclientproxy.h - refactoringdatabaseinitializer.h - refactoringserverinterface.cpp refactoringserverinterface.h - refactoringserverproxy.cpp refactoringserverproxy.h referencesmessage.cpp referencesmessage.h - removegeneratedfilesmessage.cpp removegeneratedfilesmessage.h - removeprojectpartsmessage.h requestannotationsmessage.cpp requestannotationsmessage.h requestcompletionsmessage.cpp requestcompletionsmessage.h requestfollowsymbolmessage.cpp requestfollowsymbolmessage.h requestreferencesmessage.cpp requestreferencesmessage.h - requestsourcerangesanddiagnosticsforquerymessage.cpp requestsourcerangesanddiagnosticsforquerymessage.h - requestsourcerangesforquerymessage.cpp requestsourcerangesforquerymessage.h requesttooltipmessage.cpp requesttooltipmessage.h - sourceentry.h sourcelocationcontainer.cpp sourcelocationcontainer.h - sourcelocationcontainerv2.cpp sourcelocationcontainerv2.h sourcelocationscontainer.cpp sourcelocationscontainer.h sourcerangecontainer.cpp sourcerangecontainer.h - sourcerangecontainerv2.cpp sourcerangecontainerv2.h - sourcerangesanddiagnosticsforquerymessage.cpp sourcerangesanddiagnosticsforquerymessage.h - sourcerangescontainer.cpp sourcerangescontainer.h - sourcerangesforquerymessage.cpp sourcerangesforquerymessage.h - sourcerangewithtextcontainer.cpp sourcerangewithtextcontainer.h - stringcache.h - stringcachealgorithms.h - stringcachefwd.h tokeninfocontainer.cpp tokeninfocontainer.h tooltipinfo.cpp tooltipinfo.h tooltipmessage.cpp tooltipmessage.h unsavedfilesremovedmessage.cpp unsavedfilesremovedmessage.h unsavedfilesupdatedmessage.cpp unsavedfilesupdatedmessage.h - updategeneratedfilesmessage.cpp updategeneratedfilesmessage.h - updateprojectpartsmessage.cpp updateprojectpartsmessage.h writemessageblock.cpp writemessageblock.h ) diff --git a/src/libs/clangsupport/cancelmessage.cpp b/src/libs/clangsupport/cancelmessage.cpp deleted file mode 100644 index dbca27725b..0000000000 --- a/src/libs/clangsupport/cancelmessage.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 "cancelmessage.h" - -#include <QDebug> - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const CancelMessage &) -{ - debug.nospace() << "CancelMessage()"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/cancelmessage.h b/src/libs/clangsupport/cancelmessage.h deleted file mode 100644 index c75076b16a..0000000000 --- a/src/libs/clangsupport/cancelmessage.h +++ /dev/null @@ -1,54 +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" - -namespace ClangBackEnd { - -class CancelMessage -{ -public: - friend QDataStream &operator<<(QDataStream &out, const CancelMessage &/*message*/) - { - return out; - } - - friend QDataStream &operator>>(QDataStream &in, CancelMessage &/*message*/) - { - return in; - } - - friend bool operator==(const CancelMessage &/*first*/, const CancelMessage &/*second*/) - { - return true; - } -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CancelMessage &message); - -DECLARE_MESSAGE(CancelMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangpathwatcher.h b/src/libs/clangsupport/clangpathwatcher.h deleted file mode 100644 index 27f7646271..0000000000 --- a/src/libs/clangsupport/clangpathwatcher.h +++ /dev/null @@ -1,449 +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 "clangpathwatcherinterface.h" -#include "clangpathwatchernotifier.h" -#include "directorypathcompressor.h" -#include "filepathcachinginterface.h" -#include "filesystem.h" -#include "stringcache.h" - -#include <utils/algorithm.h> - -#include <QTimer> - -namespace ClangBackEnd { - -template<class InputIt1, class InputIt2, class Callable> -void set_greedy_intersection_call( - InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Callable callable) -{ - while (first1 != last1 && first2 != last2) { - if (*first1 < *first2) { - ++first1; - } else { - if (*first2 < *first1) - ++first2; - else - callable(*first1++); - } - } -} - -class WatcherEntry -{ -public: - ProjectChunkId id; - DirectoryPathId directoryPathId; - FilePathId filePathId; - long long lastModified = -1; - - friend bool operator==(WatcherEntry first, WatcherEntry second) - { - return first.id == second.id && first.directoryPathId == second.directoryPathId - && first.filePathId == second.filePathId; - } - - friend bool operator<(WatcherEntry first, WatcherEntry second) - { - return std::tie(first.directoryPathId, first.filePathId, first.id) - < std::tie(second.directoryPathId, second.filePathId, second.id); - } - - friend bool operator<(DirectoryPathId directoryPathId, WatcherEntry entry) - { - return directoryPathId < entry.directoryPathId; - } - - friend bool operator<(WatcherEntry entry, DirectoryPathId directoryPathId) - { - return entry.directoryPathId < directoryPathId; - } - - operator FilePathId() const { return filePathId; } - - operator DirectoryPathId() const { return directoryPathId; } -}; - -using WatcherEntries = std::vector<WatcherEntry>; - -template<typename FileSystemWatcher, typename Timer> -class CLANGSUPPORT_GCCEXPORT ClangPathWatcher : public ClangPathWatcherInterface -{ -public: - ClangPathWatcher(FilePathCachingInterface &pathCache, - FileSystemInterface &fileSystem, - ClangPathWatcherNotifier *notifier = nullptr) - : m_fileStatusCache(fileSystem) - , m_fileSystem(fileSystem) - , m_pathCache(pathCache) - , m_notifier(notifier) - { - QObject::connect(&m_fileSystemWatcher, - &FileSystemWatcher::directoryChanged, - [&](const QString &path) { compressChangedDirectoryPath(path); }); - - m_directoryPathCompressor.setCallback([&](ClangBackEnd::DirectoryPathIds &&directoryPathIds) { - addChangedPathForFilePath(std::move(directoryPathIds)); - }); - } - - ~ClangPathWatcher() - { - m_directoryPathCompressor.setCallback([&](DirectoryPathIds &&) {}); - } - - void updateIdPaths(const std::vector<IdPaths> &idPaths) override - { - auto entriesAndIds = convertIdPathsToWatcherEntriesAndIds(idPaths); - - addEntries(entriesAndIds.first); - removeUnusedEntries(entriesAndIds.first, entriesAndIds.second); - } - - void removeIds(const ProjectPartIds &ids) override - { - auto removedEntries = removeIdsFromWatchedEntries(ids); - - auto filteredPaths = filterNotWatchedPaths(removedEntries); - - if (!filteredPaths.empty()) - m_fileSystemWatcher.removePaths(convertWatcherEntriesToDirectoryPathList(filteredPaths)); - } - - void setNotifier(ClangPathWatcherNotifier *notifier) override - { - m_notifier = notifier; - } - - std::size_t sizeOfIdPaths(const std::vector<IdPaths> &idPaths) - { - auto sumSize = [] (std::size_t size, const IdPaths &idPath) { - return size + idPath.filePathIds.size(); - }; - - return std::accumulate(idPaths.begin(), idPaths.end(), std::size_t(0), sumSize); - } - - std::pair<WatcherEntries, ProjectChunkIds> convertIdPathsToWatcherEntriesAndIds( - const std::vector<IdPaths> &idPaths) - { - WatcherEntries entries; - entries.reserve(sizeOfIdPaths(idPaths)); - ProjectChunkIds ids; - ids.reserve(ids.size()); - - auto outputIterator = std::back_inserter(entries); - - for (const IdPaths &idPath : idPaths) - { - ProjectChunkId id = idPath.id; - - ids.push_back(id); - - outputIterator = std::transform(idPath.filePathIds.begin(), - idPath.filePathIds.end(), - outputIterator, - [&](FilePathId filePathId) { - return WatcherEntry{ - id, - m_pathCache.directoryPathId(filePathId), - filePathId, - m_fileStatusCache.lastModifiedTime(filePathId)}; - }); - } - - std::sort(entries.begin(), entries.end()); - std::sort(ids.begin(), ids.end()); - - return {entries, ids}; - } - - void addEntries(const WatcherEntries &entries) - { - auto newEntries = notWatchedEntries(entries); - - auto filteredPaths = filterNotWatchedPaths(newEntries); - - mergeToWatchedEntries(newEntries); - - if (!filteredPaths.empty()) - m_fileSystemWatcher.addPaths(convertWatcherEntriesToDirectoryPathList(filteredPaths)); - } - - void removeUnusedEntries(const WatcherEntries &entries, const ProjectChunkIds &ids) - { - auto oldEntries = notAnymoreWatchedEntriesWithIds(entries, ids); - - removeFromWatchedEntries(oldEntries); - - auto filteredPaths = filterNotWatchedPaths(oldEntries); - - if (!filteredPaths.empty()) - m_fileSystemWatcher.removePaths(convertWatcherEntriesToDirectoryPathList(filteredPaths)); - } - - FileSystemWatcher &fileSystemWatcher() { return m_fileSystemWatcher; } - - QStringList convertWatcherEntriesToDirectoryPathList(const DirectoryPathIds &directoryPathIds) const - { - return Utils::transform<QStringList>(directoryPathIds, [&](DirectoryPathId id) { - return QString(m_pathCache.directoryPath(id)); - }); - } - - QStringList convertWatcherEntriesToDirectoryPathList(const WatcherEntries &watcherEntries) const - { - DirectoryPathIds directoryPathIds = Utils::transform<DirectoryPathIds>( - watcherEntries, [&](WatcherEntry entry) { return entry.directoryPathId; }); - - std::sort(directoryPathIds.begin(), directoryPathIds.end()); - directoryPathIds.erase(std::unique(directoryPathIds.begin(), directoryPathIds.end()), - directoryPathIds.end()); - - return convertWatcherEntriesToDirectoryPathList(directoryPathIds); - } - - WatcherEntries notWatchedEntries(const WatcherEntries &entries) const - { - WatcherEntries notWatchedEntries; - notWatchedEntries.reserve(entries.size()); - - std::set_difference(entries.begin(), - entries.end(), - m_watchedEntries.cbegin(), - m_watchedEntries.cend(), - std::back_inserter(notWatchedEntries)); - - return notWatchedEntries; - } - - DirectoryPathIds notWatchedPaths(const DirectoryPathIds &ids) const - { - DirectoryPathIds notWatchedDirectoryIds; - notWatchedDirectoryIds.reserve(ids.size()); - - std::set_difference(ids.begin(), - ids.end(), - m_watchedEntries.cbegin(), - m_watchedEntries.cend(), - std::back_inserter(notWatchedDirectoryIds)); - - return notWatchedDirectoryIds; - } - - template <typename Compare> - WatcherEntries notAnymoreWatchedEntries( - const WatcherEntries &newEntries, - Compare compare) const - { - WatcherEntries notAnymoreWatchedEntries; - notAnymoreWatchedEntries.reserve(m_watchedEntries.size()); - - std::set_difference(m_watchedEntries.cbegin(), - m_watchedEntries.cend(), - newEntries.begin(), - newEntries.end(), - std::back_inserter(notAnymoreWatchedEntries), - compare); - - return notAnymoreWatchedEntries; - } - - WatcherEntries notAnymoreWatchedEntriesWithIds(const WatcherEntries &newEntries, - const ProjectChunkIds &ids) const - { - auto oldEntries = notAnymoreWatchedEntries(newEntries, std::less<WatcherEntry>()); - - auto newEnd = std::remove_if(oldEntries.begin(), - oldEntries.end(), - [&] (WatcherEntry entry) { - return !std::binary_search(ids.begin(), ids.end(), entry.id); - }); - - oldEntries.erase(newEnd, oldEntries.end()); - - return oldEntries; - } - - void mergeToWatchedEntries(const WatcherEntries &newEntries) - { - WatcherEntries newWatchedEntries; - newWatchedEntries.reserve(m_watchedEntries.size() + newEntries.size()); - - std::merge(m_watchedEntries.cbegin(), - m_watchedEntries.cend(), - newEntries.begin(), - newEntries.end(), - std::back_inserter(newWatchedEntries)); - - m_watchedEntries = std::move(newWatchedEntries); - } - - static DirectoryPathIds uniquePaths(const WatcherEntries &pathEntries) - { - DirectoryPathIds uniqueDirectoryIds; - uniqueDirectoryIds.reserve(pathEntries.size()); - - auto compare = [](WatcherEntry first, WatcherEntry second) { - return first.directoryPathId == second.directoryPathId; - }; - - std::unique_copy(pathEntries.begin(), - pathEntries.end(), - std::back_inserter(uniqueDirectoryIds), - compare); - - return uniqueDirectoryIds; - } - - DirectoryPathIds filterNotWatchedPaths(const WatcherEntries &entries) const - { - return notWatchedPaths(uniquePaths(entries)); - } - - const WatcherEntries &watchedEntries() const - { - return m_watchedEntries; - } - - WatcherEntries removeIdsFromWatchedEntries(const ProjectPartIds &ids) - { - auto keep = [&](WatcherEntry entry) { - return !std::binary_search(ids.begin(), ids.end(), entry.id); - }; - - auto found = std::stable_partition(m_watchedEntries.begin(), m_watchedEntries.end(), keep); - - WatcherEntries removedEntries(found, m_watchedEntries.end()); - - m_watchedEntries.erase(found, m_watchedEntries.end()); - - return removedEntries; - } - - void removeFromWatchedEntries(const WatcherEntries &oldEntries) - { - WatcherEntries newWatchedEntries; - newWatchedEntries.reserve(m_watchedEntries.size() - oldEntries.size()); - - std::set_difference(m_watchedEntries.cbegin(), - m_watchedEntries.cend(), - oldEntries.begin(), - oldEntries.end(), - std::back_inserter(newWatchedEntries)); - - m_watchedEntries = std::move(newWatchedEntries); - } - - void compressChangedDirectoryPath(const QString &path) - { - m_directoryPathCompressor.addDirectoryPathId( - m_pathCache.directoryPathId(Utils::PathString{path})); - } - - WatcherEntries watchedEntriesForPaths(ClangBackEnd::DirectoryPathIds &&directoryPathIds) - { - WatcherEntries foundEntries; - foundEntries.reserve(m_watchedEntries.size()); - - set_greedy_intersection_call(m_watchedEntries.begin(), - m_watchedEntries.end(), - directoryPathIds.begin(), - directoryPathIds.end(), - [&](WatcherEntry &entry) { - m_fileStatusCache.update(entry.filePathId); - auto currentLastModified = m_fileStatusCache.lastModifiedTime( - entry.filePathId); - if (entry.lastModified < currentLastModified) { - foundEntries.push_back(entry); - entry.lastModified = currentLastModified; - } - }); - - return foundEntries; - } - - FilePathIds watchedPaths(const WatcherEntries &entries) const - { - auto filePathIds = Utils::transform<FilePathIds>(entries, &WatcherEntry::filePathId); - - std::sort(filePathIds.begin(), filePathIds.end()); - - filePathIds.erase(std::unique(filePathIds.begin(), filePathIds.end()), filePathIds.end()); - - return filePathIds; - } - - std::vector<IdPaths> idPathsForWatcherEntries(WatcherEntries &&foundEntries) - { - std::sort(foundEntries.begin(), foundEntries.end(), [](WatcherEntry first, WatcherEntry second) { - return std::tie(first.id, first.filePathId) < std::tie(second.id, second.filePathId); - }); - - std::vector<IdPaths> idPaths; - idPaths.reserve(foundEntries.size()); - - for (WatcherEntry entry : foundEntries) { - if (idPaths.empty() || idPaths.back().id != entry.id) - idPaths.emplace_back(entry.id, FilePathIds{}); - idPaths.back().filePathIds.push_back(entry.filePathId); - } - - return idPaths; - } - - void addChangedPathForFilePath(DirectoryPathIds &&directoryPathIds) - { - if (m_notifier) { - WatcherEntries foundEntries = watchedEntriesForPaths(std::move(directoryPathIds)); - - FilePathIds watchedFilePathIds = watchedPaths(foundEntries); - - std::vector<IdPaths> changedIdPaths = idPathsForWatcherEntries(std::move(foundEntries)); - - m_notifier->pathsChanged(watchedFilePathIds); - m_notifier->pathsWithIdsChanged(changedIdPaths); - } - } - - FilePathCachingInterface &pathCache() - { - return m_pathCache; - } - -private: - WatcherEntries m_watchedEntries; - FileSystemWatcher m_fileSystemWatcher; - FileStatusCache m_fileStatusCache; - FileSystemInterface &m_fileSystem; - FilePathCachingInterface &m_pathCache; - ClangPathWatcherNotifier *m_notifier; - DirectoryPathCompressor<Timer> m_directoryPathCompressor; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangpathwatcherinterface.h b/src/libs/clangsupport/clangpathwatcherinterface.h deleted file mode 100644 index 1b478fd19a..0000000000 --- a/src/libs/clangsupport/clangpathwatcherinterface.h +++ /dev/null @@ -1,52 +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 "idpaths.h" - -#include <utils/smallstringvector.h> - -namespace ClangBackEnd { - -class ClangPathWatcherNotifier; - -class ClangPathWatcherInterface -{ -public: - ClangPathWatcherInterface() = default; - ClangPathWatcherInterface(const ClangPathWatcherInterface &) = delete; - ClangPathWatcherInterface &operator=(const ClangPathWatcherInterface &) = delete; - - virtual void updateIdPaths(const std::vector<IdPaths> &idPaths) = 0; - virtual void removeIds(const ProjectPartIds &ids) = 0; - - virtual void setNotifier(ClangPathWatcherNotifier *notifier) = 0; - -protected: - ~ClangPathWatcherInterface() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangpathwatchernotifier.h b/src/libs/clangsupport/clangpathwatchernotifier.h deleted file mode 100644 index 248925ffb9..0000000000 --- a/src/libs/clangsupport/clangpathwatchernotifier.h +++ /dev/null @@ -1,50 +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 "filepathid.h" -#include "idpaths.h" - -#include <utils/smallstringvector.h> - -namespace ClangBackEnd { - -class ClangPathWatcherNotifier -{ -public: - ClangPathWatcherNotifier() = default; - ClangPathWatcherNotifier(const ClangPathWatcherNotifier &) = delete; - ClangPathWatcherNotifier &operator=(const ClangPathWatcherNotifier &) = delete; - - virtual void pathsWithIdsChanged(const std::vector<IdPaths> &idPaths) = 0; - virtual void pathsChanged(const FilePathIds &filePathIds) = 0; - -protected: - ~ClangPathWatcherNotifier() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangrefactoringclientmessages.h b/src/libs/clangsupport/clangrefactoringclientmessages.h deleted file mode 100644 index 87b61b4c6b..0000000000 --- a/src/libs/clangsupport/clangrefactoringclientmessages.h +++ /dev/null @@ -1,31 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "alivemessage.h" -#include "progressmessage.h" -#include "sourcerangesanddiagnosticsforquerymessage.h" -#include "sourcerangesforquerymessage.h" diff --git a/src/libs/clangsupport/clangrefactoringmessages.h b/src/libs/clangsupport/clangrefactoringmessages.h deleted file mode 100644 index 7f6f0de69e..0000000000 --- a/src/libs/clangsupport/clangrefactoringmessages.h +++ /dev/null @@ -1,29 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "clangrefactoringclientmessages.h" -#include "clangrefactoringservermessages.h" diff --git a/src/libs/clangsupport/clangrefactoringservermessages.h b/src/libs/clangsupport/clangrefactoringservermessages.h deleted file mode 100644 index 8a79518c7e..0000000000 --- a/src/libs/clangsupport/clangrefactoringservermessages.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "cancelmessage.h" -#include "endmessage.h" -#include "requestsourcerangesanddiagnosticsforquerymessage.h" -#include "requestsourcerangesforquerymessage.h" -#include "removegeneratedfilesmessage.h" -#include "removeprojectpartsmessage.h" -#include "updategeneratedfilesmessage.h" -#include "updateprojectpartsmessage.h" diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri index 7eaee4a42a..c53974ce0c 100644 --- a/src/libs/clangsupport/clangsupport-lib.pri +++ b/src/libs/clangsupport/clangsupport-lib.pri @@ -9,7 +9,6 @@ QT += network INCLUDEPATH += $$PWD SOURCES += \ - $$PWD/cancelmessage.cpp \ $$PWD/clangsupportdebugutils.cpp \ $$PWD/clangcodemodelclientinterface.cpp \ $$PWD/clangcodemodelclientproxy.cpp \ @@ -18,7 +17,6 @@ SOURCES += \ $$PWD/clangcodemodelserverproxy.cpp \ $$PWD/alivemessage.cpp \ $$PWD/completionsmessage.cpp \ - $$PWD/filesystem.cpp \ $$PWD/requestcompletionsmessage.cpp \ $$PWD/echomessage.cpp \ $$PWD/endmessage.cpp \ @@ -30,70 +28,34 @@ SOURCES += \ $$PWD/connectionserver.cpp \ $$PWD/diagnosticcontainer.cpp \ $$PWD/annotationsmessage.cpp \ - $$PWD/dynamicastmatcherdiagnosticcontainer.cpp \ - $$PWD/dynamicastmatcherdiagnosticcontextcontainer.cpp \ - $$PWD/dynamicastmatcherdiagnosticmessagecontainer.cpp \ $$PWD/filecontainer.cpp \ - $$PWD/filecontainerv2.cpp \ - $$PWD/filepath.cpp \ $$PWD/fixitcontainer.cpp \ $$PWD/followsymbolmessage.cpp \ $$PWD/lineprefixer.cpp \ $$PWD/messageenvelop.cpp \ - $$PWD/pchmanagerclientinterface.cpp \ - $$PWD/pchmanagerclientproxy.cpp \ - $$PWD/pchmanagerserverinterface.cpp \ - $$PWD/pchmanagerserverproxy.cpp \ - $$PWD/precompiledheadersupdatedmessage.cpp \ - $$PWD/projectpartpch.cpp \ $$PWD/readmessageblock.cpp \ - $$PWD/refactoringclientinterface.cpp \ - $$PWD/refactoringclientproxy.cpp \ - $$PWD/refactoringserverinterface.cpp \ - $$PWD/refactoringserverproxy.cpp \ $$PWD/referencesmessage.cpp \ $$PWD/unsavedfilesupdatedmessage.cpp \ $$PWD/requestannotationsmessage.cpp \ $$PWD/requestfollowsymbolmessage.cpp \ $$PWD/requestreferencesmessage.cpp \ - $$PWD/requestsourcerangesanddiagnosticsforquerymessage.cpp \ - $$PWD/requestsourcerangesforquerymessage.cpp \ $$PWD/requesttooltipmessage.cpp \ $$PWD/sourcelocationcontainer.cpp \ - $$PWD/sourcelocationcontainerv2.cpp \ $$PWD/sourcelocationscontainer.cpp \ $$PWD/sourcerangecontainer.cpp \ $$PWD/processcreator.cpp \ $$PWD/processexception.cpp \ $$PWD/processstartedevent.cpp \ - $$PWD/sourcerangecontainerv2.cpp \ - $$PWD/sourcerangesanddiagnosticsforquerymessage.cpp \ - $$PWD/sourcerangescontainer.cpp \ - $$PWD/sourcerangesforquerymessage.cpp \ - $$PWD/sourcerangewithtextcontainer.cpp \ $$PWD/tokeninfocontainer.cpp \ $$PWD/tooltipmessage.cpp \ $$PWD/tooltipinfo.cpp \ $$PWD/unsavedfilesremovedmessage.cpp \ - $$PWD/updateprojectpartsmessage.cpp \ $$PWD/documentschangedmessage.cpp \ $$PWD/documentvisibilitychangedmessage.cpp \ $$PWD/writemessageblock.cpp \ - $$PWD/filepathcaching.cpp \ - $$PWD/filepathid.cpp \ - $$PWD/baseserverproxy.cpp \ - $$PWD/updategeneratedfilesmessage.cpp \ - $$PWD/removegeneratedfilesmessage.cpp \ - $$PWD/generatedfiles.cpp \ - $$PWD/projectpartartefact.cpp \ - $$PWD/projectpartcontainer.cpp \ - $$PWD/filestatuscache.cpp + $$PWD/baseserverproxy.cpp HEADERS += \ - $$PWD/cancelmessage.h \ - $$PWD/clangpathwatcher.h \ - $$PWD/clangpathwatcherinterface.h \ - $$PWD/clangpathwatchernotifier.h \ $$PWD/clangsupportdebugutils.h \ $$PWD/clangsupport_global.h \ $$PWD/clangcodemodelclientinterface.h \ @@ -103,22 +65,8 @@ HEADERS += \ $$PWD/clangcodemodelserverinterface.h \ $$PWD/clangcodemodelservermessages.h \ $$PWD/clangcodemodelserverproxy.h \ - $$PWD/clangrefactoringclientmessages.h \ - $$PWD/clangrefactoringmessages.h \ - $$PWD/clangrefactoringservermessages.h \ $$PWD/alivemessage.h \ - $$PWD/clangsupportexceptions.h \ $$PWD/completionsmessage.h \ - $$PWD/directoryandfilepathid.h \ - $$PWD/directorypathid.h \ - $$PWD/executeinloop.h \ - $$PWD/filesystem.h \ - $$PWD/filesysteminterface.h \ - $$PWD/pchpaths.h \ - $$PWD/projectpartid.h \ - $$PWD/projectpartsstorage.h \ - $$PWD/projectpartsstorageinterface.h \ - $$PWD/projectpartstoragestructs.h \ $$PWD/requestcompletionsmessage.h \ $$PWD/echomessage.h \ $$PWD/endmessage.h \ @@ -130,99 +78,36 @@ HEADERS += \ $$PWD/connectionserver.h \ $$PWD/diagnosticcontainer.h \ $$PWD/annotationsmessage.h \ - $$PWD/dynamicastmatcherdiagnosticcontainer.h \ - $$PWD/dynamicastmatcherdiagnosticcontextcontainer.h \ - $$PWD/dynamicastmatcherdiagnosticmessagecontainer.h \ - $$PWD/dynamicmatcherdiagnostics.h \ $$PWD/filecontainer.h \ - $$PWD/filecontainerv2.h \ $$PWD/fixitcontainer.h \ $$PWD/followsymbolmessage.h \ - $$PWD/idpaths.h \ $$PWD/ipcclientinterface.h \ $$PWD/ipcinterface.h \ $$PWD/ipcserverinterface.h \ $$PWD/lineprefixer.h \ $$PWD/messageenvelop.h \ - $$PWD/pchmanagerclientinterface.h \ - $$PWD/pchmanagerclientproxy.h \ - $$PWD/pchmanagerserverinterface.h \ - $$PWD/pchmanagerserverproxy.h \ - $$PWD/precompiledheadersupdatedmessage.h \ - $$PWD/projectpartpch.h \ $$PWD/readmessageblock.h \ - $$PWD/refactoringclientinterface.h \ - $$PWD/refactoringclientproxy.h \ - $$PWD/refactoringserverinterface.h \ - $$PWD/refactoringserverproxy.h \ $$PWD/referencesmessage.h \ - $$PWD/stringcacheentry.h \ $$PWD/unsavedfilesupdatedmessage.h \ - $$PWD/removeprojectpartsmessage.h \ $$PWD/requestannotationsmessage.h \ $$PWD/requestfollowsymbolmessage.h \ $$PWD/requestreferencesmessage.h \ - $$PWD/requestsourcerangesanddiagnosticsforquerymessage.h \ - $$PWD/requestsourcerangesforquerymessage.h \ $$PWD/requesttooltipmessage.h \ $$PWD/sourcelocationcontainer.h \ - $$PWD/sourcelocationcontainerv2.h \ $$PWD/sourcelocationscontainer.h \ $$PWD/sourcerangecontainer.h \ - $$PWD/filepath.h \ $$PWD/processcreator.h \ $$PWD/processexception.h \ $$PWD/processhandle.h \ $$PWD/processstartedevent.h \ - $$PWD/sourcerangecontainerv2.h \ - $$PWD/sourcerangesanddiagnosticsforquerymessage.h \ - $$PWD/sourcerangescontainer.h \ - $$PWD/sourcerangesforquerymessage.h \ - $$PWD/sourcerangewithtextcontainer.h \ - $$PWD/stringcache.h \ $$PWD/tokeninfocontainer.h \ $$PWD/tooltipmessage.h \ $$PWD/tooltipinfo.h \ $$PWD/unsavedfilesremovedmessage.h \ - $$PWD/updateprojectpartsmessage.h \ $$PWD/documentschangedmessage.h \ $$PWD/documentvisibilitychangedmessage.h \ $$PWD/writemessageblock.h \ $$PWD/ipcclientprovider.h \ - $$PWD/requestsourcerangesforquerymessage.h \ - $$PWD/stringcachefwd.h \ - $$PWD/stringcachealgorithms.h \ - $$PWD/projectmanagementserverinterface.h \ - $$PWD/refactoringdatabaseinitializer.h \ - $$PWD/filepathcache.h \ - $$PWD/filepathid.h \ - $$PWD/filepathstorage.h \ - $$PWD/filepathstoragesqlitestatementfactory.h \ - $$PWD/filepathstoragesources.h \ - $$PWD/filepathexceptions.h \ - $$PWD/filepathcachinginterface.h \ - $$PWD/filepathcaching.h \ - $$PWD/filepathcachingfwd.h \ - $$PWD/baseserverproxy.h \ - $$PWD/filepath.h \ - $$PWD/nativefilepath.h \ - $$PWD/filepathview.h \ - $$PWD/compilermacro.h \ - $$PWD/updategeneratedfilesmessage.h \ - $$PWD/removegeneratedfilesmessage.h \ - $$PWD/generatedfiles.h \ - $$PWD/generatedfilesinterface.h \ - $$PWD/progressmessage.h \ - $$PWD/progresscounter.h \ - $$PWD/includesearchpath.h \ - $$PWD/commandlinebuilder.h \ - $$PWD/projectpartartefact.h \ - $$PWD/projectpartcontainer.h \ - $$PWD/sourceentry.h \ - $$PWD/modifiedtimecheckerinterface.h \ - $$PWD/environment.h \ - $$PWD/filestatus.h \ - $$PWD/filestatuscache.h \ - $$PWD/modifiedtimechecker.h + $$PWD/baseserverproxy.h contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h index b482c10327..f8428e8ecf 100644 --- a/src/libs/clangsupport/clangsupport_global.h +++ b/src/libs/clangsupport/clangsupport_global.h @@ -169,22 +169,6 @@ enum class MessageType : quint8 { RequestCompletionsMessage, CompletionsMessage, - - SourceLocationsForRenamingMessage, - RequestSourceLocationsForRenamingMessage, - - RequestSourceRangesAndDiagnosticsForQueryMessage, - RequestSourceRangesForQueryMessage, - SourceRangesAndDiagnosticsForQueryMessage, - SourceRangesForQueryMessage, - - CancelMessage, - UpdateProjectPartsMessage, - RemoveProjectPartsMessage, - PrecompiledHeadersUpdatedMessage, - UpdateGeneratedFilesMessage, - RemoveGeneratedFilesMessage, - ProgressMessage }; template<MessageType messageEnumeration> diff --git a/src/libs/clangsupport/clangsupportexceptions.h b/src/libs/clangsupport/clangsupportexceptions.h deleted file mode 100644 index 05e48bea50..0000000000 --- a/src/libs/clangsupport/clangsupportexceptions.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <sqliteexception.h> - -namespace ClangBackEnd { - -class ProjectPartArtefactParseError : public Sqlite::Exception -{ -public: - ProjectPartArtefactParseError(const char *whatErrorHasHappen, Utils::SmallString &&errorMessage) - : Exception(whatErrorHasHappen, std::move(errorMessage)) - {} -}; - -class ProjectPartDoesNotExists : public Sqlite::Exception -{ -public: - ProjectPartDoesNotExists(const char *whatErrorHasHappen, Utils::SmallString &&errorMessage) - : Exception(whatErrorHasHappen, std::move(errorMessage)) - {} -}; -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/commandlinebuilder.h b/src/libs/clangsupport/commandlinebuilder.h deleted file mode 100644 index 3aa3f1204f..0000000000 --- a/src/libs/clangsupport/commandlinebuilder.h +++ /dev/null @@ -1,313 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "filepath.h" -#include "nativefilepath.h" - -#include <compilermacro.h> -#include <includesearchpath.h> - -#include <utils/smallstringvector.h> -#include <utils/cpplanguage_details.h> - -#include <QCoreApplication> -#include <QDir> - -namespace ClangBackEnd { - -enum class InputFileType : unsigned char { Header, Source }; - -template<typename ProjectInfo, typename OutputContainer = Utils::SmallStringVector> -class CommandLineBuilder -{ -public: - CommandLineBuilder(const ProjectInfo &projectInfo, - const Utils::SmallStringVector &toolChainArguments = {}, - InputFileType sourceType = InputFileType::Header, - FilePathView sourcePath = {}, - FilePathView outputPath = {}, - FilePathView includePchPath = {}, - NativeFilePathView preIncludeSearchPath = {}) - { - commandLine.reserve(1024); - - addCompiler(projectInfo.language); - disableWarnings(); - addToolChainArguments(toolChainArguments); - addExtraFlags(); - addLanguage(projectInfo, sourceType); - addLanguageVersion(projectInfo); - addNoStdIncAndNoStdLibInc(projectInfo.language); - addCompilerMacros(projectInfo.compilerMacros); - addPreIncludeSearchPath(preIncludeSearchPath); - addProjectIncludeSearchPaths( - sortedIncludeSearchPaths(projectInfo.projectIncludeSearchPaths)); - addSystemAndBuiltInIncludeSearchPaths( - sortedIncludeSearchPaths(projectInfo.systemIncludeSearchPaths)); - addIncludePchPath(includePchPath); - addOutputPath(outputPath); - addSourcePath(sourcePath); - } - - void addCompiler(Utils::Language language) - { - if (language == Utils::Language::Cxx) - commandLine.emplace_back("clang++"); - else - commandLine.emplace_back("clang"); - } - - void disableWarnings() { commandLine.emplace_back("-w"); } - - void addToolChainArguments(const Utils::SmallStringVector &toolChainArguments) - { - for (Utils::SmallStringView argument : toolChainArguments) - commandLine.emplace_back(argument); - } - - void addExtraFlags() { commandLine.emplace_back("-DNOMINMAX"); } - - static const char *language(const ProjectInfo &projectInfo, InputFileType sourceType) - { - switch (projectInfo.language) { - case Utils::Language::C: - if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC) - return sourceType == InputFileType::Header ? "objective-c-header" : "objective-c"; - - return sourceType == InputFileType::Header ? "c-header" : "c"; - case Utils::Language::Cxx: - if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC) - return sourceType == InputFileType::Header ? "objective-c++-header" - : "objective-c++"; - return sourceType == InputFileType::Header ? "c++-header" : "c++"; - case Utils::Language::None: - return "none"; - } - - return "none"; - } - - void addLanguage(const ProjectInfo &projectInfo, InputFileType sourceType) - { - commandLine.emplace_back("-x"); - commandLine.emplace_back(language(projectInfo, sourceType)); - } - - const char *standardLanguageVersion(Utils::LanguageVersion languageVersion) - { - switch (languageVersion) { - case Utils::LanguageVersion::C89: - return "-std=c89"; - case Utils::LanguageVersion::C99: - return "-std=c99"; - case Utils::LanguageVersion::C11: - return "-std=c11"; - case Utils::LanguageVersion::C18: - return "-std=c17"; - case Utils::LanguageVersion::CXX98: - return "-std=c++98"; - case Utils::LanguageVersion::CXX03: - return "-std=c++03"; - case Utils::LanguageVersion::CXX11: - return "-std=c++11"; - case Utils::LanguageVersion::CXX14: - return "-std=c++14"; - case Utils::LanguageVersion::CXX17: - return "-std=c++17"; - case Utils::LanguageVersion::CXX2a: - return "-std=c++2a"; - case Utils::LanguageVersion::None: - return ""; - } - - return "-std=c++2a"; - } - - const char *gnuLanguageVersion(Utils::LanguageVersion languageVersion) - { - switch (languageVersion) { - case Utils::LanguageVersion::C89: - return "-std=gnu89"; - case Utils::LanguageVersion::C99: - return "-std=gnu99"; - case Utils::LanguageVersion::C11: - return "-std=gnu11"; - case Utils::LanguageVersion::C18: - return "-std=gnu17"; - case Utils::LanguageVersion::CXX98: - return "-std=gnu++98"; - case Utils::LanguageVersion::CXX03: - return "-std=gnu++03"; - case Utils::LanguageVersion::CXX11: - return "-std=gnu++11"; - case Utils::LanguageVersion::CXX14: - return "-std=gnu++14"; - case Utils::LanguageVersion::CXX17: - return "-std=gnu++17"; - case Utils::LanguageVersion::CXX2a: - return "-std=gnu++2a"; - case Utils::LanguageVersion::None: - return ""; - } - - return "-std=gnu++2a"; - } - - const char *includeOption(IncludeSearchPathType type) - { - switch (type) { - case IncludeSearchPathType::User: - case IncludeSearchPathType::System: - case IncludeSearchPathType::BuiltIn: - return "-isystem"; - case IncludeSearchPathType::Framework: - return "-F"; - case IncludeSearchPathType::Invalid: - return ""; - } - - return "-I"; - } - - void addLanguageVersion(const ProjectInfo &projectInfo) - { - if (projectInfo.languageExtension && Utils::LanguageExtension::Gnu) - commandLine.emplace_back(gnuLanguageVersion(projectInfo.languageVersion)); - else - commandLine.emplace_back(standardLanguageVersion(projectInfo.languageVersion)); - } - - void addCompilerMacros(const CompilerMacros &compilerMacros) - { - CompilerMacros macros = compilerMacros; - - macros.erase(std::remove_if(macros.begin(), - macros.end(), - [](const auto ¯o) { - return macro.type == CompilerMacroType::NotDefined; - }), - macros.end()); - - std::sort(macros.begin(), - macros.end(), - [](const CompilerMacro &first, const CompilerMacro &second) { - return first.index < second.index; - }); - - for (const CompilerMacro ¯o : macros) - commandLine.emplace_back(Utils::SmallString::join({"-D", macro.key, "=", macro.value})); - } - - void addPreIncludeSearchPath(NativeFilePathView preIncludeSearchPath) - { - if (!preIncludeSearchPath.empty()) { - commandLine.emplace_back("-isystem"); - commandLine.emplace_back(preIncludeSearchPath); - } - } - - IncludeSearchPaths sortedIncludeSearchPaths(const IncludeSearchPaths &unsortedPaths) - { - IncludeSearchPaths paths = unsortedPaths; - std::sort(paths.begin(), paths.end(), [](const auto &first, const auto &second) { - return first.index < second.index; - }); - - return paths; - } - - void addProjectIncludeSearchPaths(const IncludeSearchPaths &projectIncludeSearchPaths) - { - for (const IncludeSearchPath &path : projectIncludeSearchPaths) { - commandLine.emplace_back("-I"); - commandLine.emplace_back(NativeFilePath(FilePathView(path.path))); - } - } - - void addSystemAndBuiltInIncludeSearchPaths(const IncludeSearchPaths &systemIncludeSearchPaths) - { - addSystemIncludeSearchPaths(systemIncludeSearchPaths); - addBuiltInSystemSearchPaths(systemIncludeSearchPaths); - } - - void addSystemIncludeSearchPaths(const IncludeSearchPaths &systemIncludeSearchPaths) - { - for (const IncludeSearchPath &path : systemIncludeSearchPaths) { - if (path.type != IncludeSearchPathType::BuiltIn) { - commandLine.emplace_back(includeOption(path.type)); - commandLine.emplace_back(NativeFilePath(FilePathView(path.path))); - } - } - } - - void addBuiltInSystemSearchPaths(const IncludeSearchPaths &systemIncludeSearchPaths) - { - for (const IncludeSearchPath &path : systemIncludeSearchPaths) { - if (path.type == IncludeSearchPathType::BuiltIn) { - commandLine.emplace_back(includeOption(path.type)); - commandLine.emplace_back(NativeFilePath(FilePathView(path.path))); - } - } - } - - void addOutputPath(FilePathView outputPath) - { - if (!outputPath.isEmpty()) { - commandLine.emplace_back("-o"); - commandLine.emplace_back(NativeFilePath(outputPath)); - } - } - - void addSourcePath(FilePathView sourcePath) - { - if (!sourcePath.isEmpty()) - commandLine.emplace_back(NativeFilePath(sourcePath)); - } - - void addIncludePchPath(FilePathView includePchPath) - { - - if (!includePchPath.isEmpty()) { - commandLine.emplace_back("-Xclang"); - commandLine.emplace_back("-include-pch"); - commandLine.emplace_back("-Xclang"); - commandLine.emplace_back(NativeFilePath(includePchPath)); - } - } - - void addNoStdIncAndNoStdLibInc(Utils::Language language) - { - commandLine.emplace_back("-nostdinc"); - if (language == Utils::Language::Cxx) - commandLine.emplace_back("-nostdinc++"); - } - -public: - OutputContainer commandLine; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/compilermacro.h b/src/libs/clangsupport/compilermacro.h deleted file mode 100644 index 798bab2ebd..0000000000 --- a/src/libs/clangsupport/compilermacro.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <utils/smallstringio.h> - -#include <vector> - -namespace ClangBackEnd { - -enum class CompilerMacroType : unsigned char { Define, NotDefined }; - -class CompilerMacro -{ -public: - constexpr CompilerMacro() = default; - - CompilerMacro(Utils::SmallString &&key, Utils::SmallString &&value, int index) - : key(std::move(key)) - , value(std::move(value)) - , index(index) - , type(CompilerMacroType::Define) - {} - - CompilerMacro(Utils::SmallString &&key) - : key(std::move(key)) - {} - - CompilerMacro(const Utils::SmallString &key) - : key(key) - {} - - friend QDataStream &operator<<(QDataStream &out, const CompilerMacro &compilerMacro) - { - out << compilerMacro.key; - out << compilerMacro.value; - out << compilerMacro.index; - out << static_cast<unsigned char>(compilerMacro.type); - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, CompilerMacro &compilerMacro) - { - unsigned char type; - - in >> compilerMacro.key; - in >> compilerMacro.value; - in >> compilerMacro.index; - in >> type; - - compilerMacro.type = static_cast<CompilerMacroType>(type); - - return in; - } - - friend bool operator==(const CompilerMacro &first, const CompilerMacro &second) - { - return first.key == second.key && first.value == second.value && first.type == second.type; - } - - friend bool operator<(const CompilerMacro &first, const CompilerMacro &second) - { - return std::tie(first.key, first.type, first.value) - < std::tie(second.key, second.type, second.value); - } - -public: - Utils::SmallString key; - Utils::SmallString value; - int index = -1; - CompilerMacroType type = CompilerMacroType::NotDefined; -}; - -using CompilerMacros = std::vector<CompilerMacro>; -} diff --git a/src/libs/clangsupport/directoryandfilepathid.h b/src/libs/clangsupport/directoryandfilepathid.h deleted file mode 100644 index 8969372919..0000000000 --- a/src/libs/clangsupport/directoryandfilepathid.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "directorypathid.h" -#include "filepathid.h" - -#include <QDataStream> - -#include <vector> - -namespace ClangBackEnd { -class DirectoryAndFilePathId -{ -public: - constexpr DirectoryAndFilePathId() = default; - - DirectoryAndFilePathId(const char *) = delete; - - DirectoryAndFilePathId(int directoryPathId, int filePathId) - : directoryPathId(directoryPathId) - , filePathId(filePathId) - {} - - bool isValid() const { return directoryPathId.isValid() && filePathId.isValid(); } - - friend bool operator==(DirectoryAndFilePathId first, DirectoryAndFilePathId second) - { - return first.isValid() && first.directoryPathId == second.directoryPathId - && first.filePathId == second.filePathId; - } - - friend bool operator!=(DirectoryAndFilePathId first, DirectoryAndFilePathId second) - { - return !(first == second); - } - - friend bool operator<(DirectoryAndFilePathId first, DirectoryAndFilePathId second) - { - return std::tie(first.directoryPathId, first.filePathId) - < std::tie(second.directoryPathId, second.filePathId); - } - - friend QDataStream &operator<<(QDataStream &out, - const DirectoryAndFilePathId &directoryAndFilePathId) - { - out << directoryAndFilePathId.directoryPathId; - out << directoryAndFilePathId.filePathId; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DirectoryAndFilePathId &directoryAndFilePathId) - { - in >> directoryAndFilePathId.directoryPathId; - in >> directoryAndFilePathId.filePathId; - return in; - } - -public: - DirectoryPathId directoryPathId; - FilePathId filePathId; -}; - -using DirectoryAndFilePathIds = std::vector<DirectoryAndFilePathId>; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/directorypathcompressor.h b/src/libs/clangsupport/directorypathcompressor.h deleted file mode 100644 index cd02948e83..0000000000 --- a/src/libs/clangsupport/directorypathcompressor.h +++ /dev/null @@ -1,86 +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 "filepathcachinginterface.h" - -#include <QDir> -#include <QTimer> - -#include <utils/algorithm.h> - -#include <functional> - -namespace ClangBackEnd { - -template<typename Timer> -class DirectoryPathCompressor -{ -public: - DirectoryPathCompressor() { m_timer.setSingleShot(true); } - - virtual ~DirectoryPathCompressor() = default; - - void addDirectoryPathId(DirectoryPathId directoryPathIdId) - { - auto found = std::lower_bound(m_directoryPathIds.begin(), - m_directoryPathIds.end(), - directoryPathIdId); - - if (found == m_directoryPathIds.end() || *found != directoryPathIdId) - m_directoryPathIds.insert(found, directoryPathIdId); - - restartTimer(); - } - - DirectoryPathIds takeDirectoryPathIds() { return std::move(m_directoryPathIds); } - - virtual void setCallback(std::function<void(ClangBackEnd::DirectoryPathIds &&)> &&callback) - { - QObject::connect(&m_timer, &Timer::timeout, [this, callback = std::move(callback)] { - callback(takeDirectoryPathIds()); - }); - } - -unittest_public: - virtual void restartTimer() - { - m_timer.start(20); - } - - Timer &timer() - { - return m_timer; - } - -private: - DirectoryPathIds m_directoryPathIds; - Timer m_timer; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/directorypathid.h b/src/libs/clangsupport/directorypathid.h deleted file mode 100644 index 2fd0b5847e..0000000000 --- a/src/libs/clangsupport/directorypathid.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 <QDataStream> - -#include <vector> - -namespace ClangBackEnd { -class DirectoryPathId -{ -public: - constexpr DirectoryPathId() = default; - - DirectoryPathId(const char *) = delete; - - DirectoryPathId(int directoryPathId) - : directoryPathId(directoryPathId) - {} - - bool isValid() const { return directoryPathId >= 0; } - - friend bool operator==(DirectoryPathId first, DirectoryPathId second) - { - return first.isValid() && first.directoryPathId == second.directoryPathId; - } - - friend bool operator!=(DirectoryPathId first, DirectoryPathId second) - { - return !(first == second); - } - - friend bool operator<(DirectoryPathId first, DirectoryPathId second) - { - return first.directoryPathId < second.directoryPathId; - } - - friend QDataStream &operator<<(QDataStream &out, const DirectoryPathId &directoryPathId) - { - out << directoryPathId.directoryPathId; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DirectoryPathId &directoryPathId) - { - in >> directoryPathId.directoryPathId; - - return in; - } - -public: - int directoryPathId = -1; -}; - -using DirectoryPathIds = std::vector<DirectoryPathId>; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontainer.cpp b/src/libs/clangsupport/dynamicastmatcherdiagnosticcontainer.cpp deleted file mode 100644 index 7f081f1a62..0000000000 --- a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontainer.cpp +++ /dev/null @@ -1,40 +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 "dynamicastmatcherdiagnosticcontainer.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DynamicASTMatcherDiagnosticContainer &container) -{ - debug.nospace() << "DynamicASTMatcherDiagnosticContextContainer(" - << container.messages << ", " - << container.contexts - << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontainer.h b/src/libs/clangsupport/dynamicastmatcherdiagnosticcontainer.h deleted file mode 100644 index 6a02fb842f..0000000000 --- a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontainer.h +++ /dev/null @@ -1,93 +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 "dynamicastmatcherdiagnosticmessagecontainer.h" -#include "dynamicastmatcherdiagnosticcontextcontainer.h" - -namespace ClangBackEnd { - -class DynamicASTMatcherDiagnosticContainer -{ -public: - DynamicASTMatcherDiagnosticContainer() = default; - DynamicASTMatcherDiagnosticContainer(DynamicASTMatcherDiagnosticMessageContainers &&messages, - DynamicASTMatcherDiagnosticContextContainers &&contexts) - : messages(std::move(messages)), - contexts(std::move(contexts)) - { - } - - void insertMessage(V2::SourceRangeContainer &&sourceRange, - ClangQueryDiagnosticErrorType errorType, - Utils::SmallStringVector &&arguments) { - messages.emplace_back(std::move(sourceRange), errorType, std::move(arguments)); - } - - void insertContext(V2::SourceRangeContainer &&sourceRange, - ClangQueryDiagnosticContextType contextType, - Utils::SmallStringVector &&arguments) { - contexts.emplace_back(std::move(sourceRange), contextType, std::move(arguments)); - } - - friend QDataStream &operator<<(QDataStream &out, const DynamicASTMatcherDiagnosticContainer &container) - { - out << container.messages; - out << container.contexts; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DynamicASTMatcherDiagnosticContainer &container) - { - in >> container.messages; - in >> container.contexts; - - return in; - } - - friend bool operator==(const DynamicASTMatcherDiagnosticContainer &first, - const DynamicASTMatcherDiagnosticContainer &second) - { - return first.messages == second.messages - && first.contexts == second.contexts; - } - - DynamicASTMatcherDiagnosticContainer clone() const - { - return *this; - } - -public: - DynamicASTMatcherDiagnosticMessageContainers messages; - DynamicASTMatcherDiagnosticContextContainers contexts; -}; - -using DynamicASTMatcherDiagnosticContainers = std::vector<DynamicASTMatcherDiagnosticContainer>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DynamicASTMatcherDiagnosticContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontextcontainer.cpp b/src/libs/clangsupport/dynamicastmatcherdiagnosticcontextcontainer.cpp deleted file mode 100644 index eed953cdf8..0000000000 --- a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontextcontainer.cpp +++ /dev/null @@ -1,54 +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 "dynamicastmatcherdiagnosticcontextcontainer.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DynamicASTMatcherDiagnosticContextContainer &container) -{ - debug.nospace() << "DynamicASTMatcherDiagnosticContextContainer(" - << container.sourceRange << ", " - << container.contextTypeText() << ", " - << container.arguments - << ")"; - - return debug; -} - -#define RETURN_CASE(name) \ - case ClangQueryDiagnosticContextType::name: return #name; - -Utils::SmallString DynamicASTMatcherDiagnosticContextContainer::contextTypeText() const -{ - switch (contextType) { - RETURN_CASE(MatcherArg) - RETURN_CASE(MatcherConstruct) - } - - Q_UNREACHABLE(); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontextcontainer.h b/src/libs/clangsupport/dynamicastmatcherdiagnosticcontextcontainer.h deleted file mode 100644 index aa46a346c5..0000000000 --- a/src/libs/clangsupport/dynamicastmatcherdiagnosticcontextcontainer.h +++ /dev/null @@ -1,97 +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 "dynamicmatcherdiagnostics.h" -#include "sourcerangecontainerv2.h" - -#include <utils/smallstringio.h> - -namespace ClangBackEnd { - -class DynamicASTMatcherDiagnosticContextContainer -{ -public: - DynamicASTMatcherDiagnosticContextContainer() = default; - DynamicASTMatcherDiagnosticContextContainer(V2::SourceRangeContainer &&sourceRange, - ClangQueryDiagnosticContextType contextType, - Utils::SmallStringVector &&arguments) - : sourceRange(sourceRange), - contextType(contextType), - arguments(std::move(arguments)) - { - } - - CLANGSUPPORT_EXPORT Utils::SmallString contextTypeText() const; - - friend QDataStream &operator<<(QDataStream &out, const DynamicASTMatcherDiagnosticContextContainer &container) - { - out << container.sourceRange; - out << quint32(container.contextType); - out << container.arguments; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DynamicASTMatcherDiagnosticContextContainer &container) - { - quint32 contextType; - - in >> container.sourceRange; - in >> contextType; - in >> container.arguments; - - container.contextType = static_cast<ClangQueryDiagnosticContextType>(contextType); - - return in; - } - - friend bool operator==(const DynamicASTMatcherDiagnosticContextContainer &first, - const DynamicASTMatcherDiagnosticContextContainer &second) - { - return first.contextType == second.contextType - && first.sourceRange == second.sourceRange - && first.arguments == second.arguments; - } - - DynamicASTMatcherDiagnosticContextContainer clone() const - { - return DynamicASTMatcherDiagnosticContextContainer(sourceRange.clone(), - contextType, - arguments.clone()); - } - -public: - V2::SourceRangeContainer sourceRange; - ClangQueryDiagnosticContextType contextType = ClangQueryDiagnosticContextType::MatcherArg; - Utils::SmallStringVector arguments; -}; - -using DynamicASTMatcherDiagnosticContextContainers = std::vector<DynamicASTMatcherDiagnosticContextContainer>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DynamicASTMatcherDiagnosticContextContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicastmatcherdiagnosticmessagecontainer.cpp b/src/libs/clangsupport/dynamicastmatcherdiagnosticmessagecontainer.cpp deleted file mode 100644 index 70e73ca7be..0000000000 --- a/src/libs/clangsupport/dynamicastmatcherdiagnosticmessagecontainer.cpp +++ /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. -** -****************************************************************************/ - -#include "dynamicastmatcherdiagnosticmessagecontainer.h" - -#define RETURN_CASE(name) \ - case ClangQueryDiagnosticErrorType::name: return #name; - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DynamicASTMatcherDiagnosticMessageContainer &container) -{ - debug.nospace() << "DynamicASTMatcherDiagnosticMessageContainer(" - << container.errorTypeText() << ", " - << container.sourceRange << ", " - << container.arguments - << ")"; - - return debug; -} - -Utils::SmallString DynamicASTMatcherDiagnosticMessageContainer::errorTypeText() const -{ - switch (errorType) { - RETURN_CASE(None) - RETURN_CASE(RegistryMatcherNotFound) - RETURN_CASE(RegistryWrongArgCount) - RETURN_CASE(RegistryWrongArgType) - RETURN_CASE(RegistryNotBindable) - RETURN_CASE(RegistryAmbiguousOverload) - RETURN_CASE(RegistryValueNotFound) - RETURN_CASE(ParserStringError) - RETURN_CASE(ParserNoOpenParen) - RETURN_CASE(ParserNoCloseParen) - RETURN_CASE(ParserNoComma) - RETURN_CASE(ParserNoCode) - RETURN_CASE(ParserNotAMatcher) - RETURN_CASE(ParserInvalidToken) - RETURN_CASE(ParserMalformedBindExpr) - RETURN_CASE(ParserTrailingCode) - RETURN_CASE(ParserNumberError) - RETURN_CASE(ParserOverloadedType) - } - - Q_UNREACHABLE(); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicastmatcherdiagnosticmessagecontainer.h b/src/libs/clangsupport/dynamicastmatcherdiagnosticmessagecontainer.h deleted file mode 100644 index 533028ae12..0000000000 --- a/src/libs/clangsupport/dynamicastmatcherdiagnosticmessagecontainer.h +++ /dev/null @@ -1,95 +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 "dynamicmatcherdiagnostics.h" -#include "sourcerangecontainerv2.h" - -#include <utils/smallstringio.h> - -namespace ClangBackEnd { - -class DynamicASTMatcherDiagnosticMessageContainer -{ -public: - DynamicASTMatcherDiagnosticMessageContainer() = default; - DynamicASTMatcherDiagnosticMessageContainer(V2::SourceRangeContainer &&sourceRange, - ClangQueryDiagnosticErrorType errorType, - Utils::SmallStringVector &&arguments) - : sourceRange(sourceRange), - errorType(errorType), - arguments(std::move(arguments)) - { - } - - CLANGSUPPORT_EXPORT Utils::SmallString errorTypeText() const; - - friend QDataStream &operator<<(QDataStream &out, const DynamicASTMatcherDiagnosticMessageContainer &container) - { - out << container.sourceRange; - out << quint32(container.errorType); - out << container.arguments; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DynamicASTMatcherDiagnosticMessageContainer &container) - { - quint32 errorType; - - in >> container.sourceRange; - in >> errorType; - in >> container.arguments; - - container.errorType = static_cast<ClangQueryDiagnosticErrorType>(errorType); - - return in; - } - - friend bool operator==(const DynamicASTMatcherDiagnosticMessageContainer &first, - const DynamicASTMatcherDiagnosticMessageContainer &second) - { - return first.errorType == second.errorType - && first.sourceRange == second.sourceRange - && first.arguments == second.arguments; - } - - DynamicASTMatcherDiagnosticMessageContainer clone() const - { - return *this; - } - -public: - V2::SourceRangeContainer sourceRange; - ClangQueryDiagnosticErrorType errorType = ClangQueryDiagnosticErrorType::None; - Utils::SmallStringVector arguments; -}; - -using DynamicASTMatcherDiagnosticMessageContainers = std::vector<DynamicASTMatcherDiagnosticMessageContainer>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DynamicASTMatcherDiagnosticMessageContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/dynamicmatcherdiagnostics.h b/src/libs/clangsupport/dynamicmatcherdiagnostics.h deleted file mode 100644 index 7f58ad934a..0000000000 --- a/src/libs/clangsupport/dynamicmatcherdiagnostics.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 - -namespace ClangBackEnd { - -enum class ClangQueryDiagnosticContextType { - MatcherArg, - MatcherConstruct -}; - -enum class ClangQueryDiagnosticErrorType { - None, - - RegistryMatcherNotFound, - RegistryWrongArgCount, - RegistryWrongArgType, - RegistryNotBindable, - RegistryAmbiguousOverload, - RegistryValueNotFound, - - ParserStringError, - ParserNoOpenParen, - ParserNoCloseParen, - ParserNoComma, - ParserNoCode, - ParserNotAMatcher, - ParserInvalidToken, - ParserMalformedBindExpr, - ParserTrailingCode, - ParserNumberError, - ParserOverloadedType -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/environment.h b/src/libs/clangsupport/environment.h deleted file mode 100644 index ffa4d907cc..0000000000 --- a/src/libs/clangsupport/environment.h +++ /dev/null @@ -1,47 +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 <nativefilepath.h> - -namespace ClangBackEnd { - -class Environment -{ -public: - Environment() = default; - Environment(const Environment &) = delete; - Environment &operator=(const Environment &) = delete; - - virtual Utils::PathString pchBuildDirectory() const = 0; - virtual uint hardwareConcurrency() const = 0; - virtual NativeFilePathView preIncludeSearchPath() const = 0; - -protected: - ~Environment() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/executeinloop.h b/src/libs/clangsupport/executeinloop.h deleted file mode 100644 index 3642c3ccd3..0000000000 --- a/src/libs/clangsupport/executeinloop.h +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <QAbstractEventDispatcher> -#include <QCoreApplication> -#include <QThread> - -template<typename Callable> -void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) -{ - if (QThread *thread = qobject_cast<QThread *>(object)) - object = QAbstractEventDispatcher::instance(thread); - - QMetaObject::invokeMethod(object, std::forward<Callable>(callable)); -} diff --git a/src/libs/clangsupport/filecontainerv2.cpp b/src/libs/clangsupport/filecontainerv2.cpp deleted file mode 100644 index af5d89a787..0000000000 --- a/src/libs/clangsupport/filecontainerv2.cpp +++ /dev/null @@ -1,44 +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 "filecontainerv2.h" - -namespace ClangBackEnd { -namespace V2 { - -QDebug operator<<(QDebug debug, const FileContainer &container) -{ - debug.nospace() << "FileContainer(" << container.filePath << ", " - << container.commandLineArguments << ", " - << container.unsavedFileContent.hasContent() << ", " - << container.documentRevision; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace V2 -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filecontainerv2.h b/src/libs/clangsupport/filecontainerv2.h deleted file mode 100644 index e6e8c6622f..0000000000 --- a/src/libs/clangsupport/filecontainerv2.h +++ /dev/null @@ -1,102 +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 "filepathid.h" - -#include <vector> - -namespace ClangBackEnd { -namespace V2 { - -class FileContainer -{ -public: - FileContainer() = default; - - FileContainer(FilePath &&filePath, - FilePathId filePathId, - Utils::SmallString &&unsavedFileContent, - Utils::SmallStringVector &&commandLineArguments = {}, - quint32 documentRevision = 0) - : filePath(std::move(filePath)) - , filePathId(filePathId) - , unsavedFileContent(std::move(unsavedFileContent)) - , commandLineArguments(std::move(commandLineArguments)) - , documentRevision(documentRevision) - { - } - - friend QDataStream &operator<<(QDataStream &out, const FileContainer &container) - { - out << container.filePath; - out << container.commandLineArguments; - out << container.unsavedFileContent; - out << container.documentRevision; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FileContainer &container) - { - in >> container.filePath; - in >> container.commandLineArguments; - in >> container.unsavedFileContent; - in >> container.documentRevision; - - return in; - } - - friend bool operator==(const FileContainer &first, const FileContainer &second) - { - return first.filePath == second.filePath - && first.commandLineArguments == second.commandLineArguments; - } - - friend bool operator<(const FileContainer &first, const FileContainer &second) - { - return std::tie(first.filePath, first.documentRevision, first.unsavedFileContent, first.commandLineArguments) - < std::tie(second.filePath, second.documentRevision, second.unsavedFileContent, second.commandLineArguments); - } - - FileContainer clone() const { return *this; } - -public: - FilePath filePath; - FilePathId filePathId; - Utils::SmallString unsavedFileContent; - Utils::SmallStringVector commandLineArguments; - quint32 documentRevision = 0; -}; - -using FileContainers = std::vector<FileContainer>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FileContainer &container); - -} // namespace V2 -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepath.cpp b/src/libs/clangsupport/filepath.cpp deleted file mode 100644 index 0dbb1b4e26..0000000000 --- a/src/libs/clangsupport/filepath.cpp +++ /dev/null @@ -1,37 +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 "filepath.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const FilePath &filePath) -{ - debug.nospace() << filePath.directory() << "/" << filePath.name(); - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepath.h b/src/libs/clangsupport/filepath.h deleted file mode 100644 index c29c1bd22e..0000000000 --- a/src/libs/clangsupport/filepath.h +++ /dev/null @@ -1,197 +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 "filepathview.h" - -#include <utils/hostosinfo.h> -#include <utils/smallstringio.h> - -#include <QDataStream> - -namespace ClangBackEnd { - -class NativeFilePath; - -class FilePath : public Utils::PathString -{ - using size_type = Utils::PathString::size_type; - -public: - FilePath() = default; - explicit FilePath(Utils::PathString &&filePath) - : Utils::PathString(std::move(filePath)) - { - FilePathView view{*this}; - - m_slashIndex = view.slashIndex(); - } - - explicit FilePath(Utils::SmallStringView &&filePath) - : Utils::PathString(filePath) - { - FilePathView view{*this}; - - m_slashIndex = view.slashIndex(); - } - - FilePath(FilePathView filePathView) - : Utils::PathString(filePathView.toStringView()), - m_slashIndex(filePathView.slashIndex()) - { - } - - template<size_type Size> - FilePath(const char(&string)[Size]) noexcept - : FilePath(FilePathView(string, Size - 1)) - { - static_assert(Size >= 1, "Invalid string literal! Length is zero!"); - } - - explicit FilePath(const Utils::PathString &filePath) - : FilePath(filePath.clone()) - { - } - - explicit FilePath(Utils::PathString &&filePath, std::ptrdiff_t slashIndex) - : Utils::PathString(std::move(filePath)), - m_slashIndex(slashIndex) - { - } - - explicit FilePath(const QString &filePath) - : FilePath(Utils::PathString(filePath)) - { - } - - FilePath(Utils::SmallStringView directory, Utils::SmallStringView name) - : Utils::PathString(Utils::PathString::join({directory, "/", name})) - , m_slashIndex(std::ptrdiff_t(directory.size())) - {} - - bool isValid() const { return size() > 0 && m_slashIndex >= 0; } - - Utils::SmallStringView directory() const noexcept - { - return mid(0, std::size_t(std::max(std::ptrdiff_t(0), m_slashIndex))); - } - - Utils::SmallStringView name() const noexcept - { - return mid(std::size_t(m_slashIndex + 1), - std::size_t(std::ptrdiff_t(size()) - m_slashIndex - std::ptrdiff_t(1))); - } - - const Utils::PathString &path() const noexcept - { - return *this; - } - - operator FilePathView() const noexcept - { - return FilePathView(toStringView()); - } - - operator Utils::SmallStringView() const noexcept - { - return toStringView(); - } - - friend QDataStream &operator<<(QDataStream &out, const FilePath &filePath) - { - out << static_cast<const Utils::PathString&>(filePath); - out << uint(filePath.m_slashIndex); - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FilePath &filePath) - { - uint slashIndex; - - in >> static_cast<Utils::PathString&>(filePath); - in >> slashIndex; - - filePath.m_slashIndex = slashIndex; - - return in; - } - - friend bool operator==(const FilePath &first, const FilePath &second) - { - return first.slashIndex() == second.slashIndex() - && first.name() == second.name() - && first.directory() == second.directory(); - } - - friend bool operator==(const FilePath &first, const FilePathView &second) - { - return first.toStringView() == second.toStringView(); - } - - friend bool operator==(const FilePathView &first, const FilePath &second) - { - return second == first; - } - - friend bool operator<(const FilePath &first, const FilePath &second) - { - return std::make_tuple(first.slashIndex(), first.name(), first.directory()) - < std::make_tuple(second.slashIndex(), second.name(), second.directory()); - } - - FilePath clone() const - { - return *this; - } - - std::ptrdiff_t slashIndex() const - { - return m_slashIndex; - } - - template<typename String> - static FilePath fromNativeFilePath(const String &filePath) - { - Utils::PathString nativePath{filePath.data(), filePath.size()}; - - if (Utils::HostOsInfo::isWindowsHost()) - nativePath.replace('\\', '/'); - - return FilePath(std::move(nativePath)); - } - -private: - std::ptrdiff_t m_slashIndex = -1; -}; - -using FilePaths = std::vector<FilePath>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FilePath &filePath); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathcache.h b/src/libs/clangsupport/filepathcache.h deleted file mode 100644 index 541769b0b5..0000000000 --- a/src/libs/clangsupport/filepathcache.h +++ /dev/null @@ -1,206 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "directorypathid.h" -#include "filepath.h" -#include "filepathexceptions.h" -#include "filepathid.h" -#include "filepathstoragesources.h" -#include "filepathview.h" -#include "stringcache.h" - -#include <sqlitetransaction.h> - -#include <algorithm> - -namespace ClangBackEnd { - -template<typename FilePathStorage, typename Mutex = SharedMutex> -class CLANGSUPPORT_GCCEXPORT FilePathCache -{ - FilePathCache(const FilePathCache &) = default; - FilePathCache &operator=(const FilePathCache &) = default; - - template<typename Storage, typename M> - friend class FilePathCache; - -public: - using DirectoryPathCache = StringCache<Utils::PathString, - Utils::SmallStringView, - int, - Mutex, - decltype(&Utils::reverseCompare), - Utils::reverseCompare, - Sources::Directory>; - using FileNameCache = StringCache<FileNameEntry, - FileNameView, - int, - Mutex, - decltype(&FileNameView::compare), - FileNameView::compare, - Sources::Source>; - - FilePathCache(FilePathStorage &filePathStorage) - : m_filePathStorage(filePathStorage) - { - populateIfEmpty(); - } - - FilePathCache(FilePathCache &&) = default; - FilePathCache &operator=(FilePathCache &&) = default; - - void populateIfEmpty() - { - if (m_fileNameCache.isEmpty()) { - m_directoryPathCache.populate(m_filePathStorage.fetchAllDirectories()); - m_fileNameCache.populate(m_filePathStorage.fetchAllSources()); - } - } - - template<typename Cache> - Cache clone() - { - using DirectoryPathCache = typename Cache::DirectoryPathCache; - using FileNameCache = typename Cache::FileNameCache; - Cache cache{m_filePathStorage}; - cache.m_directoryPathCache = m_directoryPathCache.template clone<DirectoryPathCache>(); - cache.m_fileNameCache = m_fileNameCache.template clone<FileNameCache>(); - - return cache; - } - - FilePathId filePathId(FilePathView filePath) const - { - Utils::SmallStringView directoryPath = filePath.directory(); - - int directoryId = m_directoryPathCache.stringId( - directoryPath, [&](const Utils::SmallStringView directoryPath) { - return m_filePathStorage.fetchDirectoryId(directoryPath); - }); - - Utils::SmallStringView fileName = filePath.name(); - - int fileNameId = m_fileNameCache.stringId({fileName, directoryId}, - [&] (const FileNameView) { - return m_filePathStorage.fetchSourceId(directoryId, fileName); - }); - - return fileNameId; - } - - DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const - { - Utils::SmallStringView path = directoryPath.back() == '/' - ? directoryPath.mid(0, directoryPath.size() - 1) - : directoryPath; - - return m_directoryPathCache.stringId(path, [&](const Utils::SmallStringView directoryPath) { - return m_filePathStorage.fetchDirectoryId(directoryPath); - }); - } - - FilePath filePath(FilePathId filePathId) const - { - if (Q_UNLIKELY(!filePathId.isValid())) - throw NoFilePathForInvalidFilePathId(); - - auto fetchSoureNameAndDirectoryId = [&] (int id) { - auto entry = m_filePathStorage.fetchSourceNameAndDirectoryId(id); - return FileNameEntry{entry.sourceName, entry.directoryId}; - }; - - auto entry = m_fileNameCache.string(filePathId.filePathId, fetchSoureNameAndDirectoryId); - - auto fetchDirectoryPath = [&] (int id) { return m_filePathStorage.fetchDirectoryPath(id); }; - - Utils::PathString directoryPath = m_directoryPathCache.string(entry.directoryId, - fetchDirectoryPath); - - return FilePath{directoryPath, entry.fileName}; - } - - Utils::PathString directoryPath(DirectoryPathId directoryPathId) const - { - if (Q_UNLIKELY(!directoryPathId.isValid())) - throw NoDirectoryPathForInvalidDirectoryPathId(); - - auto fetchDirectoryPath = [&](int id) { return m_filePathStorage.fetchDirectoryPath(id); }; - - return m_directoryPathCache.string(directoryPathId.directoryPathId, fetchDirectoryPath); - } - - DirectoryPathId directoryPathId(FilePathId filePathId) const - { - if (Q_UNLIKELY(!filePathId.isValid())) - throw NoFilePathForInvalidFilePathId(); - - auto fetchSoureNameAndDirectoryId = [&](int id) { - auto entry = m_filePathStorage.fetchSourceNameAndDirectoryId(id); - return FileNameEntry{entry.sourceName, entry.directoryId}; - }; - - return m_fileNameCache.string(filePathId.filePathId, fetchSoureNameAndDirectoryId).directoryId; - } - - template<typename Container> - void addFilePaths(Container &&filePaths) - { - auto directoryPaths = Utils::transform<std::vector<Utils::SmallStringView>>( - filePaths, [](FilePathView filePath) { return filePath.directory(); }); - - std::unique_ptr<Sqlite::DeferredTransaction> transaction; - - m_directoryPathCache.addStrings(std::move(directoryPaths), [&](Utils::SmallStringView directoryPath) { - if (!transaction) - transaction = std::make_unique<Sqlite::DeferredTransaction>( - m_filePathStorage.database()); - return m_filePathStorage.fetchDirectoryIdUnguarded(directoryPath); - }); - - auto sourcePaths = Utils::transform<std::vector<FileNameView>>(filePaths, [&](FilePathView filePath) { - return FileNameView{filePath.name(), m_directoryPathCache.stringId(filePath.directory())}; - }); - - m_fileNameCache.addStrings(std::move(sourcePaths), [&](FileNameView fileNameView) { - if (!transaction) - transaction = std::make_unique<Sqlite::DeferredTransaction>( - m_filePathStorage.database()); - return m_filePathStorage.fetchSourceIdUnguarded(fileNameView.directoryId, - fileNameView.fileName); - }); - - if (transaction) - transaction->commit(); - } - -private: - mutable DirectoryPathCache m_directoryPathCache; - mutable FileNameCache m_fileNameCache; - FilePathStorage &m_filePathStorage; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathcaching.cpp b/src/libs/clangsupport/filepathcaching.cpp deleted file mode 100644 index f6d9ba9691..0000000000 --- a/src/libs/clangsupport/filepathcaching.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filepathcaching.h" - -namespace ClangBackEnd { - -FilePathId FilePathCaching::filePathId(FilePathView filePath) const -{ - return m_cache.filePathId(filePath); -} - -FilePath FilePathCaching::filePath(FilePathId filePathId) const -{ - return m_cache.filePath(filePathId); -} - -DirectoryPathId FilePathCaching::directoryPathId(Utils::SmallStringView directoryPath) const -{ - return m_cache.directoryPathId(directoryPath); -} - -Utils::PathString FilePathCaching::directoryPath(DirectoryPathId directoryPathId) const -{ - return m_cache.directoryPath(directoryPathId); -} - -DirectoryPathId FilePathCaching::directoryPathId(FilePathId filePathId) const -{ - return m_cache.directoryPathId(filePathId); -} - -void FilePathCaching::addFilePaths(const FilePaths &filePaths) -{ - m_cache.addFilePaths(filePaths); -} - -void FilePathCaching::populateIfEmpty() -{ - m_cache.populateIfEmpty(); -} - -FilePathId CopyableFilePathCaching::filePathId(FilePathView filePath) const -{ - return m_cache.filePathId(filePath); -} - -FilePath CopyableFilePathCaching::filePath(FilePathId filePathId) const -{ - return m_cache.filePath(filePathId); -} - -DirectoryPathId CopyableFilePathCaching::directoryPathId(Utils::SmallStringView directoryPath) const -{ - return m_cache.directoryPathId(directoryPath); -} - -Utils::PathString CopyableFilePathCaching::directoryPath(DirectoryPathId directoryPathId) const -{ - return m_cache.directoryPath(directoryPathId); -} - -DirectoryPathId CopyableFilePathCaching::directoryPathId(FilePathId filePathId) const -{ - return m_cache.directoryPathId(filePathId); -} - -void CopyableFilePathCaching::addFilePaths(const FilePaths &filePaths) -{ - m_cache.addFilePaths(filePaths); -} - -void CopyableFilePathCaching::populateIfEmpty() -{ - m_cache.populateIfEmpty(); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathcaching.h b/src/libs/clangsupport/filepathcaching.h deleted file mode 100644 index 7c1f343401..0000000000 --- a/src/libs/clangsupport/filepathcaching.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filepathcachinginterface.h" -#include "filepathcache.h" -#include "filepathstoragesqlitestatementfactory.h" -#include "filepathstorage.h" - -#include <sqlitedatabase.h> -#include <sqlitereadstatement.h> -#include <sqlitewritestatement.h> - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT FilePathCaching final : public FilePathCachingInterface -{ - friend class CopyableFilePathCaching; - using Factory = FilePathStorageSqliteStatementFactory<Sqlite::Database>; - using Storage = FilePathStorage<Factory>; - using Cache = FilePathCache<Storage>; - -public: - FilePathCaching(Sqlite::Database &database) - : m_factory(database) - {} - - FilePathId filePathId(FilePathView filePath) const override; - FilePath filePath(FilePathId filePathId) const override; - DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const override; - Utils::PathString directoryPath(DirectoryPathId directoryPathId) const override; - DirectoryPathId directoryPathId(FilePathId filePathId) const override; - void addFilePaths(const ClangBackEnd::FilePaths &filePaths) override; - void populateIfEmpty() override; - -private: - Factory m_factory; - Storage m_storage{m_factory}; - Cache m_cache{m_storage}; -}; - -class CLANGSUPPORT_EXPORT CopyableFilePathCaching final : public FilePathCachingInterface -{ - using Factory = FilePathStorageSqliteStatementFactory<Sqlite::Database>; - using Storage = FilePathStorage<Factory>; - using Cache = FilePathCache<Storage, NonLockingMutex>; - -public: - CopyableFilePathCaching(FilePathCaching &cache) - : m_cache(cache.m_cache.clone<Cache>()) - {} - - FilePathId filePathId(FilePathView filePath) const override; - FilePath filePath(FilePathId filePathId) const override; - DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const override; - Utils::PathString directoryPath(DirectoryPathId directoryPathId) const override; - DirectoryPathId directoryPathId(FilePathId filePathId) const override; - void addFilePaths(const ClangBackEnd::FilePaths &filePaths) override; - void populateIfEmpty() override; - -private: - Cache m_cache; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathcachingfwd.h b/src/libs/clangsupport/filepathcachingfwd.h deleted file mode 100644 index 7519dde634..0000000000 --- a/src/libs/clangsupport/filepathcachingfwd.h +++ /dev/null @@ -1,32 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 - -namespace ClangBackEnd { - -class FilePathCachingInterface; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathcachinginterface.h b/src/libs/clangsupport/filepathcachinginterface.h deleted file mode 100644 index 69be405d37..0000000000 --- a/src/libs/clangsupport/filepathcachinginterface.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "directorypathid.h" -#include "filepath.h" -#include "filepathid.h" -#include "filepathview.h" - -namespace ClangBackEnd { - -class FilePathCachingInterface -{ -public: - FilePathCachingInterface() = default; - FilePathCachingInterface(const FilePathCachingInterface &) = delete; - FilePathCachingInterface &operator=(const FilePathCachingInterface &) = delete; - - virtual FilePathId filePathId(FilePathView filePath) const = 0; - virtual FilePath filePath(FilePathId filePathId) const = 0; - virtual DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const = 0; - virtual DirectoryPathId directoryPathId(FilePathId filePathId) const = 0; - virtual Utils::PathString directoryPath(DirectoryPathId directoryPathId) const = 0; - virtual void addFilePaths(const ClangBackEnd::FilePaths &filePaths) = 0; - virtual void populateIfEmpty() = 0; - - template<typename Container> - FilePathIds filePathIds(Container &&filePaths) const - { - FilePathIds filePathIds; - filePathIds.reserve(filePaths.size()); - - std::transform(filePaths.begin(), - filePaths.end(), - std::back_inserter(filePathIds), - [&] (const auto &filePath) { return this->filePathId(filePath); }); - - std::sort(filePathIds.begin(), filePathIds.end()); - - return filePathIds; - } - - template <typename Element> - FilePathIds filePathIds(std::initializer_list<Element> filePaths) const - { - return filePathIds(std::vector<Element>(filePaths)); - } - - FilePaths filePaths(const FilePathIds &filePathIds) const - { - FilePaths filePaths; - filePaths.reserve(filePathIds.size()); - - std::transform(filePathIds.begin(), - filePathIds.end(), - std::back_inserter(filePaths), - [&] (auto filePathId) { return this->filePath(filePathId); }); - - return filePaths; - } - -protected: - ~FilePathCachingInterface() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathexceptions.h b/src/libs/clangsupport/filepathexceptions.h deleted file mode 100644 index 3174d89479..0000000000 --- a/src/libs/clangsupport/filepathexceptions.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <exception> - -namespace ClangBackEnd { - -class NoFilePathForInvalidFilePathId : std::exception -{ -public: - const char *what() const noexcept override - { - return "You cannot get a file path for an invalid file path id!"; - } -}; - -class NoDirectoryPathForInvalidDirectoryPathId : std::exception -{ -public: - const char *what() const noexcept override - { - return "You cannot get a directory path for an invalid directory path id!"; - } -}; - -class SourceNameIdDoesNotExists : std::exception -{ -public: - const char *what() const noexcept override - { - return "The source name id does not exist in the database!"; - } -}; - -class DirectoryPathIdDoesNotExists : std::exception -{ -public: - const char *what() const noexcept override - { - return "The directory path id does not exist in the database!"; - } -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathid.cpp b/src/libs/clangsupport/filepathid.cpp deleted file mode 100644 index 2491bc02d0..0000000000 --- a/src/libs/clangsupport/filepathid.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filepathid.h" - -#include <QDebug> - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const FilePathId &filePathId) -{ - debug.nospace() << "(" << filePathId.filePathId << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathid.h b/src/libs/clangsupport/filepathid.h deleted file mode 100644 index 4feb06a531..0000000000 --- a/src/libs/clangsupport/filepathid.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <QDataStream> - -#include <cstdint> -#include <tuple> -#include <vector> - -namespace ClangBackEnd { - -class FilePathId -{ -public: - constexpr FilePathId() = default; - - FilePathId(const char *) = delete; - - FilePathId(int filePathId) - : filePathId(filePathId) - {} - - bool isValid() const - { - return filePathId >= 0; - } - - friend bool operator==(FilePathId first, FilePathId second) - { - return first.isValid() && first.filePathId == second.filePathId; - } - - friend bool operator!=(FilePathId first, FilePathId second) - { - return !(first==second); - } - - friend bool operator<(FilePathId first, FilePathId second) - { - return first.filePathId < second.filePathId; - } - - friend QDataStream &operator<<(QDataStream &out, const FilePathId &filePathId) - { - out << filePathId.filePathId; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FilePathId &filePathId) - { - in >> filePathId.filePathId; - - return in; - } - -public: - int filePathId = -1; -}; - -using FilePathIds = std::vector<FilePathId>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FilePathId &filePathId); -} // namespace ClangBackEnd - -namespace std { -template<> struct hash<ClangBackEnd::FilePathId> -{ - using argument_type = ClangBackEnd::FilePathId; - using result_type = std::size_t; - result_type operator()(const argument_type& filePathId) const - { - return std::hash<int>{}(filePathId.filePathId); - } -}; - -} // namespace std diff --git a/src/libs/clangsupport/filepathstorage.h b/src/libs/clangsupport/filepathstorage.h deleted file mode 100644 index 7670c3091d..0000000000 --- a/src/libs/clangsupport/filepathstorage.h +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filepathexceptions.h" -#include "filepathid.h" -#include "filepathstoragesources.h" - -#include <sqliteexception.h> -#include <sqlitetransaction.h> - -#include <utils/optional.h> - -namespace ClangBackEnd { - -template <typename StatementFactory> -class FilePathStorage -{ - template<int ResultCount> - using ReadStatement = typename StatementFactory::template ReadStatement<ResultCount>; - using WriteStatement = typename StatementFactory::WriteStatement; - using Database = typename StatementFactory::Database; - -public: - FilePathStorage(StatementFactory &statementFactory) - : m_statementFactory(statementFactory) - {} - - int fetchDirectoryIdUnguarded(Utils::SmallStringView directoryPath) - { - Utils::optional<int> optionalDirectoryId = readDirectoryId(directoryPath); - - if (optionalDirectoryId) - return optionalDirectoryId.value(); - - return writeDirectoryId(directoryPath); - } - - int fetchDirectoryId(Utils::SmallStringView directoryPath) - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - Utils::optional<int> optionalDirectoryId = readDirectoryId(directoryPath); - - int directoryId = -1; - - if (optionalDirectoryId) - directoryId = optionalDirectoryId.value(); - else - directoryId = writeDirectoryId(directoryPath); - - transaction.commit(); - - return directoryId; - } catch (const Sqlite::StatementIsBusy &) { - return fetchDirectoryId(directoryPath); - } catch (const Sqlite::ConstraintPreventsModification &) { - return fetchDirectoryId(directoryPath); - } - } - - Utils::optional<int> readDirectoryId(Utils::SmallStringView directoryPath) - { - auto &statement = m_statementFactory.selectDirectoryIdFromDirectoriesByDirectoryPath; - - return statement.template optionalValue<int>(directoryPath); - } - - int writeDirectoryId(Utils::SmallStringView directoryPath) - { - WriteStatement &statement = m_statementFactory.insertIntoDirectories; - - statement.write(directoryPath); - - return int(m_statementFactory.database.lastInsertedRowId()); - } - - Utils::PathString fetchDirectoryPath(int directoryPathId) - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - auto &statement = m_statementFactory.selectDirectoryPathFromDirectoriesByDirectoryId; - - auto optionalDirectoryPath = statement.template optionalValue<Utils::PathString>(directoryPathId); - - if (!optionalDirectoryPath) - throw DirectoryPathIdDoesNotExists(); - - transaction.commit(); - - return optionalDirectoryPath.value(); - } catch (const Sqlite::StatementIsBusy &) { - return fetchDirectoryPath(directoryPathId); - } - } - - std::vector<Sources::Directory> fetchAllDirectories() - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - auto &statement = m_statementFactory.selectAllDirectories; - - auto directories = statement.template values<Sources::Directory>(256); - - transaction.commit(); - - return directories; - } catch (const Sqlite::StatementIsBusy &) { - return fetchAllDirectories(); - } - } - - int fetchSourceIdUnguarded(int directoryId, Utils::SmallStringView sourceName) - { - Utils::optional<int> optionalSourceId = readSourceId(directoryId, sourceName); - - if (optionalSourceId) - return optionalSourceId.value(); - - return writeSourceId(directoryId, sourceName); - } - - int fetchSourceId(int directoryId, Utils::SmallStringView sourceName) - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - int sourceId = fetchSourceIdUnguarded(directoryId, sourceName); - - transaction.commit(); - - return sourceId; - } catch (const Sqlite::StatementIsBusy &) { - return fetchSourceId(directoryId, sourceName); - } catch (const Sqlite::ConstraintPreventsModification &) { - return fetchSourceId(directoryId, sourceName); - } - } - - int writeSourceId(int directoryId, Utils::SmallStringView sourceName) - { - auto &statement = m_statementFactory.insertIntoSources; - - statement.write(directoryId, sourceName); - - return int(m_statementFactory.database.lastInsertedRowId()); - } - - Utils::optional<int> readSourceId(int directoryId, Utils::SmallStringView sourceName) - { - auto &statement = m_statementFactory.selectSourceIdFromSourcesByDirectoryIdAndSourceName; - - return statement.template optionalValue<int>(directoryId, sourceName); - } - - Sources::SourceNameAndDirectoryId fetchSourceNameAndDirectoryId(int sourceId) - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - auto &statement = m_statementFactory.selectSourceNameAndDirectoryIdFromSourcesBySourceId; - - auto optionalSourceName = statement.template optionalValue<Sources::SourceNameAndDirectoryId>( - sourceId); - - if (!optionalSourceName) - throw SourceNameIdDoesNotExists(); - - transaction.commit(); - - return *optionalSourceName; - } catch (const Sqlite::StatementIsBusy &) { - return fetchSourceNameAndDirectoryId(sourceId); - } - } - - int fetchDirectoryId(int sourceId) - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - auto &statement = m_statementFactory.selectDirectoryIdFromSourcesBySourceId; - - auto optionalDirectoryId = statement.template optionalValue<int>(sourceId); - - if (!optionalDirectoryId) - throw SourceNameIdDoesNotExists(); - - transaction.commit(); - - return *optionalDirectoryId; - } catch (const Sqlite::StatementIsBusy &) { - return fetchDirectoryId(sourceId); - } - } - - std::vector<Sources::Source> fetchAllSources() - { - try { - Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - - auto &statement = m_statementFactory.selectAllSources; - - auto sources = statement.template values<Sources::Source>(8192); - - transaction.commit(); - - return sources; - } catch (const Sqlite::StatementIsBusy &) { - return fetchAllSources(); - } - } - - Database &database() { return m_statementFactory.database; } - -private: - StatementFactory &m_statementFactory; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathstoragesources.h b/src/libs/clangsupport/filepathstoragesources.h deleted file mode 100644 index 2194e75b95..0000000000 --- a/src/libs/clangsupport/filepathstoragesources.h +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "stringcacheentry.h" - -#include <utils/smallstring.h> - -#include <cstdint> -#include <vector> -#include <tuple> -#include <unordered_map> - -namespace ClangBackEnd { - -class FileNameView -{ -public: - friend bool operator==(const FileNameView &first, const FileNameView &second) - { - return first.directoryId == second.directoryId && first.fileName == second.fileName; - } - - static int compare(FileNameView first, FileNameView second) noexcept - { - int directoryDifference = first.directoryId - second.directoryId; - - if (directoryDifference) - return directoryDifference; - - return Utils::compare(first.fileName, second.fileName); - } - -public: - Utils::SmallStringView fileName; - int directoryId; -}; - -class FileNameEntry -{ -public: - FileNameEntry(Utils::SmallStringView fileName, int directoryId) - : fileName(fileName) - , directoryId(directoryId) - {} - - FileNameEntry(FileNameView view) - : fileName(view.fileName) - , directoryId(view.directoryId) - {} - - friend bool operator==(const FileNameEntry &first, const FileNameEntry &second) - { - return first.directoryId == second.directoryId && first.fileName == second.fileName; - } - - friend bool operator!=(const FileNameEntry &first, const FileNameEntry &second) - { - return !(first == second); - } - - friend bool operator==(const FileNameEntry &first, const FileNameView &second) - { - return first.directoryId == second.directoryId && first.fileName == second.fileName; - } - - friend bool operator!=(const FileNameEntry &first, const FileNameView &second) - { - return !(first == second); - } - - operator FileNameView() const { return {fileName, directoryId}; } - - operator Utils::SmallString() && { return std::move(fileName); } - -public: - Utils::SmallString fileName; - int directoryId; -}; - -namespace Sources { -class Directory : public StringCacheEntry<Utils::PathString, Utils::SmallStringView, int> -{ - using Base = StringCacheEntry<Utils::PathString, Utils::SmallStringView, int>; - -public: - using Base::Base; - - friend bool operator==(const Directory &first, const Directory &second) - { - return first.id == second.id && first.string == second.string; - } -}; - -class Source : public StringCacheEntry<FileNameEntry, FileNameView, int> -{ - using Base = StringCacheEntry<FileNameEntry, FileNameView, int>; - -public: - using Base::Base; - Source(Utils::SmallStringView sourceName, int directoryId, int sourceId) - : Base{{sourceName, directoryId}, sourceId} - {} - - friend bool operator==(const Source &first, const Source &second) - { - return first.id == second.id && first.string == second.string; - } -}; - -class SourceNameAndDirectoryId -{ -public: - SourceNameAndDirectoryId(Utils::SmallStringView sourceName, int directoryId) - : sourceName(sourceName), directoryId(directoryId) - {} - - Utils::SmallString sourceName; - int directoryId = -1; -}; -} // namespace ClangBackEnd - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h b/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h deleted file mode 100644 index 1698fcf064..0000000000 --- a/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <sqlitetransaction.h> -#include <sqlitetable.h> - -namespace ClangBackEnd { - -template<typename DatabaseType> -class FilePathStorageSqliteStatementFactory -{ -public: - using Database = DatabaseType; - template<int ResultCount> - using ReadStatement = typename Database::template ReadStatement<ResultCount>; - using WriteStatement = typename Database::WriteStatement; - - FilePathStorageSqliteStatementFactory(Database &database) - : database(database) - { - } - -public: - Database &database; - ReadStatement<1> selectDirectoryIdFromDirectoriesByDirectoryPath{ - "SELECT directoryId FROM directories WHERE directoryPath = ?", database}; - ReadStatement<1> selectDirectoryPathFromDirectoriesByDirectoryId{ - "SELECT directoryPath FROM directories WHERE directoryId = ?", database}; - ReadStatement<2> selectAllDirectories{"SELECT directoryPath, directoryId FROM directories", - database}; - WriteStatement insertIntoDirectories{ - "INSERT INTO directories(directoryPath) VALUES (?)", - database - }; - ReadStatement<1> selectSourceIdFromSourcesByDirectoryIdAndSourceName{ - "SELECT sourceId FROM sources WHERE directoryId = ? AND sourceName = ?", database}; - ReadStatement<2> selectSourceNameAndDirectoryIdFromSourcesBySourceId{ - "SELECT sourceName, directoryId FROM sources WHERE sourceId = ?", database}; - ReadStatement<1> selectDirectoryIdFromSourcesBySourceId{ - "SELECT directoryId FROM sources WHERE sourceId = ?", database}; - WriteStatement insertIntoSources{ - "INSERT INTO sources(directoryId, sourceName) VALUES (?,?)", - database - }; - ReadStatement<3> selectAllSources{"SELECT sourceName, directoryId, sourceId FROM sources", - database}; -}; - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/filepathview.h b/src/libs/clangsupport/filepathview.h deleted file mode 100644 index 848ee3207f..0000000000 --- a/src/libs/clangsupport/filepathview.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <utils/hostosinfo.h> -#include <utils/smallstringview.h> - -#include <algorithm> -#include <vector> - -namespace ClangBackEnd { - -template <char WindowsSlash> -class AbstractFilePathView : public Utils::SmallStringView -{ -public: - constexpr AbstractFilePathView() = default; - explicit AbstractFilePathView(const char *const string, const size_type size) noexcept - : AbstractFilePathView{Utils::SmallStringView{string, size}} - { - } - - explicit AbstractFilePathView(Utils::SmallStringView filePath) - : Utils::SmallStringView(filePath) - , m_slashIndex(lastSlashIndex(filePath)) - { - } - - template <typename String, - typename = std::enable_if_t<std::is_lvalue_reference<String>::value>> - explicit AbstractFilePathView(String &&filePath) - : AbstractFilePathView(filePath.data(), filePath.size()) - { - } - - template<size_type Size> - AbstractFilePathView(const char(&string)[Size]) noexcept - : AbstractFilePathView(string, Size - 1) - { - static_assert(Size >= 1, "Invalid string literal! Length is zero!"); - } - - Utils::SmallStringView toStringView() const - { - return *this; - } - - std::ptrdiff_t slashIndex() const - { - return m_slashIndex; - } - - Utils::SmallStringView directory() const noexcept - { - return mid(0, std::size_t(std::max(std::ptrdiff_t(0), m_slashIndex))); - } - - Utils::SmallStringView name() const noexcept - { - return mid(std::size_t(m_slashIndex + 1), - std::size_t(std::ptrdiff_t(size()) - m_slashIndex - std::ptrdiff_t(1))); - } - - static - std::ptrdiff_t lastSlashIndex(Utils::SmallStringView filePath) - { - constexpr char separator = Utils::HostOsInfo::isWindowsHost() ? WindowsSlash : '/'; - auto foundReverse = std::find(filePath.rbegin(), filePath.rend(), separator); - auto found = foundReverse.base(); - - auto distance = std::distance(filePath.begin(), found); - - return distance - 1; - } - - friend bool operator==(const AbstractFilePathView &first, const AbstractFilePathView &second) - { - return first.toStringView() == second.toStringView(); - } - -private: - std::ptrdiff_t m_slashIndex = -1; -}; - -using FilePathView = AbstractFilePathView<'/'>; -using NativeFilePathView = AbstractFilePathView<'\\'>; -using FilePathViews = std::vector<FilePathView>; -using NativeFilePathViews = std::vector<NativeFilePathView>; -} diff --git a/src/libs/clangsupport/filestatus.h b/src/libs/clangsupport/filestatus.h deleted file mode 100644 index da2be4a304..0000000000 --- a/src/libs/clangsupport/filestatus.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <filepathid.h> - -#include <ctime> -#include <sys/types.h> -#include <vector> - -namespace ClangBackEnd { - -class FileStatus -{ -public: - FileStatus(FilePathId filePathId, off_t size, std::time_t lastModified) - : filePathId(filePathId), size(size), lastModified(lastModified) {} - - friend - bool operator==(const FileStatus &first, const FileStatus &second) - { - return first.filePathId == second.filePathId - && first.size == second.size - && first.lastModified == second.lastModified; - } - - friend - bool operator<(const FileStatus &first, const FileStatus &second) - { - return first.filePathId < second.filePathId; - } - -public: - FilePathId filePathId; - off_t size; - std::time_t lastModified; -}; - -using FileStatuses = std::vector<FileStatus>; -} diff --git a/src/libs/clangsupport/filestatuscache.cpp b/src/libs/clangsupport/filestatuscache.cpp deleted file mode 100644 index 3a13de79f5..0000000000 --- a/src/libs/clangsupport/filestatuscache.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filestatuscache.h" -#include "filesystem.h" - -#include <utils/algorithm.h> -#include <utils/set_algorithm.h> - -#include <QDateTime> -#include <QFileInfo> - -namespace ClangBackEnd { - -long long FileStatusCache::lastModifiedTime(FilePathId filePathId) const -{ - return findEntry(filePathId).lastModified; -} - -void FileStatusCache::update(FilePathId filePathId) -{ - auto found = std::lower_bound(m_cacheEntries.begin(), - m_cacheEntries.end(), - Internal::FileStatusCacheEntry{filePathId}, - [] (const auto &first, const auto &second) { - return first.filePathId < second.filePathId; - }); - - if (found != m_cacheEntries.end() && found->filePathId == filePathId) - found->lastModified = m_fileSystem.lastModified(filePathId); -} - -void FileStatusCache::update(FilePathIds filePathIds) -{ - std::set_intersection(m_cacheEntries.begin(), - m_cacheEntries.end(), - filePathIds.begin(), - filePathIds.end(), - Utils::make_iterator([&](auto &entry) { - entry.lastModified = m_fileSystem.lastModified(entry.filePathId); - })); -} - -FilePathIds FileStatusCache::modified(FilePathIds filePathIds) const -{ - FilePathIds modifiedFilePathIds; - modifiedFilePathIds.reserve(filePathIds.size()); - - std::set_intersection(m_cacheEntries.begin(), - m_cacheEntries.end(), - filePathIds.begin(), - filePathIds.end(), - Utils::make_iterator([&](auto &entry) { - auto newLastModified = m_fileSystem.lastModified(entry.filePathId); - if (newLastModified > entry.lastModified) { - modifiedFilePathIds.push_back(entry.filePathId); - entry.lastModified = newLastModified; - } - })); - - Internal::FileStatusCacheEntries newEntries; - newEntries.reserve(filePathIds.size()); - - std::set_difference(filePathIds.begin(), - filePathIds.end(), - m_cacheEntries.begin(), - m_cacheEntries.end(), - Utils::make_iterator([&](FilePathId newFilePathId) { - newEntries.emplace_back(newFilePathId, - m_fileSystem.lastModified(newFilePathId)); - modifiedFilePathIds.push_back(newFilePathId); - })); - - if (newEntries.size()) { - Internal::FileStatusCacheEntries mergedEntries; - mergedEntries.reserve(m_cacheEntries.size() + newEntries.size()); - - std::set_union(newEntries.begin(), - newEntries.end(), - m_cacheEntries.begin(), - m_cacheEntries.end(), - std::back_inserter(mergedEntries)); - - m_cacheEntries = std::move(mergedEntries); - } - - std::sort(modifiedFilePathIds.begin(), modifiedFilePathIds.end()); - - return modifiedFilePathIds; -} - -FileStatusCache::size_type FileStatusCache::size() const -{ - return m_cacheEntries.size(); -} - -Internal::FileStatusCacheEntry FileStatusCache::findEntry(FilePathId filePathId) const -{ - auto found = std::lower_bound(m_cacheEntries.begin(), - m_cacheEntries.end(), - Internal::FileStatusCacheEntry{filePathId}, - [] (const auto &first, const auto &second) { - return first.filePathId < second.filePathId; - }); - - if (found != m_cacheEntries.end() && found->filePathId == filePathId) - return *found; - - auto inserted = m_cacheEntries.emplace(found, filePathId, m_fileSystem.lastModified(filePathId)); - - return *inserted; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filestatuscache.h b/src/libs/clangsupport/filestatuscache.h deleted file mode 100644 index 3f0af56b3a..0000000000 --- a/src/libs/clangsupport/filestatuscache.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <filepathcachinginterface.h> - -QT_FORWARD_DECLARE_CLASS(QFileInfo) - -namespace ClangBackEnd { - -class FileSystemInterface; - -namespace Internal { -class FileStatusCacheEntry -{ -public: - FileStatusCacheEntry(ClangBackEnd::FilePathId filePathId, - long long lastModified = 0) - : filePathId(filePathId), - lastModified(lastModified) - {} - - friend bool operator<(FileStatusCacheEntry first, FileStatusCacheEntry second) - { - return first.filePathId < second.filePathId; - } - - friend bool operator<(FileStatusCacheEntry first, FilePathId second) - { - return first.filePathId < second; - } - - friend bool operator<(FilePathId first, FileStatusCacheEntry second) - { - return first < second.filePathId; - } - -public: - FilePathId filePathId; - long long lastModified; -}; - -using FileStatusCacheEntries = std::vector<FileStatusCacheEntry>; - -} - -class CLANGSUPPORT_EXPORT FileStatusCache -{ -public: - using size_type = Internal::FileStatusCacheEntries::size_type; - - FileStatusCache(FileSystemInterface &fileSystem) - : m_fileSystem(fileSystem) - {} - FileStatusCache &operator=(const FileStatusCache &) = delete; - FileStatusCache(const FileStatusCache &) = delete; - - long long lastModifiedTime(FilePathId filePathId) const; - void update(FilePathId filePathId); - void update(FilePathIds filePathIds); - FilePathIds modified(FilePathIds filePathIds) const; - - size_type size() const; - -private: - Internal::FileStatusCacheEntry findEntry(FilePathId filePathId) const; - -private: - mutable Internal::FileStatusCacheEntries m_cacheEntries; - FileSystemInterface &m_fileSystem; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filesystem.cpp b/src/libs/clangsupport/filesystem.cpp deleted file mode 100644 index e6c0ed34b7..0000000000 --- a/src/libs/clangsupport/filesystem.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "filesystem.h" -#include "filepathcachinginterface.h" - -#include <utils/algorithm.h> - -#include <QDateTime> -#include <QDir> -#include <QFileInfo> - -namespace ClangBackEnd { - -FilePathIds FileSystem::directoryEntries(const QString &directoryPath) const -{ - QDir directory{directoryPath}; - - QFileInfoList fileInfos = directory.entryInfoList(); - - FilePathIds filePathIds = Utils::transform<FilePathIds>(fileInfos, [&](const QFileInfo &fileInfo) { - return m_filePathCache.filePathId(FilePath{fileInfo.path()}); - }); - - std::sort(filePathIds.begin(), filePathIds.end()); - - return filePathIds; -} - -long long FileSystem::lastModified(FilePathId filePathId) const -{ - QFileInfo fileInfo(QString(m_filePathCache.filePath(filePathId))); - - fileInfo.refresh(); - - if (fileInfo.exists()) - return fileInfo.lastModified().toMSecsSinceEpoch() / 1000; - - return 0; -} - -void FileSystem::remove(const FilePathIds &filePathIds) -{ - for (FilePathId filePathId : filePathIds) - QFile::remove(QString{m_filePathCache.filePath(filePathId)}); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filesystem.h b/src/libs/clangsupport/filesystem.h deleted file mode 100644 index 827fdcfd0e..0000000000 --- a/src/libs/clangsupport/filesystem.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "filestatuscache.h" -#include "filesysteminterface.h" - -namespace ClangBackEnd { -class FilePathCachingInterface; - -class CLANGSUPPORT_EXPORT FileSystem final : public FileSystemInterface -{ -public: - FileSystem(FilePathCachingInterface &filePathCache) - : m_filePathCache(filePathCache) - {} - - FilePathIds directoryEntries(const QString &directoryPath) const override; - long long lastModified(FilePathId filePathId) const override; - - void remove(const FilePathIds &filePathIds) override; - -private: - FilePathCachingInterface &m_filePathCache; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filesysteminterface.h b/src/libs/clangsupport/filesysteminterface.h deleted file mode 100644 index 68be461657..0000000000 --- a/src/libs/clangsupport/filesysteminterface.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "filepathid.h" - -#include <utils/smallstringview.h> - -namespace ClangBackEnd { - -class FileSystemInterface -{ -public: - virtual FilePathIds directoryEntries(const QString &directoryPath) const = 0; - virtual long long lastModified(FilePathId filePathId) const = 0; - virtual void remove(const FilePathIds &filePathIds) = 0; - -protected: - ~FileSystemInterface() = default; -}; -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/generatedfiles.cpp b/src/libs/clangsupport/generatedfiles.cpp deleted file mode 100644 index 22b1e8044a..0000000000 --- a/src/libs/clangsupport/generatedfiles.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "generatedfiles.h" - -#include <utils/algorithm.h> - -namespace ClangBackEnd { - -void GeneratedFiles::update(V2::FileContainers &&fileContainers) -{ - V2::FileContainers unionFileContainers; - unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size()); - - auto compare = [](const V2::FileContainer &first, const V2::FileContainer &second) { - return first.filePath < second.filePath; - }; - - Utils::set_union(std::make_move_iterator(fileContainers.begin()), - std::make_move_iterator(fileContainers.end()), - std::make_move_iterator(m_fileContainers.begin()), - std::make_move_iterator(m_fileContainers.end()), - std::back_inserter(unionFileContainers), - compare); - - m_fileContainers = std::move(unionFileContainers); -} - -void GeneratedFiles::update(const V2::FileContainers &fileContainers) -{ - V2::FileContainers unionFileContainers; - unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size()); - - auto compare = [](const V2::FileContainer &first, const V2::FileContainer &second) { - return first.filePath < second.filePath; - }; - - Utils::set_union(fileContainers.begin(), - fileContainers.end(), - std::make_move_iterator(m_fileContainers.begin()), - std::make_move_iterator(m_fileContainers.end()), - std::back_inserter(unionFileContainers), - compare); - - m_fileContainers = std::move(unionFileContainers); -} - -class Compare { -public: - bool operator()(const FilePath &first, const FilePath &second) { return first < second; } - bool operator()(const V2::FileContainer &first, const V2::FileContainer &second) - { - return first.filePath < second.filePath; - } - bool operator()(const V2::FileContainer &first, const FilePath &second) - { - return first.filePath < second; - } - bool operator()(const FilePath &first, const V2::FileContainer &second) - { - return first < second.filePath; - } -}; - -void GeneratedFiles::remove(const FilePaths &filePaths) -{ - V2::FileContainers differenceFileContainers; - differenceFileContainers.reserve(m_fileContainers.size()); - - std::set_difference(std::make_move_iterator(m_fileContainers.begin()), - std::make_move_iterator(m_fileContainers.end()), - filePaths.begin(), - filePaths.end(), - std::back_inserter(differenceFileContainers), - Compare{}); - - m_fileContainers = std::move(differenceFileContainers); -} - -bool GeneratedFiles::isValid() const -{ - return std::all_of(m_fileContainers.begin(), - m_fileContainers.end(), - [](const V2::FileContainer &container) { - return container.unsavedFileContent.hasContent(); - }); -} - -const V2::FileContainers &GeneratedFiles::fileContainers() const -{ - return m_fileContainers; -} - -FilePathIds GeneratedFiles::filePathIds() const -{ - auto ids = Utils::transform<FilePathIds>(m_fileContainers, - [](const V2::FileContainer &fileContainer) { - return fileContainer.filePathId; - }); - - std::sort(ids.begin(), ids.end()); - - return ids; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/generatedfiles.h b/src/libs/clangsupport/generatedfiles.h deleted file mode 100644 index 3e87048be9..0000000000 --- a/src/libs/clangsupport/generatedfiles.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "generatedfilesinterface.h" - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT GeneratedFiles final : public GeneratedFilesInterface -{ -public: - void update(V2::FileContainers &&fileContainers); - void update(const V2::FileContainers &fileContainers); - void remove(const FilePaths &filePaths); - bool isValid() const; - - const V2::FileContainers &fileContainers() const; - FilePathIds filePathIds() const; - -private: - V2::FileContainers m_fileContainers; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/generatedfilesinterface.h b/src/libs/clangsupport/generatedfilesinterface.h deleted file mode 100644 index 72a1dfccfb..0000000000 --- a/src/libs/clangsupport/generatedfilesinterface.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <filecontainerv2.h> - -namespace ClangBackEnd { - -class GeneratedFilesInterface -{ -public: - virtual void update(V2::FileContainers &&fileContainers) = 0; - virtual void update(const V2::FileContainers &fileContainers) = 0; - virtual void remove(const FilePaths &filePaths) = 0; - virtual bool isValid() const = 0; - - virtual const V2::FileContainers &fileContainers() const = 0; - virtual FilePathIds filePathIds() const = 0; - -protected: - ~GeneratedFilesInterface() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/idpaths.h b/src/libs/clangsupport/idpaths.h deleted file mode 100644 index 8410bbbbd5..0000000000 --- a/src/libs/clangsupport/idpaths.h +++ /dev/null @@ -1,94 +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 "filepathid.h" -#include "projectpartid.h" -#include "sourceentry.h" - -namespace ClangBackEnd { - -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: - IdPaths(ProjectPartId projectPartId, SourceType sourceType, FilePathIds &&filePathIds) - : id{projectPartId, sourceType} - , filePathIds(std::move(filePathIds)) - {} - IdPaths(ProjectChunkId projectChunkId, FilePathIds &&filePathIds) - : id(projectChunkId) - , filePathIds(std::move(filePathIds)) - {} - - friend bool operator==(IdPaths first, IdPaths second) - { - return first.id == second.id && first.filePathIds == second.filePathIds; - } - -public: - ProjectChunkId id; - FilePathIds filePathIds; -}; - -using ProjectChunkIds = std::vector<ProjectChunkId>; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/includesearchpath.h b/src/libs/clangsupport/includesearchpath.h deleted file mode 100644 index 239af9c1a4..0000000000 --- a/src/libs/clangsupport/includesearchpath.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <utils/smallstringio.h> - -#include <QDataStream> - -#include <vector> - -namespace ClangBackEnd { - -enum class IncludeSearchPathType : unsigned char { - Invalid, - User, - BuiltIn, - System, - Framework, -}; - -class IncludeSearchPath -{ -public: - IncludeSearchPath() = default; - IncludeSearchPath(Utils::PathString &&path, int index, IncludeSearchPathType type) - : path(std::move(path)) - , index(index) - , type(type) - {} - - IncludeSearchPath(Utils::PathString &&path, int index, int type) - : path(std::move(path)) - , index(index) - , type(static_cast<IncludeSearchPathType>(type)) - {} - - friend QDataStream &operator<<(QDataStream &out, const IncludeSearchPath &includeSearchPath) - { - out << includeSearchPath.path; - out << includeSearchPath.index; - out << static_cast<unsigned char>(includeSearchPath.type); - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, IncludeSearchPath &includeSearchPath) - { - unsigned char type; - - in >> includeSearchPath.path; - in >> includeSearchPath.index; - in >> type; - - includeSearchPath.type = static_cast<IncludeSearchPathType>(type); - - return in; - } - - friend bool operator==(const IncludeSearchPath &first, const IncludeSearchPath &second) - { - return std::tie(first.type, first.index, first.path) - == std::tie(second.type, second.index, second.path); - } - - friend bool operator<(const IncludeSearchPath &first, const IncludeSearchPath &second) - { - return std::tie(first.path, first.index, first.type) - < std::tie(second.path, second.index, second.type); - } - -public: - Utils::PathString path; - int index = -1; - IncludeSearchPathType type = IncludeSearchPathType::Invalid; -}; - -using IncludeSearchPaths = std::vector<IncludeSearchPath>; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/modifiedtimechecker.h b/src/libs/clangsupport/modifiedtimechecker.h deleted file mode 100644 index 9d6b56d9e3..0000000000 --- a/src/libs/clangsupport/modifiedtimechecker.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "filesysteminterface.h" -#include "modifiedtimecheckerinterface.h" - -#include <utils/set_algorithm.h> - -#include <algorithm> -#include <iterator> - -namespace ClangBackEnd { - -template<typename SourceEntries = ::ClangBackEnd::SourceEntries> -class ModifiedTimeChecker final : public ModifiedTimeCheckerInterface<SourceEntries> -{ - using SourceEntry = typename SourceEntries::value_type; - -public: - ModifiedTimeChecker(FileSystemInterface &fileSystem) - : m_fileSystem(fileSystem) - {} - - bool isUpToDate(const SourceEntries &sourceEntries) const override - { - if (sourceEntries.empty()) - return false; - - updateCurrentSourceTimeStamps(sourceEntries); - - return compareEntries(sourceEntries); - } - - void pathsChanged(const FilePathIds &filePathIds) override - { - std::set_intersection(m_currentSourceTimeStamps.begin(), - m_currentSourceTimeStamps.end(), - filePathIds.begin(), - filePathIds.end(), - Utils::make_iterator([&](SourceTimeStamp &sourceTimeStamp) { - sourceTimeStamp.timeStamp = m_fileSystem.lastModified( - sourceTimeStamp.sourceId); - })); - } - -private: - bool compareEntries(const SourceEntries &sourceEntries) const - { - return !Utils::set_intersection_compare( - m_currentSourceTimeStamps.begin(), - m_currentSourceTimeStamps.end(), - sourceEntries.begin(), - sourceEntries.end(), - [](auto first, auto second) { return first.timeStamp > second.timeStamp; }, - [](auto first, auto second) { return first.sourceId < second.sourceId; }); - } - - void updateCurrentSourceTimeStamps(const SourceEntries &sourceEntries) const - { - SourceTimeStamps sourceTimeStamps = newSourceTimeStamps(sourceEntries); - - auto split = sourceTimeStamps.insert(sourceTimeStamps.end(), - m_currentSourceTimeStamps.begin(), - m_currentSourceTimeStamps.end()); - std::inplace_merge(sourceTimeStamps.begin(), split, sourceTimeStamps.end()); - - m_currentSourceTimeStamps = std::move(sourceTimeStamps); - } - - SourceTimeStamps newSourceTimeStamps(const SourceEntries &sourceEntries) const - { - SourceTimeStamps newTimeStamps; - newTimeStamps.reserve(sourceEntries.size()); - - std::set_difference(sourceEntries.begin(), - sourceEntries.end(), - m_currentSourceTimeStamps.begin(), - m_currentSourceTimeStamps.end(), - Utils::make_iterator([&](const SourceEntry &sourceEntry) { - newTimeStamps.emplace_back(sourceEntry.sourceId, - m_fileSystem.lastModified( - sourceEntry.sourceId)); - }), - [](auto first, auto second) { - return first.sourceId < second.sourceId; - }); - - return newTimeStamps; - } - -private: - mutable SourceTimeStamps m_currentSourceTimeStamps; - FileSystemInterface &m_fileSystem; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/modifiedtimecheckerinterface.h b/src/libs/clangsupport/modifiedtimecheckerinterface.h deleted file mode 100644 index b48c38869e..0000000000 --- a/src/libs/clangsupport/modifiedtimecheckerinterface.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "sourceentry.h" - -namespace ClangBackEnd { - -template<typename SourceEntries = ::ClangBackEnd::SourceEntries> -class ModifiedTimeCheckerInterface -{ -public: - ModifiedTimeCheckerInterface() = default; - ModifiedTimeCheckerInterface(const ModifiedTimeCheckerInterface &) = delete; - ModifiedTimeCheckerInterface &operator=(const ModifiedTimeCheckerInterface &) = delete; - - virtual bool isUpToDate(const SourceEntries &sourceEntries) const = 0; - virtual void pathsChanged(const FilePathIds &filePathIds) = 0; - -protected: - ~ModifiedTimeCheckerInterface() = default; -}; - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/nativefilepath.h b/src/libs/clangsupport/nativefilepath.h deleted file mode 100644 index 66e3e16d65..0000000000 --- a/src/libs/clangsupport/nativefilepath.h +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filepathview.h" - -#include <utils/hostosinfo.h> -#include <utils/smallstringio.h> - -namespace ClangBackEnd { - -class FilePath; - -class NativeFilePath -{ - using size_type = Utils::PathString::size_type; - -public: - NativeFilePath() = default; - explicit NativeFilePath(Utils::PathString &&filePath) - : m_path(std::move(filePath)) - { - NativeFilePathView view{m_path}; - - m_slashIndex = view.slashIndex(); - } - - NativeFilePath(NativeFilePathView filePathView) - : m_path(filePathView.toStringView()), - m_slashIndex(filePathView.slashIndex()) - {} - - explicit NativeFilePath(FilePathView filePathView) { *this = fromFilePath(filePathView); } - - explicit NativeFilePath(const FilePath &filePath) - : NativeFilePath{FilePathView{filePath}} - {} - - template<size_type Size> - NativeFilePath(const char(&string)[Size]) noexcept - : NativeFilePath(NativeFilePathView(string, Size - 1)) - { - static_assert(Size >= 1, "Invalid string literal! Length is zero!"); - } - - explicit NativeFilePath(const Utils::PathString &filePath) - : NativeFilePath(filePath.clone()) - { - } - - explicit NativeFilePath(Utils::PathString &&filePath, std::ptrdiff_t slashIndex) - : m_path(std::move(filePath)), - m_slashIndex(slashIndex) - { - } - - explicit NativeFilePath(const QString &filePath) - : NativeFilePath(Utils::PathString(filePath)) - { - } - - NativeFilePath(Utils::SmallStringView directory, Utils::SmallStringView name) - : m_path(Utils::PathString::join( - {directory, Utils::HostOsInfo::isWindowsHost() ? "\\" : "/", name})) - , m_slashIndex(directory.size()) - {} - - Utils::SmallStringView directory() const noexcept - { - return m_path.mid(0, std::size_t(std::max(std::ptrdiff_t(0), m_slashIndex))); } - - Utils::SmallStringView name() const noexcept - { - return m_path.mid(std::size_t(m_slashIndex + 1), - std::size_t(std::ptrdiff_t(m_path.size()) - m_slashIndex - std::ptrdiff_t(1))); - } - - bool empty() const - { - return m_path.empty(); - } - - const Utils::PathString &path() const noexcept - { - return m_path; - } - - operator const Utils::PathString&() const noexcept - { - return m_path; - } - - operator NativeFilePathView() const noexcept - { - return NativeFilePathView(Utils::SmallStringView(m_path)); - } - - friend QDataStream &operator<<(QDataStream &out, const NativeFilePath &filePath) - { - out << filePath.m_path; - out << uint(filePath.m_slashIndex); - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, NativeFilePath &filePath) - { - uint slashIndex; - - in >> filePath.m_path; - in >> slashIndex; - - filePath.m_slashIndex = slashIndex; - - return in; - } - - friend bool operator==(const NativeFilePath &first, const NativeFilePath &second) - { - return first.m_path == second.m_path; - } - - friend bool operator==(const NativeFilePath &first, const NativeFilePathView &second) - { - return first.path() == second.toStringView(); - } - - friend bool operator==(const NativeFilePathView &first, const NativeFilePath &second) - { - return second == first; - } - - friend bool operator<(const NativeFilePath &first, const NativeFilePath &second) - { - return first.m_path < second.m_path; - } - - NativeFilePath clone() const - { - return *this; - } - - std::ptrdiff_t slashIndex() const - { - return m_slashIndex; - } - - template<typename String> - static NativeFilePath fromFilePath(String filePath) - { - Utils::PathString nativePath{filePath.data(), size_type(filePath.size())}; - - if (Utils::HostOsInfo::isWindowsHost()) - nativePath.replace('/', '\\'); - - return NativeFilePath(std::move(nativePath)); - } - -private: - Utils::PathString m_path; - std::ptrdiff_t m_slashIndex = -1; -}; - -using NativeFilePaths = std::vector<NativeFilePath>; -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/pchmanagerclientinterface.cpp b/src/libs/clangsupport/pchmanagerclientinterface.cpp deleted file mode 100644 index 1f8d1dba18..0000000000 --- a/src/libs/clangsupport/pchmanagerclientinterface.cpp +++ /dev/null @@ -1,53 +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 "pchmanagerclientinterface.h" -#include "messageenvelop.h" - -#include <precompiledheadersupdatedmessage.h> -#include <progressmessage.h> - -#include <QDebug> - -namespace ClangBackEnd { - -void PchManagerClientInterface::dispatch(const MessageEnvelop &messageEnvelop) -{ - switch (messageEnvelop.messageType()) { - case MessageType::AliveMessage: - alive(); - break; - case MessageType::PrecompiledHeadersUpdatedMessage: - precompiledHeadersUpdated(messageEnvelop.message<PrecompiledHeadersUpdatedMessage>()); - break; - case MessageType::ProgressMessage: - progress(messageEnvelop.message<ProgressMessage>()); - break; - default: - qWarning() << "Unknown IpcClientMessage"; - } -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerclientinterface.h b/src/libs/clangsupport/pchmanagerclientinterface.h deleted file mode 100644 index c0aa183d8b..0000000000 --- a/src/libs/clangsupport/pchmanagerclientinterface.h +++ /dev/null @@ -1,45 +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 "ipcclientinterface.h" - -namespace ClangBackEnd { - -class PrecompiledHeadersUpdatedMessage; -class ProgressMessage; - -class CLANGSUPPORT_EXPORT PchManagerClientInterface : public IpcClientInterface -{ -public: - void dispatch(const MessageEnvelop &messageEnvelop) override; - - virtual void alive() = 0; - virtual void precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) = 0; - virtual void progress(ProgressMessage &&message) = 0; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerclientproxy.cpp b/src/libs/clangsupport/pchmanagerclientproxy.cpp deleted file mode 100644 index a18ac166d2..0000000000 --- a/src/libs/clangsupport/pchmanagerclientproxy.cpp +++ /dev/null @@ -1,81 +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 "pchmanagerclientproxy.h" - -#include "alivemessage.h" -#include "messageenvelop.h" -#include "pchmanagerserverinterface.h" -#include "precompiledheadersupdatedmessage.h" -#include "progressmessage.h" - -#include <QDebug> -#include <QLocalSocket> - -namespace ClangBackEnd { - -PchManagerClientProxy::PchManagerClientProxy(PchManagerServerInterface *server, - QLocalSocket *localSocket) - : writeMessageBlock(localSocket) - , readMessageBlock(localSocket) - , server(server) -{ - QObject::connect(localSocket, &QIODevice::readyRead, [this]() { - PchManagerClientProxy::readMessages(); - }); -} - -PchManagerClientProxy::PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice) - : writeMessageBlock(ioDevice) - , readMessageBlock(ioDevice) - , server(server) -{ - QObject::connect(ioDevice, &QIODevice::readyRead, [this]() { - PchManagerClientProxy::readMessages(); - }); -} - -void PchManagerClientProxy::readMessages() -{ - for (const MessageEnvelop &message : readMessageBlock.readAll()) - server->dispatch(message); -} - -void PchManagerClientProxy::alive() -{ - writeMessageBlock.write(AliveMessage()); -} - -void PchManagerClientProxy::precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) -{ - writeMessageBlock.write(message); -} - -void PchManagerClientProxy::progress(ProgressMessage &&message) -{ - writeMessageBlock.write(message); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerclientproxy.h b/src/libs/clangsupport/pchmanagerclientproxy.h deleted file mode 100644 index 6dec4ecfca..0000000000 --- a/src/libs/clangsupport/pchmanagerclientproxy.h +++ /dev/null @@ -1,57 +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 "pchmanagerclientinterface.h" -#include "readmessageblock.h" -#include "writemessageblock.h" - -namespace ClangBackEnd { - -class PchManagerServerInterface; - -class CLANGSUPPORT_EXPORT PchManagerClientProxy final : public PchManagerClientInterface -{ -public: - explicit PchManagerClientProxy(PchManagerServerInterface *server, QLocalSocket *localSocket); - explicit PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice); - PchManagerClientProxy(const PchManagerClientProxy&) = delete; - const PchManagerClientProxy &operator=(const PchManagerClientProxy&) = delete; - - void readMessages(); - - void alive() override; - void precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) override; - void progress(ProgressMessage &&message) override; - -private: - ClangBackEnd::WriteMessageBlock writeMessageBlock; - ClangBackEnd::ReadMessageBlock readMessageBlock; - PchManagerServerInterface *server = nullptr; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerserverinterface.cpp b/src/libs/clangsupport/pchmanagerserverinterface.cpp deleted file mode 100644 index 256aa228ac..0000000000 --- a/src/libs/clangsupport/pchmanagerserverinterface.cpp +++ /dev/null @@ -1,61 +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 "pchmanagerserverinterface.h" - -#include "messageenvelop.h" -#include "removegeneratedfilesmessage.h" -#include "removeprojectpartsmessage.h" -#include "updategeneratedfilesmessage.h" -#include "updateprojectpartsmessage.h" - -#include <QDebug> - -namespace ClangBackEnd { - -void PchManagerServerInterface::dispatch(const MessageEnvelop &messageEnvelop) -{ - switch (messageEnvelop.messageType()) { - case MessageType::EndMessage: - end(); - break; - case MessageType::UpdateProjectPartsMessage: - updateProjectParts(messageEnvelop.message<UpdateProjectPartsMessage>()); - break; - case MessageType::RemoveProjectPartsMessage: - removeProjectParts(messageEnvelop.message<RemoveProjectPartsMessage>()); - break; - case MessageType::UpdateGeneratedFilesMessage: - updateGeneratedFiles(messageEnvelop.message<UpdateGeneratedFilesMessage>()); - break; - case MessageType::RemoveGeneratedFilesMessage: - removeGeneratedFiles(messageEnvelop.message<RemoveGeneratedFilesMessage>()); - break; - default: - qWarning() << "Unknown IpcClientMessage"; - } -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerserverinterface.h b/src/libs/clangsupport/pchmanagerserverinterface.h deleted file mode 100644 index fe473770e8..0000000000 --- a/src/libs/clangsupport/pchmanagerserverinterface.h +++ /dev/null @@ -1,44 +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 "projectmanagementserverinterface.h" - -#include <memory> - -namespace ClangBackEnd { - -class PchManagerClientInterface; - -class CLANGSUPPORT_EXPORT PchManagerServerInterface : public ProjectManagementServerInterface -{ -public: - void dispatch(const MessageEnvelop &messageEnvelop) override; - - virtual void end() = 0; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerserverproxy.cpp b/src/libs/clangsupport/pchmanagerserverproxy.cpp deleted file mode 100644 index 5f1fb03948..0000000000 --- a/src/libs/clangsupport/pchmanagerserverproxy.cpp +++ /dev/null @@ -1,76 +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 "pchmanagerserverproxy.h" - -#include "endmessage.h" -#include "messageenvelop.h" -#include "pchmanagerclientinterface.h" -#include "removegeneratedfilesmessage.h" -#include "removeprojectpartsmessage.h" -#include "updategeneratedfilesmessage.h" -#include "updateprojectpartsmessage.h" - -#include <QIODevice> -#include <QVector> - -namespace ClangBackEnd { - -PchManagerServerProxy::PchManagerServerProxy(PchManagerClientInterface *client, - QLocalSocket *localSocket) - : BaseServerProxy(client, localSocket) -{} - -PchManagerServerProxy::PchManagerServerProxy(PchManagerClientInterface *client, QIODevice *ioDevice) - : BaseServerProxy(client, ioDevice) -{ -} - -void PchManagerServerProxy::end() -{ - m_writeMessageBlock.write(EndMessage()); -} - -void PchManagerServerProxy::updateProjectParts(UpdateProjectPartsMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void PchManagerServerProxy::removeProjectParts(RemoveProjectPartsMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void PchManagerServerProxy::updateGeneratedFiles(UpdateGeneratedFilesMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void PchManagerServerProxy::removeGeneratedFiles(RemoveGeneratedFilesMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchmanagerserverproxy.h b/src/libs/clangsupport/pchmanagerserverproxy.h deleted file mode 100644 index d13d88ee8e..0000000000 --- a/src/libs/clangsupport/pchmanagerserverproxy.h +++ /dev/null @@ -1,60 +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 "baseserverproxy.h" -#include "clangsupport_global.h" -#include "pchmanagerserverinterface.h" -#include "readmessageblock.h" -#include "writemessageblock.h" - -#include <QtGlobal> - -#include <memory> - -QT_BEGIN_NAMESPACE -class QIODevice; -QT_END_NAMESPACE - -namespace ClangBackEnd { - -class PchManagerClientInterface; - -class CLANGSUPPORT_EXPORT PchManagerServerProxy final : public BaseServerProxy, - public PchManagerServerInterface -{ -public: - explicit PchManagerServerProxy(PchManagerClientInterface *client, QLocalSocket *localSocket); - explicit PchManagerServerProxy(PchManagerClientInterface *client, QIODevice *ioDevice); - - void end() override; - void updateProjectParts(UpdateProjectPartsMessage &&message) override; - void removeProjectParts(RemoveProjectPartsMessage &&message) override; - void updateGeneratedFiles(UpdateGeneratedFilesMessage &&message) override; - void removeGeneratedFiles(RemoveGeneratedFilesMessage &&message) override; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/pchpaths.h b/src/libs/clangsupport/pchpaths.h deleted file mode 100644 index 048ec9da8d..0000000000 --- a/src/libs/clangsupport/pchpaths.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "filepath.h" - -namespace ClangBackEnd { - -class PchPaths -{ -public: - PchPaths() = default; - PchPaths(Utils::SmallStringView projectPchPath, Utils::SmallStringView systemPchPath) - : projectPchPath(FilePathView{projectPchPath}) - , systemPchPath(FilePathView{systemPchPath}) - {} - - friend bool operator==(const PchPaths &first, const PchPaths &second) - { - return first.projectPchPath == second.projectPchPath - && first.systemPchPath == second.systemPchPath; - } - -public: - FilePath projectPchPath; - FilePath systemPchPath; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/precompiledheadersupdatedmessage.cpp b/src/libs/clangsupport/precompiledheadersupdatedmessage.cpp deleted file mode 100644 index afb4bdc03b..0000000000 --- a/src/libs/clangsupport/precompiledheadersupdatedmessage.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 "precompiledheadersupdatedmessage.h" - -#include <QDebug> - -namespace ClangBackEnd { - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const PrecompiledHeadersUpdatedMessage &) -{ - debug.nospace() << "PrecompiledHeaderUpdatedMessage()"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/precompiledheadersupdatedmessage.h b/src/libs/clangsupport/precompiledheadersupdatedmessage.h deleted file mode 100644 index 9e3e3b981c..0000000000 --- a/src/libs/clangsupport/precompiledheadersupdatedmessage.h +++ /dev/null @@ -1,81 +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 "filepathid.h" -#include "projectpartid.h" - -#include <utils/smallstringio.h> - -namespace ClangBackEnd { - -class PrecompiledHeadersUpdatedMessage -{ -public: - PrecompiledHeadersUpdatedMessage() = default; - PrecompiledHeadersUpdatedMessage(ProjectPartId projectPartId) - - { - projectPartIds.push_back(projectPartId); - } - PrecompiledHeadersUpdatedMessage(ProjectPartIds &&projectPartIds) - : projectPartIds(std::move(projectPartIds)) - {} - - ProjectPartIds takeProjectPartIds() const { return std::move(projectPartIds); } - - friend QDataStream &operator<<(QDataStream &out, const PrecompiledHeadersUpdatedMessage &message) - { - out << message.projectPartIds; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, PrecompiledHeadersUpdatedMessage &message) - { - in >> message.projectPartIds; - - return in; - } - - friend bool operator==(const PrecompiledHeadersUpdatedMessage &first, - const PrecompiledHeadersUpdatedMessage &second) - { - return first.projectPartIds == second.projectPartIds; - } - - PrecompiledHeadersUpdatedMessage clone() const { return *this; } - -public: - ProjectPartIds projectPartIds; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const PrecompiledHeadersUpdatedMessage &message); - -DECLARE_MESSAGE(PrecompiledHeadersUpdatedMessage) - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/progresscounter.h b/src/libs/clangsupport/progresscounter.h deleted file mode 100644 index 21a8e13b77..0000000000 --- a/src/libs/clangsupport/progresscounter.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <functional> -#include <mutex> - -namespace ClangBackEnd { - -class ProgressCounter -{ -public: - using SetProgressCallback = std::function<void(int, int)>; - using Lock = std::lock_guard<std::mutex>; - - ProgressCounter(SetProgressCallback &&progressCallback) - : m_progressCallback(std::move(progressCallback)) - {} - - void addTotal(int total) - { - Lock lock(m_mutex); - - if (total) { - m_total += total; - - m_progressCallback(m_progress, m_total); - } - } - - void removeTotal(int total) - { - Lock lock(m_mutex); - - if (total) { - m_total -= total; - - sendProgress(); - } - } - - void addProgress(int progress) - { - Lock lock(m_mutex); - - if (progress) { - m_progress += progress; - - sendProgress(); - } - } - - int total() const - { - Lock lock(m_mutex); - - return m_total; - } - - int progress() const - { - Lock lock(m_mutex); - - return m_progress; - } - -private: - void sendProgress() - { - m_progressCallback(m_progress, m_total); - - if (m_progress >= m_total) { - m_progress = 0; - m_total = 0; - } - } - -private: - mutable std::mutex m_mutex; - std::function<void(int, int)> m_progressCallback; - int m_progress = 0; - int m_total = 0; -}; - -} diff --git a/src/libs/clangsupport/progressmessage.h b/src/libs/clangsupport/progressmessage.h deleted file mode 100644 index 75902a90c3..0000000000 --- a/src/libs/clangsupport/progressmessage.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <QDataStream> - -namespace ClangBackEnd { - -class ProgressMessage -{ -public: - ProgressMessage() = default; - ProgressMessage(ProgressType progressType, int progress, int total) - : progress(progress) - , total(total) - , progressType(progressType) - {} - - friend QDataStream &operator<<(QDataStream &out, const ProgressMessage &message) - { - out << message.progress; - out << message.total; - out << static_cast<int>(message.progressType); - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ProgressMessage &message) - { - int progressTupe; - in >> message.progress; - in >> message.total; - in >> progressTupe; - message.progressType = static_cast<ProgressType>(progressTupe); - - return in; - } - - friend bool operator==(const ProgressMessage &first, const ProgressMessage &second) - { - return first.progress == second.progress - && first.total == second.total; - } - - ProgressMessage clone() const - { - return *this; - } - -public: - int progress = 0; - int total = 0; - ProgressType progressType = ProgressType::Invalid; -}; - -DECLARE_MESSAGE(ProgressMessage) -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/projectmanagementserverinterface.h b/src/libs/clangsupport/projectmanagementserverinterface.h deleted file mode 100644 index 7a92e5ad70..0000000000 --- a/src/libs/clangsupport/projectmanagementserverinterface.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "ipcserverinterface.h" - -namespace ClangBackEnd { - -class RemoveGeneratedFilesMessage; -class RemoveProjectPartsMessage; -class UpdateGeneratedFilesMessage; -class UpdateProjectPartsMessage; - -class ProjectManagementServerInterface : public IpcServerInterface -{ -public: - virtual void updateProjectParts(UpdateProjectPartsMessage &&message) = 0; - virtual void removeProjectParts(RemoveProjectPartsMessage &&message) = 0; - virtual void updateGeneratedFiles(UpdateGeneratedFilesMessage &&message) = 0; - virtual void removeGeneratedFiles(RemoveGeneratedFilesMessage &&message) = 0; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartartefact.cpp b/src/libs/clangsupport/projectpartartefact.cpp deleted file mode 100644 index 2c6b095ab2..0000000000 --- a/src/libs/clangsupport/projectpartartefact.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "projectpartartefact.h" - -#include <utils/algorithm.h> - -#include <QJsonArray> -#include <QJsonDocument> -#include <QJsonObject> - -namespace ClangBackEnd { - -Utils::SmallStringVector ProjectPartArtefact::toStringVector(Utils::SmallStringView jsonText) -{ - if (jsonText.isEmpty()) - return {}; - - QJsonDocument document = createJsonDocument(jsonText, "Compiler arguments parsing error"); - - return Utils::transform<Utils::SmallStringVector>(document.array(), [] (const QJsonValue &value) { - return Utils::SmallString{value.toString()}; - }); -} - -CompilerMacros ProjectPartArtefact::createCompilerMacrosFromDocument(const QJsonDocument &document) -{ - QJsonArray array = document.array(); - CompilerMacros macros; - macros.reserve(array.size()); - - for (const QJsonValueRef entry : array) { - const QJsonArray entryArray = entry.toArray(); - macros.emplace_back( - entryArray[0].toString(), entryArray[1].toString(), entryArray[2].toInt()); - } - - std::sort(macros.begin(), macros.end()); - - return macros; -} - -IncludeSearchPaths ProjectPartArtefact::createIncludeSearchPathsFromDocument(const QJsonDocument &document) -{ - QJsonArray array = document.array(); - IncludeSearchPaths paths; - paths.reserve(array.size()); - - for (const QJsonValueRef entry : array) { - const QJsonArray entryArray = entry.toArray(); - paths.emplace_back(entryArray[0].toString(), entryArray[1].toInt(), entryArray[2].toInt()); - } - - return paths; -} - -CompilerMacros ProjectPartArtefact::toCompilerMacros(Utils::SmallStringView jsonText) -{ - if (jsonText.isEmpty()) - return {}; - - QJsonDocument document = createJsonDocument(jsonText, "Compiler macros parsing error"); - - return createCompilerMacrosFromDocument(document); -} - -QJsonDocument ProjectPartArtefact::createJsonDocument(Utils::SmallStringView jsonText, - const char *whatError) -{ - QJsonParseError error; - QJsonDocument document = QJsonDocument::fromJson( - QByteArray::fromRawData(jsonText.data(), int(jsonText.size())), - &error); - checkError(whatError, error); - - return document; -} - -IncludeSearchPaths ProjectPartArtefact::toIncludeSearchPaths(Utils::SmallStringView jsonText) -{ - - if (jsonText.isEmpty()) - return {}; - - QJsonDocument document = createJsonDocument(jsonText, "Include search paths parsing error"); - - return createIncludeSearchPathsFromDocument(document); -} - -void ProjectPartArtefact::checkError(const char *whatError, const QJsonParseError &error) -{ - if (error.error != QJsonParseError::NoError) { - throw ProjectPartArtefactParseError(whatError, - error.errorString()); - } -} - -bool operator==(const ProjectPartArtefact &first, const ProjectPartArtefact &second) -{ - return first.toolChainArguments == second.toolChainArguments - && first.compilerMacros == second.compilerMacros - && first.systemIncludeSearchPaths == second.systemIncludeSearchPaths - && first.projectIncludeSearchPaths == second.projectIncludeSearchPaths; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartartefact.h b/src/libs/clangsupport/projectpartartefact.h deleted file mode 100644 index 0d9bcf5c39..0000000000 --- a/src/libs/clangsupport/projectpartartefact.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "clangsupportexceptions.h" -#include "projectpartid.h" - -#include <utils/cpplanguage_details.h> -#include <utils/smallstringvector.h> - -#include <compilermacro.h> -#include <includesearchpath.h> - -QT_FORWARD_DECLARE_CLASS(QJsonDocument) -QT_FORWARD_DECLARE_STRUCT(QJsonParseError) - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT ProjectPartArtefact -{ -public: - ProjectPartArtefact() = default; - ProjectPartArtefact(ProjectPartId projectPartId, - Utils::SmallStringVector &&toolChainArguments, - CompilerMacros &&compilerMacros, - IncludeSearchPaths &&systemIncludeSearchPaths, - IncludeSearchPaths &&projectIncludeSearchPaths, - Utils::Language language, - Utils::LanguageVersion languageVersion, - Utils::LanguageExtension languageExtension) - : projectPartId(projectPartId) - , toolChainArguments(std::move(toolChainArguments)) - , compilerMacros(std::move(compilerMacros)) - , systemIncludeSearchPaths(std::move(systemIncludeSearchPaths)) - , projectIncludeSearchPaths(std::move(projectIncludeSearchPaths)) - , language(language) - , languageVersion(languageVersion) - , languageExtension(languageExtension) - {} - - ProjectPartArtefact(Utils::SmallStringView compilerArgumentsText, - Utils::SmallStringView compilerMacrosText, - Utils::SmallStringView systemIncludeSearchPathsText, - Utils::SmallStringView projectIncludeSearchPathsText, - int projectPartId, - int language, - int languageVersion, - int languageExtension) - : projectPartId(projectPartId) - , toolChainArguments(toStringVector(compilerArgumentsText)) - , compilerMacros(toCompilerMacros(compilerMacrosText)) - , systemIncludeSearchPaths(toIncludeSearchPaths(systemIncludeSearchPathsText)) - , projectIncludeSearchPaths(toIncludeSearchPaths(projectIncludeSearchPathsText)) - , language(static_cast<Utils::Language>(language)) - , languageVersion(static_cast<Utils::LanguageVersion>(languageVersion)) - , languageExtension(static_cast<Utils::LanguageExtension>(languageExtension)) - {} - - ProjectPartArtefact(Utils::SmallStringView compilerArgumentsText, - Utils::SmallStringView compilerMacrosText, - Utils::SmallStringView systemIncludeSearchPathsText, - Utils::SmallStringView projectIncludeSearchPathsText, - int projectPartId, - Utils::Language language, - Utils::LanguageVersion languageVersion, - Utils::LanguageExtension languageExtension) - : projectPartId(projectPartId) - , toolChainArguments(toStringVector(compilerArgumentsText)) - , compilerMacros(toCompilerMacros(compilerMacrosText)) - , systemIncludeSearchPaths(toIncludeSearchPaths(systemIncludeSearchPathsText)) - , projectIncludeSearchPaths(toIncludeSearchPaths(projectIncludeSearchPathsText)) - , language(language) - , languageVersion(languageVersion) - , languageExtension(languageExtension) - {} - - static Utils::SmallStringVector toStringVector(Utils::SmallStringView jsonText); - static CompilerMacros createCompilerMacrosFromDocument(const QJsonDocument &document); - static IncludeSearchPaths createIncludeSearchPathsFromDocument(const QJsonDocument &document); - static CompilerMacros toCompilerMacros(Utils::SmallStringView jsonText); - static QJsonDocument createJsonDocument(Utils::SmallStringView jsonText, const char *whatError); - static IncludeSearchPaths toIncludeSearchPaths(Utils::SmallStringView jsonText); - static void checkError(const char *whatError, const QJsonParseError &error); - friend bool operator==(const ProjectPartArtefact &first, const ProjectPartArtefact &second); - -public: - ProjectPartId projectPartId; - Utils::SmallStringVector toolChainArguments; - CompilerMacros compilerMacros; - IncludeSearchPaths systemIncludeSearchPaths; - IncludeSearchPaths projectIncludeSearchPaths; - Utils::Language language = Utils::Language::None; - Utils::LanguageVersion languageVersion = Utils::LanguageVersion::None; - Utils::LanguageExtension languageExtension = Utils::LanguageExtension::None; -}; - -using ProjectPartArtefacts = std::vector<ProjectPartArtefact>; -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartcontainer.cpp b/src/libs/clangsupport/projectpartcontainer.cpp deleted file mode 100644 index 680b414dc7..0000000000 --- a/src/libs/clangsupport/projectpartcontainer.cpp +++ /dev/null @@ -1,38 +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 "projectpartcontainer.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const ProjectPartContainer &container) -{ - debug.nospace() << "ProjectPartContainer(" << container.projectPartId.projectPathId << "," - << container.toolChainArguments << ", " << container.headerPathIds << ", " - << container.sourcePathIds << ")"; - - return debug; -} -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartcontainer.h b/src/libs/clangsupport/projectpartcontainer.h deleted file mode 100644 index caededee5c..0000000000 --- a/src/libs/clangsupport/projectpartcontainer.h +++ /dev/null @@ -1,184 +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 "compilermacro.h" -#include "filepathid.h" -#include "includesearchpath.h" -#include "projectpartartefact.h" -#include "projectpartid.h" -#include "sourceentry.h" - -#include <utils/cpplanguage_details.h> -#include <utils/smallstringio.h> - -namespace ClangBackEnd { - -class ProjectPartContainer : public ProjectPartArtefact -{ - using uchar = unsigned char; -public: - ProjectPartContainer() = default; - ProjectPartContainer(ProjectPartId projectPartId, - Utils::SmallStringVector &&toolChainArguments, - CompilerMacros &&compilerMacros, - IncludeSearchPaths &&systemIncludeSearchPaths, - IncludeSearchPaths &&projectIncludeSearchPaths, - FilePathIds &&headerPathIds, - FilePathIds &&sourcePathIds, - Utils::Language language, - Utils::LanguageVersion languageVersion, - Utils::LanguageExtension languageExtension) - : ProjectPartArtefact(projectPartId, - std::move(toolChainArguments), - std::move(compilerMacros), - std::move(systemIncludeSearchPaths), - std::move(projectIncludeSearchPaths), - language, - languageVersion, - languageExtension) - , headerPathIds(std::move(headerPathIds)) - , sourcePathIds(std::move(sourcePathIds)) - - {} - - ProjectPartContainer(Utils::SmallStringView compilerArgumentsText, - Utils::SmallStringView compilerMacrosText, - Utils::SmallStringView systemIncludeSearchPathsText, - Utils::SmallStringView projectIncludeSearchPathsText, - int projectPartId, - int language, - int languageVersion, - int languageExtension) - : ProjectPartArtefact(compilerArgumentsText, - compilerMacrosText, - systemIncludeSearchPathsText, - projectIncludeSearchPathsText, - projectPartId, - language, - languageVersion, - languageExtension) - {} - - friend QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container) - { - out << container.projectPartId; - out << container.toolChainArguments; - out << container.compilerMacros; - out << container.systemIncludeSearchPaths; - out << container.projectIncludeSearchPaths; - out << container.headerPathIds; - out << container.sourcePathIds; - out << uchar(container.language); - out << uchar(container.languageVersion); - out << uchar(container.languageExtension); - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container) - { - uchar language; - uchar languageVersion; - uchar languageExtension; - - in >> container.projectPartId; - in >> container.toolChainArguments; - in >> container.compilerMacros; - in >> container.systemIncludeSearchPaths; - in >> container.projectIncludeSearchPaths; - in >> container.headerPathIds; - in >> container.sourcePathIds; - in >> language; - in >> languageVersion; - in >> languageExtension; - - container.language = static_cast<Utils::Language>(language); - container.languageVersion = static_cast<Utils::LanguageVersion>(languageVersion); - container.languageExtension = static_cast<Utils::LanguageExtension>(languageExtension); - - return in; - } - - friend bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second) - { - return first.projectPartId == second.projectPartId - && first.toolChainArguments == second.toolChainArguments - && first.compilerMacros == second.compilerMacros - && first.systemIncludeSearchPaths == second.systemIncludeSearchPaths - && first.projectIncludeSearchPaths == second.projectIncludeSearchPaths - && first.headerPathIds == second.headerPathIds - && first.sourcePathIds == second.sourcePathIds && first.language == second.language - && first.languageVersion == second.languageVersion - && first.languageExtension == second.languageExtension; - } - - friend bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second) - { - return std::tie(first.projectPartId, - first.toolChainArguments, - first.compilerMacros, - first.systemIncludeSearchPaths, - first.projectIncludeSearchPaths, - first.headerPathIds, - first.sourcePathIds, - first.language, - first.languageVersion, - first.languageExtension, - first.preCompiledHeaderWasGenerated) - < std::tie(second.projectPartId, - second.toolChainArguments, - second.compilerMacros, - second.systemIncludeSearchPaths, - second.projectIncludeSearchPaths, - second.headerPathIds, - second.sourcePathIds, - second.language, - second.languageVersion, - second.languageExtension, - second.preCompiledHeaderWasGenerated); - } - - ProjectPartContainer clone() const - { - return *this; - } - -public: - FilePathIds headerPathIds; - FilePathIds sourcePathIds; - bool updateIsDeferred = false; - bool preCompiledHeaderWasGenerated = true; -}; - -using ProjectPartContainerReference = std::reference_wrapper<ProjectPartContainer>; -using ProjectPartContainers = std::vector<ProjectPartContainer>; -using ProjectPartContainerReferences = std::vector<ProjectPartContainerReference>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ProjectPartContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartid.h b/src/libs/clangsupport/projectpartid.h deleted file mode 100644 index 7887e99a91..0000000000 --- a/src/libs/clangsupport/projectpartid.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <QDataStream> - -#include <vector> - -namespace ClangBackEnd { - -class ProjectPartId -{ - template<typename StringType, - typename StringViewType, - typename IndexType, - typename Mutex, - typename Compare, - Compare compare, - typename CacheEntry> - friend class StringCache; - -public: - constexpr ProjectPartId() = default; - - ProjectPartId(const char *) = delete; - - ProjectPartId(int projectPathId) - : projectPathId(projectPathId) - {} - - bool isValid() const { return projectPathId >= 0; } - - friend bool operator==(ProjectPartId first, ProjectPartId second) - { - return first.isValid() && first.projectPathId == second.projectPathId; - } - - friend bool operator==(ProjectPartId first, int second) - { - return first == ProjectPartId{second}; - } - - friend bool operator!=(ProjectPartId first, ProjectPartId second) { return !(first == second); } - - friend bool operator<(ProjectPartId first, ProjectPartId second) - { - return first.projectPathId < second.projectPathId; - } - - friend QDataStream &operator<<(QDataStream &out, ProjectPartId projectPathId) - { - out << projectPathId.projectPathId; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ProjectPartId &projectPathId) - { - in >> projectPathId.projectPathId; - - return in; - } - -private: - operator int() const { return projectPathId; } - ProjectPartId operator++() { return ++projectPathId; } - -public: - int projectPathId = -1; -}; - -using ProjectPartIds = std::vector<ProjectPartId>; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartpch.cpp b/src/libs/clangsupport/projectpartpch.cpp deleted file mode 100644 index 9c870ac572..0000000000 --- a/src/libs/clangsupport/projectpartpch.cpp +++ /dev/null @@ -1,37 +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 "projectpartpch.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const ProjectPartPch &projectPartPch) -{ - debug.nospace() << "FileContainer(" << projectPartPch.projectPartId.projectPathId << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartpch.h b/src/libs/clangsupport/projectpartpch.h deleted file mode 100644 index 213247ae42..0000000000 --- a/src/libs/clangsupport/projectpartpch.h +++ /dev/null @@ -1,94 +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 <projectpartid.h> - -namespace ClangBackEnd { - -class ProjectPartPch -{ -public: - ProjectPartPch() = default; - ProjectPartPch(ProjectPartId projectPartId, FilePath &&pchPath, long long lastModified) - : projectPartId(projectPartId) - , pchPath(std::move(pchPath)) - , lastModified(lastModified) - {} - - ProjectPartPch(int projectPartId, Utils::SmallStringView pchPath, long long lastModified) - : projectPartId(projectPartId) - , pchPath(FilePathView(pchPath)) - , lastModified(lastModified) - {} - - bool isValid() const - { - return projectPartId.isValid() && pchPath.isValid() && lastModified >= 0; - } - - friend QDataStream &operator<<(QDataStream &out, const ProjectPartPch &container) - { - out << container.projectPartId; - out << container.pchPath; - out << container.lastModified; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ProjectPartPch &container) - { - in >> container.projectPartId; - in >> container.pchPath; - in >> container.lastModified; - - return in; - } - - friend bool operator==(const ProjectPartPch &first, - const ProjectPartPch &second) - { - return first.projectPartId == second.projectPartId && first.pchPath == second.pchPath; - } - - ProjectPartPch clone() const - { - return *this; - } - -public: - ProjectPartId projectPartId; - FilePath pchPath; - long long lastModified = -1; -}; - -using ProjectPartPchs = std::vector<ProjectPartPch>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ProjectPartPch &projectPartPch); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartsstorage.h b/src/libs/clangsupport/projectpartsstorage.h deleted file mode 100644 index 671b6f0ef7..0000000000 --- a/src/libs/clangsupport/projectpartsstorage.h +++ /dev/null @@ -1,416 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "clangsupportexceptions.h" -#include "projectpartsstorageinterface.h" - -#include <sqliteexception.h> -#include <sqlitetransaction.h> - -namespace ClangBackEnd { - -template<typename Database = Sqlite::Database> -class ProjectPartsStorage final : public ProjectPartsStorageInterface -{ - template<int ResultCount> - using ReadStatement = typename Database::template ReadStatement<ResultCount>; - using WriteStatement = typename Database::WriteStatement; - -public: - ProjectPartsStorage(Database &database) - : transaction(database) - , database(database) - { - transaction.commit(); - } - - ProjectPartContainers fetchProjectParts() const override - { - try { - Sqlite::DeferredTransaction transaction{database}; - - auto values = fetchProjectPartsStatement.template values<ProjectPartContainer>(4096); - - transaction.commit(); - - return values; - } catch (const Sqlite::StatementIsBusy &) { - return fetchProjectParts(); - } - } - - FilePathIds fetchHeaders(ProjectPartId projectPartId) const - { - return fetchProjectPartsHeadersByIdStatement - .template values<FilePathId>(1024, projectPartId.projectPathId); - } - - FilePathIds fetchSources(ProjectPartId projectPartId) const - { - return fetchProjectPartsSourcesByIdStatement - .template values<FilePathId>(1024, projectPartId.projectPathId); - } - - bool preCompiledHeaderWasGenerated(ProjectPartId projectPartId) const - { - auto value = fetchProjectPrecompiledHeaderBuildTimeStatement.template optionalValue<long long>( - projectPartId.projectPathId); - - return value && *value > 0; - } - - ProjectPartContainers fetchProjectParts(const ProjectPartIds &projectPartIds) const override - { - try { - ProjectPartContainers projectParts; - projectParts.reserve(projectPartIds.size()); - - Sqlite::DeferredTransaction transaction{database}; - - for (ProjectPartId projectPartId : projectPartIds) { - auto value = fetchProjectPartByIdStatement.template optionalValue<ProjectPartContainer>( - projectPartId.projectPathId); - if (value) { - value->headerPathIds = fetchHeaders(projectPartId); - value->sourcePathIds = fetchSources(projectPartId); - value->preCompiledHeaderWasGenerated = preCompiledHeaderWasGenerated(projectPartId); - projectParts.push_back(*std::move(value)); - } - } - - transaction.commit(); - - return projectParts; - } catch (const Sqlite::StatementIsBusy &) { - return fetchProjectParts(projectPartIds); - } - } - - ProjectPartId fetchProjectPartIdUnguarded(Utils::SmallStringView projectPartName) const override - { - auto optionalProjectPartId = fetchProjectPartIdStatement.template optionalValue<ProjectPartId>( - projectPartName); - - if (optionalProjectPartId) { - return *optionalProjectPartId; - } else { - insertProjectPartNameStatement.write(projectPartName); - - return static_cast<int>(database.lastInsertedRowId()); - } - - return {}; - } - - ProjectPartId fetchProjectPartId(Utils::SmallStringView projectPartName) const override - { - try { - Sqlite::DeferredTransaction transaction{database}; - - ProjectPartId projectPartId = fetchProjectPartIdUnguarded(projectPartName); - - transaction.commit(); - - return projectPartId; - - } catch (const Sqlite::StatementIsBusy &) { - return fetchProjectPartId(projectPartName); - } - } - - Utils::PathString fetchProjectPartName(ProjectPartId projectPartId) const override - { - try { - Sqlite::DeferredTransaction transaction{database}; - - auto optionalProjectPartName = fetchProjectPartNameStatement - .template optionalValue<Utils::PathString>( - projectPartId.projectPathId); - - transaction.commit(); - - if (optionalProjectPartName) - return *std::move(optionalProjectPartName); - } catch (const Sqlite::StatementIsBusy &) { - return fetchProjectPartName(projectPartId); - } - - throwProjectPartDoesNotExists(projectPartId); - } - - void insertHeaders(ProjectPartId projectPartId, const FilePathIds &headerPathIds) - { - deleteProjectPartsHeadersByIdStatement.write(projectPartId.projectPathId); - for (FilePathId headerPathId : headerPathIds) { - insertProjectPartsHeadersStatement.write(projectPartId.projectPathId, - headerPathId.filePathId); - } - } - - void insertSources(ProjectPartId projectPartId, const FilePathIds &sourcePathIds) - { - deleteProjectPartsSourcesByIdStatement.write(projectPartId.projectPathId); - for (FilePathId sourcePathId : sourcePathIds) { - insertProjectPartsSourcesStatement.write(projectPartId.projectPathId, - sourcePathId.filePathId); - } - } - - void updateProjectPart(ProjectPartId projectPartId, - const Utils::SmallStringVector &toolChainArguments, - const CompilerMacros &compilerMacros, - const IncludeSearchPaths &systemIncludeSearchPaths, - const IncludeSearchPaths &projectIncludeSearchPaths, - Utils::Language language, - Utils::LanguageVersion languageVersion, - Utils::LanguageExtension languageExtension) override - { - Utils::SmallString toolChainArgumentsAsJson = toJson(toolChainArguments); - Utils::SmallString compilerMacrosAsJson = toJson(compilerMacros); - Utils::SmallString systemIncludeSearchPathsAsJason = toJson(systemIncludeSearchPaths); - Utils::SmallString projectIncludeSearchPathsAsJason = toJson(projectIncludeSearchPaths); - - updateProjectPartStatement.write(projectPartId.projectPathId, - toolChainArgumentsAsJson, - compilerMacrosAsJson, - systemIncludeSearchPathsAsJason, - projectIncludeSearchPathsAsJason, - static_cast<int>(language), - static_cast<int>(languageVersion), - static_cast<int>(languageExtension)); - } - - void updateProjectPart(const ProjectPartContainer &projectPart) - { - Utils::SmallString toolChainArgumentsAsJson = toJson(projectPart.toolChainArguments); - Utils::SmallString compilerMacrosAsJson = toJson(projectPart.compilerMacros); - Utils::SmallString systemIncludeSearchPathsAsJason = toJson( - projectPart.systemIncludeSearchPaths); - Utils::SmallString projectIncludeSearchPathsAsJason = toJson( - projectPart.projectIncludeSearchPaths); - - updateProjectPartStatement.write(projectPart.projectPartId.projectPathId, - toolChainArgumentsAsJson, - compilerMacrosAsJson, - systemIncludeSearchPathsAsJason, - projectIncludeSearchPathsAsJason, - static_cast<int>(projectPart.language), - static_cast<int>(projectPart.languageVersion), - static_cast<int>(projectPart.languageExtension)); - - insertHeaders(projectPart.projectPartId, projectPart.headerPathIds); - insertSources(projectPart.projectPartId, projectPart.sourcePathIds); - } - - void updateProjectParts(const ProjectPartContainers &projectParts) override - { - try { - Sqlite::ImmediateTransaction transaction{database}; - - for (const ProjectPartContainer &projectPart : projectParts) - updateProjectPart(projectPart); - - transaction.commit(); - } catch (const Sqlite::StatementIsBusy &) { - updateProjectParts(projectParts); - } - } - - Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(FilePathId sourceId) const override - { - try { - Sqlite::DeferredTransaction transaction{database}; - - auto &statement = getProjectPartArtefactsBySourceId; - - auto value = statement.template optionalValue<ProjectPartArtefact>(sourceId.filePathId); - - transaction.commit(); - - return value; - } catch (const Sqlite::StatementIsBusy &) { - return fetchProjectPartArtefact(sourceId); - } - } - - Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(ProjectPartId projectPartId) const override - { - try { - Sqlite::DeferredTransaction transaction{database}; - - auto &statement = getProjectPartArtefactsByProjectPartId; - - auto value = statement.template optionalValue<ProjectPartArtefact>( - projectPartId.projectPathId); - - transaction.commit(); - - return value; - } catch (const Sqlite::StatementIsBusy &) { - return fetchProjectPartArtefact(projectPartId); - } - } - - void resetIndexingTimeStamps(const ProjectPartContainers &projectsParts) override - { - try { - Sqlite::ImmediateTransaction transaction{database}; - - for (const ProjectPartContainer &projectPart : projectsParts) { - for (FilePathId sourcePathId : projectPart.sourcePathIds) - resetDependentIndexingTimeStampsStatement.write(sourcePathId.filePathId); - } - - transaction.commit(); - } catch (const Sqlite::StatementIsBusy &) { - resetIndexingTimeStamps(projectsParts); - } - } - - Sqlite::TransactionInterface &transactionBackend() override { return database; } - - static Utils::SmallString toJson(const Utils::SmallStringVector &strings) - { - QJsonDocument document; - QJsonArray array; - - std::transform(strings.begin(), - strings.end(), - std::back_inserter(array), - [](const auto &string) { return QJsonValue(string.data()); }); - - document.setArray(array); - - return document.toJson(QJsonDocument::Compact); - } - - static Utils::SmallString toJson(const CompilerMacros &compilerMacros) - { - QJsonDocument document; - QJsonArray array; - - for (const CompilerMacro ¯o : compilerMacros) - array.push_back(QJsonArray{{QString(macro.key), QString(macro.value), macro.index}}); - - document.setArray(array); - - return document.toJson(QJsonDocument::Compact); - } - - static Utils::SmallString toJson(const IncludeSearchPaths &includeSearchPaths) - { - QJsonDocument document; - QJsonArray array; - - for (const IncludeSearchPath &path : includeSearchPaths) - array.push_back(QJsonArray{{path.path.data(), path.index, int(path.type)}}); - - document.setArray(array); - - return document.toJson(QJsonDocument::Compact); - } - - [[noreturn]] void throwProjectPartDoesNotExists(ProjectPartId projectPartId) const - { - throw ProjectPartDoesNotExists("Try to fetch non existing project part id: ", - Utils::SmallString::number(projectPartId.projectPathId)); - } - - Internal::ProjectPartNameIds fetchAllProjectPartNamesAndIds() const override - { - try { - Sqlite::DeferredTransaction transaction{database}; - - auto &statement = fetchAllProjectPartNamesAndIdsStatement; - - auto values = statement.template values<Internal::ProjectPartNameId>(256); - - transaction.commit(); - - return values; - } catch (const Sqlite::StatementIsBusy &) { - return fetchAllProjectPartNamesAndIds(); - } - } - -public: - Sqlite::ImmediateNonThrowingDestructorTransaction transaction; - Database &database; - mutable ReadStatement<1> fetchProjectPartIdStatement{ - "SELECT projectPartId FROM projectParts WHERE projectPartName = ?", database}; - mutable WriteStatement insertProjectPartNameStatement{ - "INSERT INTO projectParts(projectPartName) VALUES (?)", database}; - mutable ReadStatement<1> fetchProjectPartNameStatement{ - "SELECT projectPartName FROM projectParts WHERE projectPartId = ?", database}; - mutable ReadStatement<8> fetchProjectPartsStatement{ - "SELECT toolChainArguments, compilerMacros, systemIncludeSearchPaths, " - "projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension " - "FROM projectParts", - database}; - mutable ReadStatement<8> fetchProjectPartByIdStatement{ - "SELECT toolChainArguments, compilerMacros, systemIncludeSearchPaths, " - "projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension " - "FROM projectParts WHERE projectPartId = ?", - database}; - WriteStatement updateProjectPartStatement{ - "UPDATE projectParts SET toolChainArguments=?002, compilerMacros=?003, " - "systemIncludeSearchPaths=?004, projectIncludeSearchPaths=?005, language=?006, " - "languageVersion=?007, languageExtension=?008 WHERE projectPartId = ?001", - database}; - mutable ReadStatement<8> getProjectPartArtefactsBySourceId{ - "SELECT toolChainArguments, compilerMacros, systemIncludeSearchPaths, " - "projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension " - "FROM projectParts WHERE projectPartId = (SELECT " - "projectPartId FROM projectPartsFiles WHERE sourceId = ?)", - database}; - mutable ReadStatement<8> getProjectPartArtefactsByProjectPartId{ - "SELECT toolChainArguments, compilerMacros, systemIncludeSearchPaths, " - "projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension " - "FROM projectParts WHERE projectPartId = ?", - database}; - WriteStatement deleteProjectPartsHeadersByIdStatement{ - "DELETE FROM projectPartsHeaders WHERE projectPartId = ?", database}; - WriteStatement deleteProjectPartsSourcesByIdStatement{ - "DELETE FROM projectPartsSources WHERE projectPartId = ?", database}; - WriteStatement insertProjectPartsHeadersStatement{ - "INSERT INTO projectPartsHeaders(projectPartId, sourceId) VALUES (?,?)", database}; - WriteStatement insertProjectPartsSourcesStatement{ - "INSERT INTO projectPartsSources(projectPartId, sourceId) VALUES (?,?)", database}; - mutable ReadStatement<1> fetchProjectPartsHeadersByIdStatement{ - "SELECT sourceId FROM projectPartsHeaders WHERE projectPartId = ? ORDER BY sourceId", - database}; - mutable ReadStatement<1> fetchProjectPartsSourcesByIdStatement{ - "SELECT sourceId FROM projectPartsSources WHERE projectPartId = ? ORDER BY sourceId", - database}; - mutable ReadStatement<1> fetchProjectPrecompiledHeaderBuildTimeStatement{ - "SELECT projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?", database}; - WriteStatement resetDependentIndexingTimeStampsStatement{ - "UPDATE fileStatuses SET indexingTimeStamp = NULL WHERE sourceId = ?", database}; - mutable ReadStatement<2> fetchAllProjectPartNamesAndIdsStatement{ - "SELECT projectPartName, projectPartId FROM projectParts", database}; -}; -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartsstorageinterface.h b/src/libs/clangsupport/projectpartsstorageinterface.h deleted file mode 100644 index ec1ce65dd0..0000000000 --- a/src/libs/clangsupport/projectpartsstorageinterface.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "projectpartcontainer.h" -#include "projectpartstoragestructs.h" - -#include <sqlitetransaction.h> -#include <utils/optional.h> -#include <utils/smallstringview.h> - -#include <QJsonArray> -#include <QJsonDocument> -#include <QJsonObject> - -namespace ClangBackEnd { - -class ProjectPartsStorageInterface -{ -public: - ProjectPartsStorageInterface() = default; - ProjectPartsStorageInterface(const ProjectPartsStorageInterface &) = delete; - ProjectPartsStorageInterface &operator=(const ProjectPartsStorageInterface &) = delete; - - virtual ProjectPartContainers fetchProjectParts() const = 0; - virtual ProjectPartContainers fetchProjectParts(const ProjectPartIds &projectPartIds) const = 0; - virtual ProjectPartId fetchProjectPartIdUnguarded(Utils::SmallStringView projectPartName) const = 0; - virtual ProjectPartId fetchProjectPartId(Utils::SmallStringView projectPartName) const = 0; - virtual Utils::PathString fetchProjectPartName(ProjectPartId projectPartId) const = 0; - virtual Internal::ProjectPartNameIds fetchAllProjectPartNamesAndIds() const = 0; - virtual void updateProjectPart(ProjectPartId projectPartId, - const Utils::SmallStringVector &commandLineArguments, - const CompilerMacros &compilerMacros, - const ClangBackEnd::IncludeSearchPaths &systemIncludeSearchPaths, - const ClangBackEnd::IncludeSearchPaths &projectIncludeSearchPaths, - Utils::Language language, - Utils::LanguageVersion languageVersion, - Utils::LanguageExtension languageExtension) - = 0; - - virtual void updateProjectParts(const ProjectPartContainers &projectParts) = 0; - - virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(FilePathId sourceId) const = 0; - virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact( - ProjectPartId projectPartId) const = 0; - virtual void resetIndexingTimeStamps(const ProjectPartContainers &projectsParts) = 0; - - virtual Sqlite::TransactionInterface &transactionBackend() = 0; - -protected: - ~ProjectPartsStorageInterface() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/projectpartstoragestructs.h b/src/libs/clangsupport/projectpartstoragestructs.h deleted file mode 100644 index b575d31240..0000000000 --- a/src/libs/clangsupport/projectpartstoragestructs.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "projectpartid.h" -#include "stringcacheentry.h" - -#include <utils/smallstring.h> - -#include <vector> - -namespace ClangBackEnd { - -namespace Internal { - -class ProjectPartNameId - : public StringCacheEntry<Utils::PathString, Utils::SmallStringView, ProjectPartId> -{ - using Base = StringCacheEntry<Utils::PathString, Utils::SmallStringView, ProjectPartId>; - -public: - using Base::Base; - - ProjectPartNameId(Utils::SmallStringView projectPartName, int projectPartId) - : Base(projectPartName, projectPartId) - {} -}; - -using ProjectPartNameIds = std::vector<ProjectPartNameId>; -} // namespace Internal - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringclientinterface.cpp b/src/libs/clangsupport/refactoringclientinterface.cpp deleted file mode 100644 index e862e4e4d9..0000000000 --- a/src/libs/clangsupport/refactoringclientinterface.cpp +++ /dev/null @@ -1,55 +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 "refactoringclientinterface.h" - -#include "messageenvelop.h" -#include "clangrefactoringclientmessages.h" - -#include <QDebug> - -namespace ClangBackEnd { - -void RefactoringClientInterface::dispatch(const MessageEnvelop &messageEnvelop) -{ - switch (messageEnvelop.messageType()) { - case MessageType::AliveMessage: - alive(); - break; - case MessageType::SourceRangesAndDiagnosticsForQueryMessage: - sourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<SourceRangesAndDiagnosticsForQueryMessage>()); - break; - case MessageType::SourceRangesForQueryMessage: - sourceRangesForQueryMessage(messageEnvelop.message<SourceRangesForQueryMessage>()); - break; - case MessageType::ProgressMessage: - progress(messageEnvelop.message<ProgressMessage>()); - break; - default: - qWarning() << "Unknown IpcClientMessage"; - } -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringclientinterface.h b/src/libs/clangsupport/refactoringclientinterface.h deleted file mode 100644 index 71c4809753..0000000000 --- a/src/libs/clangsupport/refactoringclientinterface.h +++ /dev/null @@ -1,55 +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 "ipcclientinterface.h" - -#include <functional> - -namespace ClangBackEnd { - -class ProgressMessage; -class SourceLocationsForRenamingMessage; -class SourceRangesAndDiagnosticsForQueryMessage; -class SourceRangesForQueryMessage; -class SourceLocationsContainer; - -class CLANGSUPPORT_EXPORT RefactoringClientInterface : public IpcClientInterface -{ -public: - using RenameCallback = std::function<void(const QString &, - const SourceLocationsContainer &, - int)>; - - void dispatch(const MessageEnvelop &messageEnvelop) override; - - virtual void alive() = 0; - virtual void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) = 0; - virtual void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) = 0; - virtual void progress(ProgressMessage &&message) = 0; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringclientproxy.cpp b/src/libs/clangsupport/refactoringclientproxy.cpp deleted file mode 100644 index b2d30d7bfb..0000000000 --- a/src/libs/clangsupport/refactoringclientproxy.cpp +++ /dev/null @@ -1,84 +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 "refactoringclientproxy.h" - -#include "alivemessage.h" -#include "messageenvelop.h" -#include "refactoringserverinterface.h" -#include "clangrefactoringclientmessages.h" - -#include <QDebug> -#include <QLocalSocket> - -namespace ClangBackEnd { - -RefactoringClientProxy::RefactoringClientProxy(RefactoringServerInterface *server, - QLocalSocket *localSocket) - : writeMessageBlock(localSocket) - , readMessageBlock(localSocket) - , server(server) -{ - QObject::connect(localSocket, &QIODevice::readyRead, [this]() { - RefactoringClientProxy::readMessages(); - }); -} - -RefactoringClientProxy::RefactoringClientProxy(RefactoringServerInterface *server, - QIODevice *ioDevice) - : writeMessageBlock(ioDevice) - , readMessageBlock(ioDevice) - , server(server) -{ - QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {RefactoringClientProxy::readMessages();}); -} - -void RefactoringClientProxy::readMessages() -{ - for (const MessageEnvelop &message : readMessageBlock.readAll()) - server->dispatch(message); -} - -void RefactoringClientProxy::alive() -{ - writeMessageBlock.write(AliveMessage()); -} - -void RefactoringClientProxy::sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) -{ - writeMessageBlock.write(message); -} - -void RefactoringClientProxy::sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) -{ - writeMessageBlock.write(message); -} - -void RefactoringClientProxy::progress(ProgressMessage &&message) -{ - writeMessageBlock.write(message); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringclientproxy.h b/src/libs/clangsupport/refactoringclientproxy.h deleted file mode 100644 index 2af2188d60..0000000000 --- a/src/libs/clangsupport/refactoringclientproxy.h +++ /dev/null @@ -1,63 +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 "refactoringclientinterface.h" -#include "readmessageblock.h" -#include "writemessageblock.h" - -#include <memory> - -namespace ClangBackEnd { - -class RefactoringServerInterface; - -class CLANGSUPPORT_EXPORT RefactoringClientProxy : public RefactoringClientInterface -{ -public: - explicit RefactoringClientProxy(RefactoringServerInterface *server, QLocalSocket *localSocket); - explicit RefactoringClientProxy(RefactoringServerInterface *server, QIODevice *ioDevice); - RefactoringClientProxy(const RefactoringClientProxy&) = delete; - const RefactoringClientProxy &operator=(const RefactoringClientProxy&) = delete; - - RefactoringClientProxy(RefactoringClientProxy &&other) = delete; - RefactoringClientProxy &operator=(RefactoringClientProxy &&other) = delete; - - void readMessages(); - - void alive() override; - void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) override; - void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) override; - void progress(ProgressMessage &&message) override; - -private: - ClangBackEnd::WriteMessageBlock writeMessageBlock; - ClangBackEnd::ReadMessageBlock readMessageBlock; - RefactoringServerInterface *server = nullptr; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringdatabaseinitializer.h b/src/libs/clangsupport/refactoringdatabaseinitializer.h deleted file mode 100644 index b26bd4ef04..0000000000 --- a/src/libs/clangsupport/refactoringdatabaseinitializer.h +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <createtablesqlstatementbuilder.h> - -#include <sqlitetransaction.h> -#include <sqlitetable.h> - -namespace ClangBackEnd { - -template<typename DatabaseType> -class RefactoringDatabaseInitializer -{ -public: - RefactoringDatabaseInitializer(DatabaseType &database) - : database(database) - { - if (!database.isInitialized()) { - Sqlite::ExclusiveTransaction transaction{database}; - - createSymbolsTable(); - createLocationsTable(); - createSourcesTable(); - createDirectoriesTable(); - createProjectPartsTable(); - createProjectPartsFilesTable(); - createUsedMacrosTable(); - createFileStatusesTable(); - createSourceDependenciesTable(); - createPrecompiledHeadersTable(); - createProjectPartsHeadersTable(); - createProjectPartsSourcesTable(); - - transaction.commit(); - - database.setIsInitialized(true); - } - } - - void createSymbolsTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("symbols"); - table.addColumn("symbolId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - const Sqlite::Column &usrColumn = table.addColumn("usr", Sqlite::ColumnType::Text); - const Sqlite::Column &symbolNameColumn = table.addColumn("symbolName", Sqlite::ColumnType::Text); - const Sqlite::Column &symbolKindColumn = table.addColumn("symbolKind", Sqlite::ColumnType::Integer); - table.addColumn("signature", Sqlite::ColumnType::Text); - table.addIndex({usrColumn}); - table.addIndex({symbolKindColumn, symbolNameColumn}); - - table.initialize(database); - } - - void createLocationsTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("locations"); - const Sqlite::Column &symbolIdColumn = table.addColumn("symbolId", - Sqlite::ColumnType::Integer); - const Sqlite::Column &lineColumn = table.addColumn("line", Sqlite::ColumnType::Integer); - const Sqlite::Column &columnColumn = table.addColumn("column", Sqlite::ColumnType::Integer); - const Sqlite::Column &sourceIdColumn = table.addColumn("sourceId", Sqlite::ColumnType::Integer); - const Sqlite::Column &locationKindColumn = table.addColumn("locationKind", Sqlite::ColumnType::Integer); - table.addUniqueIndex({sourceIdColumn, lineColumn, columnColumn}); - table.addIndex({sourceIdColumn, locationKindColumn}); - table.addIndex({symbolIdColumn}); - - table.initialize(database); - } - - void createSourcesTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("sources"); - table.addColumn("sourceId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - const Sqlite::Column &directoryIdColumn = table.addColumn("directoryId", Sqlite::ColumnType::Integer); - const Sqlite::Column &sourceNameColumn = table.addColumn("sourceName", Sqlite::ColumnType::Text); - table.addUniqueIndex({directoryIdColumn, sourceNameColumn}); - - table.initialize(database); - } - - void createDirectoriesTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("directories"); - table.addColumn("directoryId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - const Sqlite::Column &directoryPathColumn = table.addColumn("directoryPath", Sqlite::ColumnType::Text); - table.addUniqueIndex({directoryPathColumn}); - - table.initialize(database); - } - - void createProjectPartsTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("projectParts"); - table.addColumn("projectPartId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - const Sqlite::Column &projectPartNameColumn = table.addColumn("projectPartName", Sqlite::ColumnType::Text); - table.addColumn("toolChainArguments", Sqlite::ColumnType::Text); - table.addColumn("compilerMacros", Sqlite::ColumnType::Text); - table.addColumn("systemIncludeSearchPaths", Sqlite::ColumnType::Text); - table.addColumn("projectIncludeSearchPaths", Sqlite::ColumnType::Text); - table.addColumn("language", Sqlite::ColumnType::Integer); - table.addColumn("languageVersion", Sqlite::ColumnType::Integer); - table.addColumn("languageExtension", Sqlite::ColumnType::Integer); - table.addUniqueIndex({projectPartNameColumn}); - - table.initialize(database); - } - - void createProjectPartsFilesTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("projectPartsFiles"); - const Sqlite::Column &projectPartIdColumn = table.addColumn("projectPartId", Sqlite::ColumnType::Integer); - const Sqlite::Column &sourceIdColumn = table.addColumn("sourceId", Sqlite::ColumnType::Integer); - const Sqlite::Column &sourceType = table.addColumn("sourceType", Sqlite::ColumnType::Integer); - table.addColumn("pchCreationTimeStamp", Sqlite::ColumnType::Integer); - table.addColumn("hasMissingIncludes", Sqlite::ColumnType::Integer); - table.addUniqueIndex({sourceIdColumn, projectPartIdColumn}); - table.addIndex({projectPartIdColumn, sourceType}); - - table.initialize(database); - } - - void createUsedMacrosTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("usedMacros"); - table.addColumn("usedMacroId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - const Sqlite::Column &sourceIdColumn = table.addColumn("sourceId", Sqlite::ColumnType::Integer); - const Sqlite::Column ¯oNameColumn = table.addColumn("macroName", Sqlite::ColumnType::Text); - table.addIndex({sourceIdColumn, macroNameColumn}); - table.addIndex({macroNameColumn}); - - table.initialize(database); - } - - void createFileStatusesTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("fileStatuses"); - table.addColumn("sourceId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - table.addColumn("size", Sqlite::ColumnType::Integer); - table.addColumn("lastModified", Sqlite::ColumnType::Integer); - table.addColumn("indexingTimeStamp", Sqlite::ColumnType::Integer); - table.initialize(database); - } - - void createSourceDependenciesTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("sourceDependencies"); - const Sqlite::Column &sourceIdColumn = table.addColumn("sourceId", Sqlite::ColumnType::Integer); - const Sqlite::Column &dependencySourceIdColumn = table.addColumn("dependencySourceId", Sqlite::ColumnType::Integer); - table.addIndex({sourceIdColumn, dependencySourceIdColumn}); - table.addIndex({dependencySourceIdColumn, sourceIdColumn}); - - table.initialize(database); - } - - void createPrecompiledHeadersTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("precompiledHeaders"); - table.addColumn("projectPartId", Sqlite::ColumnType::Integer, {Sqlite::PrimaryKey{}}); - table.addColumn("projectPchPath", Sqlite::ColumnType::Text); - table.addColumn("projectPchBuildTime", Sqlite::ColumnType::Integer); - table.addColumn("systemPchPath", Sqlite::ColumnType::Text); - table.addColumn("systemPchBuildTime", Sqlite::ColumnType::Integer); - table.initialize(database); - } - - void createProjectPartsHeadersTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("projectPartsHeaders"); - const Sqlite::Column &projectPartIdColumn = table.addColumn("projectPartId", - Sqlite::ColumnType::Integer); - table.addColumn("sourceId", Sqlite::ColumnType::Integer); - table.addIndex({projectPartIdColumn}); - - table.initialize(database); - } - - void createProjectPartsSourcesTable() - { - Sqlite::Table table; - table.setUseIfNotExists(true); - table.setName("projectPartsSources"); - const Sqlite::Column &projectPartIdColumn = table.addColumn("projectPartId", - Sqlite::ColumnType::Integer); - table.addColumn("sourceId", Sqlite::ColumnType::Integer); - table.addIndex({projectPartIdColumn}); - - table.initialize(database); - } - -public: - DatabaseType &database; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringserverinterface.cpp b/src/libs/clangsupport/refactoringserverinterface.cpp deleted file mode 100644 index 6fcaa0f054..0000000000 --- a/src/libs/clangsupport/refactoringserverinterface.cpp +++ /dev/null @@ -1,67 +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 "refactoringserverinterface.h" - -#include "messageenvelop.h" -#include "clangrefactoringservermessages.h" - -#include <QDebug> - -namespace ClangBackEnd { - -void RefactoringServerInterface::dispatch(const MessageEnvelop &messageEnvelop) -{ - switch (messageEnvelop.messageType()) { - case MessageType::EndMessage: - end(); - break; - case MessageType::RequestSourceRangesAndDiagnosticsForQueryMessage: - requestSourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<RequestSourceRangesAndDiagnosticsForQueryMessage>()); - break; - case MessageType::RequestSourceRangesForQueryMessage: - requestSourceRangesForQueryMessage(messageEnvelop.message<RequestSourceRangesForQueryMessage>()); - break; - case MessageType::UpdateProjectPartsMessage: - updateProjectParts(messageEnvelop.message<UpdateProjectPartsMessage>()); - break; - case MessageType::UpdateGeneratedFilesMessage: - updateGeneratedFiles(messageEnvelop.message<UpdateGeneratedFilesMessage>()); - break; - case MessageType::RemoveProjectPartsMessage: - removeProjectParts(messageEnvelop.message<RemoveProjectPartsMessage>()); - break; - case MessageType::RemoveGeneratedFilesMessage: - removeGeneratedFiles(messageEnvelop.message<RemoveGeneratedFilesMessage>()); - break; - case MessageType::CancelMessage: - cancel(); - break; - default: - qWarning() << "Unknown IpcClientMessage"; - } -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringserverinterface.h b/src/libs/clangsupport/refactoringserverinterface.h deleted file mode 100644 index 0f20da9ddf..0000000000 --- a/src/libs/clangsupport/refactoringserverinterface.h +++ /dev/null @@ -1,65 +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 "projectmanagementserverinterface.h" - -#include <memory> - -namespace ClangBackEnd { - -class RefactoringClientInterface; -class RequestSourceRangesAndDiagnosticsForQueryMessage; -class RequestSourceRangesForQueryMessage; -class CancelMessage; -class UpdateProjectPartsMessage; -class RemoveProjectPartsMessage; - -class CLANGSUPPORT_EXPORT RefactoringServerInterface : public ProjectManagementServerInterface - -{ -public: - void dispatch(const MessageEnvelop &messageEnvelop) override; - - virtual void end() = 0; - virtual void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) = 0; - virtual void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) = 0; - virtual void cancel() = 0; - - bool isAvailable() const - { - return isAvailable_; - } - void setAvailable(bool isAvailable) - { - isAvailable_ = isAvailable; - } - -private: - bool isAvailable_ = false; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringserverproxy.cpp b/src/libs/clangsupport/refactoringserverproxy.cpp deleted file mode 100644 index a206a2531b..0000000000 --- a/src/libs/clangsupport/refactoringserverproxy.cpp +++ /dev/null @@ -1,88 +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 "refactoringserverproxy.h" - -#include "messageenvelop.h" -#include "refactoringclientinterface.h" -#include "clangrefactoringservermessages.h" - -#include <QIODevice> -#include <QVector> - -namespace ClangBackEnd { - -RefactoringServerProxy::RefactoringServerProxy(RefactoringClientInterface *client, - QLocalSocket *localSocket) - : BaseServerProxy(client, localSocket) -{} - -RefactoringServerProxy::RefactoringServerProxy(RefactoringClientInterface *client, - QIODevice *ioDevice) - : BaseServerProxy(client, ioDevice) -{ -} - -void RefactoringServerProxy::end() -{ - m_writeMessageBlock.write(EndMessage()); -} - -void RefactoringServerProxy::requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void RefactoringServerProxy::requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void RefactoringServerProxy::updateProjectParts(UpdateProjectPartsMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void RefactoringServerProxy::removeProjectParts(RemoveProjectPartsMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void RefactoringServerProxy::updateGeneratedFiles(UpdateGeneratedFilesMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void RefactoringServerProxy::removeGeneratedFiles(RemoveGeneratedFilesMessage &&message) -{ - m_writeMessageBlock.write(message); -} - -void RefactoringServerProxy::cancel() -{ - m_writeMessageBlock.write(CancelMessage()); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/refactoringserverproxy.h b/src/libs/clangsupport/refactoringserverproxy.h deleted file mode 100644 index 4b91036c46..0000000000 --- a/src/libs/clangsupport/refactoringserverproxy.h +++ /dev/null @@ -1,64 +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 "baseserverproxy.h" -#include "clangsupport_global.h" -#include "refactoringserverinterface.h" -#include "readmessageblock.h" -#include "writemessageblock.h" - -#include <QtGlobal> - -#include <memory> - -QT_BEGIN_NAMESPACE -class QIODevice; -QT_END_NAMESPACE - -namespace ClangBackEnd { - -class RefactoringClientInterface; - -class CLANGSUPPORT_EXPORT RefactoringServerProxy final : public BaseServerProxy, - public RefactoringServerInterface -{ -public: - explicit RefactoringServerProxy(RefactoringClientInterface *client, - QLocalSocket *localSocket = {}); - explicit RefactoringServerProxy(RefactoringClientInterface *client, QIODevice *ioDevice); - - void end() override; - void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) override; - void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) override; - void updateProjectParts(UpdateProjectPartsMessage &&message) override; - void removeProjectParts(RemoveProjectPartsMessage &&message) override; - void updateGeneratedFiles(UpdateGeneratedFilesMessage &&message) override; - void removeGeneratedFiles(RemoveGeneratedFilesMessage &&message) override; - void cancel() override; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/removegeneratedfilesmessage.cpp b/src/libs/clangsupport/removegeneratedfilesmessage.cpp deleted file mode 100644 index 2ed92a8169..0000000000 --- a/src/libs/clangsupport/removegeneratedfilesmessage.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "removegeneratedfilesmessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const RemoveGeneratedFilesMessage &message) -{ - debug.nospace() << "RemoveGeneratedFilesMessage(" - << message.generatedFiles << ")"; - - return debug; -} -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/removegeneratedfilesmessage.h b/src/libs/clangsupport/removegeneratedfilesmessage.h deleted file mode 100644 index 6aebaccb27..0000000000 --- a/src/libs/clangsupport/removegeneratedfilesmessage.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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" - -namespace ClangBackEnd { - -class RemoveGeneratedFilesMessage -{ -public: - RemoveGeneratedFilesMessage() = default; - RemoveGeneratedFilesMessage(FilePaths &&generatedFiles) - : generatedFiles(std::move(generatedFiles)) - {} - - FilePaths takeGeneratedFiles() - { - return std::move(generatedFiles); - } - - friend QDataStream &operator<<(QDataStream &out, const RemoveGeneratedFilesMessage &message) - { - out << message.generatedFiles; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RemoveGeneratedFilesMessage &message) - { - in >> message.generatedFiles; - - return in; - } - - friend bool operator==(const RemoveGeneratedFilesMessage &first, - const RemoveGeneratedFilesMessage &second) - { - return first.generatedFiles == second.generatedFiles; - } - - RemoveGeneratedFilesMessage clone() const - { - return *this; - } - -public: - FilePaths generatedFiles; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RemoveGeneratedFilesMessage &message); - -DECLARE_MESSAGE(RemoveGeneratedFilesMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/removeprojectpartsmessage.h b/src/libs/clangsupport/removeprojectpartsmessage.h deleted file mode 100644 index ef80b52178..0000000000 --- a/src/libs/clangsupport/removeprojectpartsmessage.h +++ /dev/null @@ -1,73 +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 "projectpartcontainer.h" - -namespace ClangBackEnd { - -class RemoveProjectPartsMessage -{ -public: - RemoveProjectPartsMessage() = default; - RemoveProjectPartsMessage(ProjectPartIds &&projectsPartIds) - : projectsPartIds(std::move(projectsPartIds)) - {} - - ProjectPartIds takeProjectsPartIds() { return std::move(projectsPartIds); } - - friend QDataStream &operator<<(QDataStream &out, const RemoveProjectPartsMessage &message) - { - out << message.projectsPartIds; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RemoveProjectPartsMessage &message) - { - in >> message.projectsPartIds; - - return in; - } - - friend bool operator==(const RemoveProjectPartsMessage &first, - const RemoveProjectPartsMessage &second) - { - return first.projectsPartIds == second.projectsPartIds; - } - - RemoveProjectPartsMessage clone() const - { - return *this; - } - -public: - ProjectPartIds projectsPartIds; -}; - -DECLARE_MESSAGE(RemoveProjectPartsMessage) - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestsourcerangesanddiagnosticsforquerymessage.cpp b/src/libs/clangsupport/requestsourcerangesanddiagnosticsforquerymessage.cpp deleted file mode 100644 index ddad385c37..0000000000 --- a/src/libs/clangsupport/requestsourcerangesanddiagnosticsforquerymessage.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 "requestsourcerangesanddiagnosticsforquerymessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const RequestSourceRangesAndDiagnosticsForQueryMessage &message) -{ - debug.nospace() << "RequestSourceRangesAndDiagnosticsForQuery(" - << message.query << ", " - << message.source << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestsourcerangesanddiagnosticsforquerymessage.h b/src/libs/clangsupport/requestsourcerangesanddiagnosticsforquerymessage.h deleted file mode 100644 index 7204305e66..0000000000 --- a/src/libs/clangsupport/requestsourcerangesanddiagnosticsforquerymessage.h +++ /dev/null @@ -1,89 +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 "filecontainerv2.h" - -namespace ClangBackEnd { - -class RequestSourceRangesAndDiagnosticsForQueryMessage -{ -public: - RequestSourceRangesAndDiagnosticsForQueryMessage() = default; - RequestSourceRangesAndDiagnosticsForQueryMessage(Utils::SmallString &&query, - V2::FileContainer &&source) - : query(std::move(query)), - source(std::move(source)) - - {} - - V2::FileContainer takeSource() - { - return std::move(source); - } - - Utils::SmallString takeQuery() - { - return std::move(query); - } - - friend QDataStream &operator<<(QDataStream &out, const RequestSourceRangesAndDiagnosticsForQueryMessage &message) - { - out << message.query; - out << message.source; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestSourceRangesAndDiagnosticsForQueryMessage &message) - { - in >> message.query; - in >> message.source; - - return in; - } - - friend bool operator==(const RequestSourceRangesAndDiagnosticsForQueryMessage &first, - const RequestSourceRangesAndDiagnosticsForQueryMessage &second) - { - return first.query == second.query - && first.source == second.source; - } - - RequestSourceRangesAndDiagnosticsForQueryMessage clone() const - { - return *this; - } - -public: - Utils::SmallString query; - V2::FileContainer source; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestSourceRangesAndDiagnosticsForQueryMessage &message); - -DECLARE_MESSAGE(RequestSourceRangesAndDiagnosticsForQueryMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestsourcerangesforquerymessage.cpp b/src/libs/clangsupport/requestsourcerangesforquerymessage.cpp deleted file mode 100644 index 0da4ece0c7..0000000000 --- a/src/libs/clangsupport/requestsourcerangesforquerymessage.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "requestsourcerangesforquerymessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const RequestSourceRangesForQueryMessage &message) -{ - debug.nospace() << "RequestSourceRangesForQueryMessage(" - << message.query << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/requestsourcerangesforquerymessage.h b/src/libs/clangsupport/requestsourcerangesforquerymessage.h deleted file mode 100644 index f68354cc7a..0000000000 --- a/src/libs/clangsupport/requestsourcerangesforquerymessage.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filecontainerv2.h" - -namespace ClangBackEnd { - -class RequestSourceRangesForQueryMessage -{ -public: - RequestSourceRangesForQueryMessage() = default; - RequestSourceRangesForQueryMessage(Utils::SmallString &&query, - std::vector<V2::FileContainer> &&sources, - std::vector<V2::FileContainer> &&unsavedContent) - : query(std::move(query)), - sources(std::move(sources)), - unsavedContent(std::move(unsavedContent)) - - {} - - std::vector<V2::FileContainer> takeSources() - { - return std::move(sources); - } - - std::vector<V2::FileContainer> takeUnsavedContent() - { - return std::move(unsavedContent); - } - - Utils::SmallString takeQuery() - { - return std::move(query); - } - - friend QDataStream &operator<<(QDataStream &out, const RequestSourceRangesForQueryMessage &message) - { - out << message.query; - out << message.sources; - out << message.unsavedContent; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestSourceRangesForQueryMessage &message) - { - in >> message.query; - in >> message.sources; - in >> message.unsavedContent; - - return in; - } - - friend bool operator==(const RequestSourceRangesForQueryMessage &first, - const RequestSourceRangesForQueryMessage &second) - { - return first.query == second.query - && first.sources == second.sources - && first.unsavedContent == second.unsavedContent; - } - - RequestSourceRangesForQueryMessage clone() const - { - return *this; - } - -public: - Utils::SmallString query; - std::vector<V2::FileContainer> sources; - std::vector<V2::FileContainer> unsavedContent; -}; - - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestSourceRangesForQueryMessage &message); - -DECLARE_MESSAGE(RequestSourceRangesForQueryMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourceentry.h b/src/libs/clangsupport/sourceentry.h deleted file mode 100644 index 4912b367c3..0000000000 --- a/src/libs/clangsupport/sourceentry.h +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 <filepathid.h> - -#include <vector> - -namespace ClangBackEnd { - -enum class SourceType : unsigned char { - TopProjectInclude, - TopSystemInclude, - UserInclude, - ProjectInclude, - SystemInclude, - Source -}; - -enum class HasMissingIncludes : unsigned char { No, Yes }; - -class TimeStamp -{ - using int64 = long long; -public: - TimeStamp() = default; - TimeStamp(int64 value) - : value(value) - {} - - operator int64() const - { - return value; - } - - int64 value = -1; -}; - -class PrecompiledHeaderTimeStamps -{ -public: - PrecompiledHeaderTimeStamps() = default; - PrecompiledHeaderTimeStamps(long long projectTimeStamp, long long systemTimeStamp) - : project(projectTimeStamp) - , system(systemTimeStamp) - {} - - TimeStamp project; - TimeStamp system; -}; - -class SourceTimeStamp -{ - using int64 = long long; -public: - SourceTimeStamp(int sourceId, int64 lastModified) - : timeStamp(lastModified) - , sourceId(sourceId) - {} - - SourceTimeStamp(FilePathId sourceId, TimeStamp lastModified) - : timeStamp(lastModified) - , sourceId(sourceId) - {} - - friend bool operator<(SourceTimeStamp first, SourceTimeStamp second) - { - return first.sourceId < second.sourceId; - } - - friend bool operator<(SourceTimeStamp first, FilePathId second) - { - return first.sourceId < second; - } - - friend bool operator<(FilePathId first, SourceTimeStamp second) - { - return first < second.sourceId; - } - - friend bool operator==(SourceTimeStamp first, SourceTimeStamp second) - { - return first.sourceId == second.sourceId && first.timeStamp == second.timeStamp; - } - - friend bool operator!=(SourceTimeStamp first, SourceTimeStamp second) - { - return !(first == second); - } - -public: - TimeStamp timeStamp; - FilePathId sourceId; -}; - -using SourceTimeStamps = std::vector<SourceTimeStamp>; - -class SourceEntry -{ - using int64 = long long; - -public: - SourceEntry(int sourceId, int64 timeStamp, int sourceType, int hasMissingIncludes) - : timeStamp(timeStamp) - , sourceId(sourceId) - , sourceType(static_cast<SourceType>(sourceType)) - , hasMissingIncludes(static_cast<HasMissingIncludes>(hasMissingIncludes)) - {} - - SourceEntry(FilePathId sourceId, - SourceType sourceType, - TimeStamp timeStamp, - HasMissingIncludes hasMissingIncludes = HasMissingIncludes::No) - : timeStamp(timeStamp) - , sourceId(sourceId) - , sourceType(sourceType) - , hasMissingIncludes(hasMissingIncludes) - {} - - friend bool operator<(SourceEntry first, SourceEntry second) { - return first.sourceId < second.sourceId; - } - - friend bool operator<(SourceEntry first, FilePathId second) { return first.sourceId < second; } - - friend bool operator<(FilePathId first, SourceEntry second) { return first < second.sourceId; } - - friend bool operator==(SourceEntry first, SourceEntry second) - { - return first.sourceId == second.sourceId && first.sourceType == second.sourceType - && first.timeStamp == second.timeStamp; - } - - friend bool operator!=(SourceEntry first, SourceEntry second) { return !(first == second); } - -public: - TimeStamp timeStamp; - FilePathId sourceId; - SourceType sourceType = SourceType::UserInclude; - HasMissingIncludes hasMissingIncludes = HasMissingIncludes::No; -}; - -using SourceEntries = std::vector<SourceEntry>; -using SourceEntryReference = std::reference_wrapper<SourceEntry>; -using SourceEntryReferences = std::vector<SourceEntryReference>; -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcelocationcontainerv2.cpp b/src/libs/clangsupport/sourcelocationcontainerv2.cpp deleted file mode 100644 index eeb87e7537..0000000000 --- a/src/libs/clangsupport/sourcelocationcontainerv2.cpp +++ /dev/null @@ -1,45 +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 "sourcelocationcontainerv2.h" - -#include <QDebug> - -namespace ClangBackEnd { -namespace V2 { - -QDebug operator<<(QDebug debug, const SourceLocationContainer &container) -{ - debug.nospace() << "SourceLocationContainer(" - << container.line << ", " - << container.column << ", " - << container.offset << ", " - << container.filePathId.filePathId - << ")"; - return debug; -} - -} // namespace V2 -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcelocationcontainerv2.h b/src/libs/clangsupport/sourcelocationcontainerv2.h deleted file mode 100644 index 36c95377cc..0000000000 --- a/src/libs/clangsupport/sourcelocationcontainerv2.h +++ /dev/null @@ -1,106 +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 "filepathid.h" - -#include <QDataStream> - -namespace ClangBackEnd { -namespace V2 { - -class SourceLocationContainer -{ -public: - SourceLocationContainer() = default; - SourceLocationContainer(FilePathId filePathId, - uint line, - uint column, - uint offset) - : filePathId(filePathId), - line(line), - column(column), - offset(offset) - { - } - - friend QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container) - { - out << container.filePathId; - out << container.line; - out << container.column; - out << container.offset; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container) - { - in >> container.filePathId; - in >> container.line; - in >> container.column; - in >> container.offset; - - return in; - } - - friend bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second) - { - return !(first != second); - } - - friend bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second) - { - return first.line != second.line - || first.column != second.column - || first.filePathId != second.filePathId; - } - - friend bool operator<(const SourceLocationContainer &first, - const SourceLocationContainer &second) - { - return std::tie(first.filePathId, first.line, first.column) - < std::tie(second.filePathId, second.line, second.column); - } - - SourceLocationContainer clone() const - { - return *this; - } - -public: - FilePathId filePathId; - uint line = 1; - uint column = 1; - uint offset = 0; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationContainer &container); - -} // namespace V2 -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/sourcelocationscontainer.cpp b/src/libs/clangsupport/sourcelocationscontainer.cpp index 72f49e896c..19573ddbd1 100644 --- a/src/libs/clangsupport/sourcelocationscontainer.cpp +++ b/src/libs/clangsupport/sourcelocationscontainer.cpp @@ -34,7 +34,7 @@ QDebug operator<<(QDebug debug, const SourceLocationsContainer &container) debug.nospace() << "SourceLocationsContainer(["; for (const auto &sourceLocation: container.sourceLocationContainers()) { debug.nospace() << "(" - << sourceLocation.filePathId << "," + << sourceLocation.filePath << "," << sourceLocation.line << "," << sourceLocation.column << "), "; } diff --git a/src/libs/clangsupport/sourcelocationscontainer.h b/src/libs/clangsupport/sourcelocationscontainer.h index 4fc247e0f9..0be15acf90 100644 --- a/src/libs/clangsupport/sourcelocationscontainer.h +++ b/src/libs/clangsupport/sourcelocationscontainer.h @@ -25,21 +25,21 @@ #pragma once -#include "sourcelocationcontainerv2.h" +#include "sourcelocationcontainer.h" #include <utils/smallstringio.h> namespace ClangBackEnd { -class SourceLocationsContainer +class CLANGSUPPORT_EXPORT SourceLocationsContainer { public: SourceLocationsContainer() = default; - SourceLocationsContainer(std::vector<V2::SourceLocationContainer> &&sourceLocationContainers) + SourceLocationsContainer(std::vector<SourceLocationContainer> &&sourceLocationContainers) : m_sourceLocationContainers(std::move(sourceLocationContainers)) {} - const std::vector<V2::SourceLocationContainer> &sourceLocationContainers() const + const std::vector<SourceLocationContainer> &sourceLocationContainers() const { return m_sourceLocationContainers; } @@ -49,9 +49,9 @@ public: return !m_sourceLocationContainers.empty(); } - void insertSourceLocation(FilePathId filePathId, uint line, uint column, uint offset) + void insertSourceLocation(const Utf8String &filePath, int line, int column) { - m_sourceLocationContainers.emplace_back(filePathId, line, column, offset); + m_sourceLocationContainers.emplace_back(filePath, line, column); } void reserve(std::size_t size) @@ -83,7 +83,7 @@ public: return *this; } - std::vector<V2::SourceLocationContainer> m_sourceLocationContainers; + std::vector<SourceLocationContainer> m_sourceLocationContainers; }; CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationsContainer &container); diff --git a/src/libs/clangsupport/sourcerangecontainerv2.cpp b/src/libs/clangsupport/sourcerangecontainerv2.cpp deleted file mode 100644 index 54bdbb5ea3..0000000000 --- a/src/libs/clangsupport/sourcerangecontainerv2.cpp +++ /dev/null @@ -1,44 +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 "sourcerangecontainerv2.h" - -#include <QDebug> - -namespace ClangBackEnd { -namespace V2 { - -QDebug operator<<(QDebug debug, const SourceRangeContainer &container) -{ - debug.nospace() << "SourceRangeContainer(" - << container.start << ", " - << container.end - << ")"; - - return debug; -} - -} // namespace V2 -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangecontainerv2.h b/src/libs/clangsupport/sourcerangecontainerv2.h deleted file mode 100644 index 7f0127a4de..0000000000 --- a/src/libs/clangsupport/sourcerangecontainerv2.h +++ /dev/null @@ -1,104 +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 "sourcelocationcontainerv2.h" - -#include <tuple> - -namespace ClangBackEnd { -namespace V2 { - -class SourceRangeContainer -{ -public: - SourceRangeContainer() = default; - SourceRangeContainer(SourceLocationContainer start, - SourceLocationContainer end) - : start(start), - end(end) - { - } - - SourceRangeContainer(FilePathId filePathId, - uint startLine, - uint startColumn, - uint startOffset, - uint endLine, - uint endColumn, - uint endOffset) - : start(filePathId, startLine, startColumn, startOffset), - end(filePathId, endLine, endColumn, endOffset) - { - } - - FilePathId filePathId() const - { - return start.filePathId; - } - - friend QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container) - { - out << container.start; - out << container.end; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container) - { - in >> container.start; - in >> container.end; - - return in; - } - - friend bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second) - { - return first.start == second.start && first.end == second.end; - } - - friend bool operator<(const SourceRangeContainer &first, - const SourceRangeContainer &second) - { - return std::tie(first.start, first.end) < std::tie(second.start, second.end); - } - - SourceRangeContainer clone() const - { - return *this; - } - -public: - SourceLocationContainer start; - SourceLocationContainer end; -}; - -using SourceRangeContainers = std::vector<SourceRangeContainer>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangeContainer &container); -} // namespace V2 -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangesanddiagnosticsforquerymessage.cpp b/src/libs/clangsupport/sourcerangesanddiagnosticsforquerymessage.cpp deleted file mode 100644 index cc61fde9dd..0000000000 --- a/src/libs/clangsupport/sourcerangesanddiagnosticsforquerymessage.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 "sourcerangesanddiagnosticsforquerymessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const SourceRangesAndDiagnosticsForQueryMessage &message) -{ - debug.nospace() << "SourceRangesAndDiagnosticsForQueryMessage(" - << message.sourceRanges << ", " - << message.diagnostics << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangesanddiagnosticsforquerymessage.h b/src/libs/clangsupport/sourcerangesanddiagnosticsforquerymessage.h deleted file mode 100644 index e43ec30811..0000000000 --- a/src/libs/clangsupport/sourcerangesanddiagnosticsforquerymessage.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 "sourcerangescontainer.h" -#include "dynamicastmatcherdiagnosticcontainer.h" - -#include <utils/smallstring.h> - -namespace ClangBackEnd { - -class SourceRangesAndDiagnosticsForQueryMessage -{ -public: - SourceRangesAndDiagnosticsForQueryMessage() = default; - SourceRangesAndDiagnosticsForQueryMessage(SourceRangesContainer &&sourceRangesContainer, - std::vector<DynamicASTMatcherDiagnosticContainer> &&diagnosticContainers) - : sourceRanges(std::move(sourceRangesContainer)), - diagnostics(std::move(diagnosticContainers)) - {} - - SourceRangesContainer takeSourceRanges() - { - return std::move(sourceRanges); - } - - friend QDataStream &operator<<(QDataStream &out, const SourceRangesAndDiagnosticsForQueryMessage &message) - { - out << message.sourceRanges; - out << message.diagnostics; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceRangesAndDiagnosticsForQueryMessage &message) - { - in >> message.sourceRanges; - in >> message.diagnostics; - - return in; - } - - friend bool operator==(const SourceRangesAndDiagnosticsForQueryMessage &first, const SourceRangesAndDiagnosticsForQueryMessage &second) - { - return first.sourceRanges == second.sourceRanges - && first.diagnostics == second.diagnostics; - } - - SourceRangesAndDiagnosticsForQueryMessage clone() const - { - return SourceRangesAndDiagnosticsForQueryMessage(sourceRanges.clone(), - Utils::clone(diagnostics)); - } - -public: - SourceRangesContainer sourceRanges; - DynamicASTMatcherDiagnosticContainers diagnostics; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangesAndDiagnosticsForQueryMessage &message); - -DECLARE_MESSAGE(SourceRangesAndDiagnosticsForQueryMessage) - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangescontainer.cpp b/src/libs/clangsupport/sourcerangescontainer.cpp deleted file mode 100644 index bba6a62621..0000000000 --- a/src/libs/clangsupport/sourcerangescontainer.cpp +++ /dev/null @@ -1,46 +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 "sourcerangescontainer.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const SourceRangesContainer &container) -{ - debug.nospace() << "SourceRangesContainer(["; - for (const auto &sourceRangeWithText: container.sourceRangeWithTextContainers) { - debug.nospace() << "(" - << sourceRangeWithText.start.line << "," - << sourceRangeWithText.start.column << "), (" - << sourceRangeWithText.end.line << "," - << sourceRangeWithText.end.column << "), "; - } - - debug.nospace() << "])"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangescontainer.h b/src/libs/clangsupport/sourcerangescontainer.h deleted file mode 100644 index f0bac03485..0000000000 --- a/src/libs/clangsupport/sourcerangescontainer.h +++ /dev/null @@ -1,106 +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 "sourcerangewithtextcontainer.h" - -#include <utils/smallstringvector.h> - -namespace ClangBackEnd { - -class SourceRangesContainer -{ -public: - SourceRangesContainer() = default; - SourceRangesContainer(SourceRangeWithTextContainers &&sourceRangeWithTextContainers) - : sourceRangeWithTextContainers(std::move(sourceRangeWithTextContainers)) - {} - - SourceRangeWithTextContainers takeSourceRangeWithTextContainers() - { - return std::move(sourceRangeWithTextContainers); - } - - bool hasContent() const - { - return !sourceRangeWithTextContainers.empty(); - } - - void insertSourceRange(FilePathId filePathId, - uint startLine, - uint startColumn, - uint startOffset, - uint endLine, - uint endColumn, - uint endOffset, - Utils::SmallString &&text) - { - sourceRangeWithTextContainers.emplace_back(filePathId, - startLine, - startColumn, - startOffset, - endLine, - endColumn, - endOffset, - std::move(text)); - } - - void reserve(std::size_t size) - { - sourceRangeWithTextContainers.reserve(size); - } - - friend QDataStream &operator<<(QDataStream &out, const SourceRangesContainer &container) - { - out << container.sourceRangeWithTextContainers; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceRangesContainer &container) - { - in >> container.sourceRangeWithTextContainers; - - return in; - } - - friend bool operator==(const SourceRangesContainer &first, const SourceRangesContainer &second) - { - return first.sourceRangeWithTextContainers == second.sourceRangeWithTextContainers; - } - - SourceRangesContainer clone() const - { - return *this; - } - -public: - SourceRangeWithTextContainers sourceRangeWithTextContainers; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangesContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangesforquerymessage.cpp b/src/libs/clangsupport/sourcerangesforquerymessage.cpp deleted file mode 100644 index 6de24ac521..0000000000 --- a/src/libs/clangsupport/sourcerangesforquerymessage.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "sourcerangesforquerymessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const SourceRangesForQueryMessage &message) -{ - debug.nospace() << "SourceRangesForQueryMessage(" - << message.sourceRanges << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangesforquerymessage.h b/src/libs/clangsupport/sourcerangesforquerymessage.h deleted file mode 100644 index a3989a13fc..0000000000 --- a/src/libs/clangsupport/sourcerangesforquerymessage.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "sourcerangescontainer.h" -#include "dynamicastmatcherdiagnosticcontainer.h" - -#include <utils/smallstring.h> - -namespace ClangBackEnd { - -class SourceRangesForQueryMessage -{ -public: - SourceRangesForQueryMessage() = default; - SourceRangesForQueryMessage(SourceRangesContainer &&sourceRanges) - : sourceRanges(std::move(sourceRanges)) - {} - - friend QDataStream &operator<<(QDataStream &out, const SourceRangesForQueryMessage &message) - { - out << message.sourceRanges; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceRangesForQueryMessage &message) - { - in >> message.sourceRanges; - - return in; - } - - friend bool operator==(const SourceRangesForQueryMessage &first, const SourceRangesForQueryMessage &second) - { - return first.sourceRanges == second.sourceRanges; - } - - SourceRangesForQueryMessage clone() const - { - return *this; - } - -public: - SourceRangesContainer sourceRanges; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangesForQueryMessage &message); - -DECLARE_MESSAGE(SourceRangesForQueryMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangewithtextcontainer.cpp b/src/libs/clangsupport/sourcerangewithtextcontainer.cpp deleted file mode 100644 index 0a7a167f74..0000000000 --- a/src/libs/clangsupport/sourcerangewithtextcontainer.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 "sourcerangewithtextcontainer.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const SourceRangeWithTextContainer &container) -{ - debug.nospace() << "SourceRangeWithTextContainer(" - << container.start << ", " - << container.end << ", " - << container.text - << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangewithtextcontainer.h b/src/libs/clangsupport/sourcerangewithtextcontainer.h deleted file mode 100644 index fd99797b64..0000000000 --- a/src/libs/clangsupport/sourcerangewithtextcontainer.h +++ /dev/null @@ -1,112 +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 <sourcerangecontainerv2.h> - -#include <utils/smallstringio.h> - -namespace ClangBackEnd { - -class SourceRangeWithTextContainer : public V2::SourceRangeContainer -{ -public: - SourceRangeWithTextContainer() = default; - SourceRangeWithTextContainer(FilePathId filePathId, - uint startLine, - uint startColumn, - uint startOffset, - uint endLine, - uint endColumn, - uint endOffset, - Utils::SmallString &&text) - : V2::SourceRangeContainer(filePathId, - startLine, - startColumn, - startOffset, - endLine, - endColumn, - endOffset), - text(std::move(text)) - {} - - SourceRangeWithTextContainer(V2::SourceRangeContainer &&base, - Utils::SmallString &&text) - : V2::SourceRangeContainer(std::move(base)), - text(std::move(text)) - { - } - - using V2::SourceRangeContainer::start; - using V2::SourceRangeContainer::end; - using V2::SourceRangeContainer::filePathId; - - friend QDataStream &operator<<(QDataStream &out, const SourceRangeWithTextContainer &container) - { - out << container.base(); - out << container.text; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceRangeWithTextContainer &container) - { - in >> container.base(); - in >> container.text; - - return in; - } - - friend bool operator==(const SourceRangeWithTextContainer &first, - const SourceRangeWithTextContainer &second) - { - return first.base() == second.base() && first.text == second.text; - } - - V2::SourceRangeContainer &base() - { - return *this; - } - - const V2::SourceRangeContainer &base() const - { - return *this; - } - - SourceRangeWithTextContainer clone() const - { - return *this; - } - -public: - Utils::SmallString text; -}; - -using SourceRangeWithTextContainers = std::vector<SourceRangeWithTextContainer>; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangeWithTextContainer &container); -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/stringcache.h b/src/libs/clangsupport/stringcache.h deleted file mode 100644 index 87b92b4084..0000000000 --- a/src/libs/clangsupport/stringcache.h +++ /dev/null @@ -1,426 +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 "stringcachealgorithms.h" -#include "stringcacheentry.h" -#include "stringcachefwd.h" - -#include <utils/algorithm.h> -#include <utils/optional.h> -#include <utils/set_algorithm.h> -#include <utils/smallstringfwd.h> - -#include <QReadWriteLock> - -#include <algorithm> -#include <shared_mutex> -#include <vector> - -namespace ClangBackEnd { - -class StringCacheException : public std::exception -{ - const char *what() const noexcept override - { - return "StringCache entries are in invalid state."; - } -}; - -class NonLockingMutex -{ -public: - constexpr NonLockingMutex() noexcept {} - NonLockingMutex(const NonLockingMutex&) = delete; - NonLockingMutex& operator=(const NonLockingMutex&) = delete; - void lock() {} - void unlock() {} - void lock_shared() {} - void unlock_shared() {} -}; - -class SharedMutex -{ -public: - SharedMutex() = default; - - SharedMutex(const SharedMutex&) = delete; - SharedMutex& operator=(const SharedMutex&) = delete; - - void lock() - { - m_mutex.lockForWrite(); - } - - void unlock() - { - m_mutex.unlock(); - } - - void lock_shared() - { - m_mutex.lockForRead(); - } - - void unlock_shared() - { - m_mutex.unlock(); - } -private: - QReadWriteLock m_mutex; -}; - -template<typename StringType, - typename StringViewType, - typename IndexType, - typename Mutex, - typename Compare, - Compare compare = Utils::compare, - typename CacheEntry = StringCacheEntry<StringType, StringViewType, IndexType>> -class StringCache -{ - template<typename T, typename V, typename I, typename M, typename C, C c, typename CE> - friend class StringCache; - - using StringResultType = std:: - conditional_t<std::is_base_of<NonLockingMutex, Mutex>::value, StringViewType, StringType>; - -public: - using MutexType = Mutex; - using CacheEntries = std::vector<CacheEntry>; - using const_iterator = typename CacheEntries::const_iterator; - using Found = ClangBackEnd::Found<const_iterator>; - - StringCache(std::size_t reserveSize = 1024) - { - m_strings.reserve(reserveSize); - m_indices.reserve(reserveSize); - } - - StringCache(const StringCache &other) - : m_strings(other.m_strings) - , m_indices(other.m_indices) - {} - - template<typename Cache> - Cache clone() - { - Cache cache; - cache.m_strings = m_strings; - cache.m_indices = m_indices; - - return cache; - } - - StringCache(StringCache &&other) - : m_strings(std::move(other.m_strings)) - , m_indices(std::move(other.m_indices)) - {} - - StringCache &operator=(StringCache &&other) - { - m_strings = std::move(other.m_strings); - m_indices = std::move(other.m_indices); - - return *this; - } - - void populate(CacheEntries &&entries) - { - uncheckedPopulate(std::move(entries)); - - checkEntries(); - } - - void uncheckedPopulate(CacheEntries &&entries) - { - std::sort(entries.begin(), entries.end(), [](StringViewType first, StringViewType second) { - return compare(first, second) < 0; - }); - - m_strings = std::move(entries); - - int max_id = 0; - - auto found = std::max_element(m_strings.begin(), - m_strings.end(), - [](const auto &first, const auto &second) { - return first.id < second.id; - }); - - if (found != m_strings.end()) - max_id = found->id + 1; - - m_indices.resize(max_id, -1); - - updateIndices(); - } - - template<typename Function> - void addStrings(std::vector<StringViewType> &&strings, Function storageFunction) - { - auto less = [](StringViewType first, StringViewType second) { - return compare(first, second) < 0; - }; - - std::sort(strings.begin(), strings.end(), less); - - strings.erase(std::unique(strings.begin(), strings.end()), strings.end()); - - CacheEntries newCacheEntries; - newCacheEntries.reserve(strings.size()); - - std::set_difference(strings.begin(), - strings.end(), - m_strings.begin(), - m_strings.end(), - Utils::make_iterator([&](StringViewType newString) { - IndexType index = storageFunction(newString); - newCacheEntries.emplace_back(newString, index); - }), - less); - - if (newCacheEntries.size()) { - auto found = std::max_element(newCacheEntries.begin(), - newCacheEntries.end(), - [](const auto &first, const auto &second) { - return first.id < second.id; - }); - - int max_id = found->id + 1; - - if (max_id > int(m_indices.size())) - m_indices.resize(max_id, -1); - - CacheEntries mergedCacheEntries; - mergedCacheEntries.reserve(newCacheEntries.size() + m_strings.size()); - - std::merge(std::make_move_iterator(m_strings.begin()), - std::make_move_iterator(m_strings.end()), - std::make_move_iterator(newCacheEntries.begin()), - std::make_move_iterator(newCacheEntries.end()), - std::back_inserter(mergedCacheEntries), - less); - - m_strings = std::move(mergedCacheEntries); - - updateIndices(); - } - } - - IndexType stringId(StringViewType stringView) - { - std::shared_lock<Mutex> sharedLock(m_mutex); - Found found = find(stringView); - - if (found.wasFound) - return found.iterator->id; - - sharedLock.unlock(); - std::lock_guard<Mutex> exclusiveLock(m_mutex); - - if (!std::is_base_of<NonLockingMutex, Mutex>::value) - found = find(stringView); - if (!found.wasFound) { - IndexType index = insertString(found.iterator, stringView, IndexType(m_indices.size())); - found.iterator = m_strings.begin() + index; - } - - return found.iterator->id; - } - - template <typename Container> - std::vector<IndexType> stringIds(const Container &strings) - { - std::vector<IndexType> ids; - ids.reserve(strings.size()); - - std::transform(strings.begin(), - strings.end(), - std::back_inserter(ids), - [&] (const auto &string) { return this->stringId(string); }); - - return ids; - } - - template<typename Container, typename Function> - std::vector<IndexType> stringIds(const Container &strings, Function storageFunction) - { - std::vector<IndexType> ids; - ids.reserve(strings.size()); - - std::transform(strings.begin(), - strings.end(), - std::back_inserter(ids), - [&](const auto &string) { return this->stringId(string, storageFunction); }); - - return ids; - } - - std::vector<IndexType> stringIds(std::initializer_list<StringType> strings) - { - return stringIds<std::initializer_list<StringType>>(strings); - } - - template<typename Function> - std::vector<IndexType> stringIds(std::initializer_list<StringType> strings, - Function storageFunction) - { - return stringIds<std::initializer_list<StringType>>(strings, storageFunction); - } - - StringResultType string(IndexType id) const - { - std::shared_lock<Mutex> sharedLock(m_mutex); - - return m_strings.at(m_indices.at(id)).string; - } - - template<typename Function> - StringResultType string(IndexType id, Function storageFunction) - { - std::shared_lock<Mutex> sharedLock(m_mutex); - - if (IndexType(m_indices.size()) > id && m_indices.at(id) >= 0) - return m_strings.at(m_indices.at(id)).string; - - - sharedLock.unlock(); - std::lock_guard<Mutex> exclusiveLock(m_mutex); - IndexType index; - - StringType string{storageFunction(id)}; - index = insertString(find(string).iterator, string, id); - - return m_strings[index].string; - } - - std::vector<StringResultType> strings(const std::vector<IndexType> &ids) const - { - std::shared_lock<Mutex> sharedLock(m_mutex); - - std::vector<StringResultType> strings; - strings.reserve(ids.size()); - - for (IndexType id : ids) - strings.emplace_back(m_strings.at(m_indices.at(id)).string); - - return strings; - } - - bool isEmpty() const - { - return m_strings.empty() && m_indices.empty(); - } - - template<typename Function> - IndexType stringId(StringViewType stringView, Function storageFunction) - { - std::shared_lock<Mutex> sharedLock(m_mutex); - - Found found = find(stringView); - - if (found.wasFound) - return found.iterator->id; - - sharedLock.unlock(); - std::lock_guard<Mutex> exclusiveLock(m_mutex); - - if (!std::is_base_of<NonLockingMutex, Mutex>::value) - found = find(stringView); - if (!found.wasFound) { - IndexType index = insertString(found.iterator, stringView, storageFunction(stringView)); - found.iterator = m_strings.begin() + index; - } - - return found.iterator->id; - } - - Mutex &mutex() const - { - return m_mutex; - } - -private: - void updateIndices() - { - auto begin = m_strings.cbegin(); - for (auto current = begin; current != m_strings.cend(); ++current) - m_indices[current->id] = std::distance(begin, current); - } - - Found find(StringViewType stringView) - { - return findInSorted(m_strings.cbegin(), m_strings.cend(), stringView, compare); - } - - void incrementLargerOrEqualIndicesByOne(IndexType newIndex) - { - std::transform(m_indices.begin(), - m_indices.end(), - m_indices.begin(), - [&] (IndexType index) { - return index >= newIndex ? ++index : index; - }); - } - - void ensureSize(IndexType id) - { - if (m_indices.size() <= std::size_t(id)) - m_indices.resize(id + 1, -1); - } - - IndexType insertString(const_iterator beforeIterator, - StringViewType stringView, - IndexType id) - { - auto inserted = m_strings.emplace(beforeIterator, stringView, id); - - auto newIndex = IndexType(std::distance(m_strings.begin(), inserted)); - - incrementLargerOrEqualIndicesByOne(newIndex); - - ensureSize(id); - m_indices.at(id) = newIndex; - - return newIndex; - } - - void checkEntries() - { - for (const auto &entry : m_strings) { - if (entry.string != string(entry.id) || entry.id != stringId(entry.string)) - throw StringCacheException(); - } - } - -private: - CacheEntries m_strings; - std::vector<IndexType> m_indices; - mutable Mutex m_mutex; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/stringcachealgorithms.h b/src/libs/clangsupport/stringcachealgorithms.h deleted file mode 100644 index 573a692b72..0000000000 --- a/src/libs/clangsupport/stringcachealgorithms.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <utils/smallstringio.h> - -#include <iterator> - -#include <QDebug> - -namespace ClangBackEnd { - -template <typename Iterator> -class Found -{ -public: - Iterator iterator; - bool wasFound; -}; - -template<typename ForwardIterator, - typename Type, - typename Compare> -Found<ForwardIterator> findInSorted(ForwardIterator first, ForwardIterator last, const Type& value, Compare compare) -{ - ForwardIterator current; - using DifferenceType = typename std::iterator_traits<ForwardIterator>::difference_type; - DifferenceType count{std::distance(first, last)}; - DifferenceType step; - - while (count > 0) { - current = first; - step = count / 2; - std::advance(current, step); - auto comparison = compare(*current, value); - if (comparison < 0) { - first = ++current; - count -= step + 1; - } else if (comparison > 0) { - count = step; - } else { - return {current, true}; - } - } - - return {first, false}; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/stringcacheentry.h b/src/libs/clangsupport/stringcacheentry.h deleted file mode 100644 index bbffcdc873..0000000000 --- a/src/libs/clangsupport/stringcacheentry.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 - -namespace ClangBackEnd { - -template<typename StringType, typename StringViewType, typename IndexType> -class StringCacheEntry -{ -public: - StringCacheEntry(StringViewType string, IndexType id) - : string(string) - , id(id) - {} - - operator StringViewType() const { return string; } - friend bool operator==(const StringCacheEntry &first, const StringCacheEntry &second) - { - return first.id == second.id && first.string == second.string; - } - -public: - StringType string; - IndexType id; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/stringcachefwd.h b/src/libs/clangsupport/stringcachefwd.h deleted file mode 100644 index 2059b503b6..0000000000 --- a/src/libs/clangsupport/stringcachefwd.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <utils/smallstringfwd.h> - -namespace ClangBackEnd { - -class NonLockingMutex; - -template<typename StringType, typename StringViewType, typename IndexType, typename Mutex, typename Compare, Compare compare, typename CacheEntry> -class StringCache; -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/updategeneratedfilesmessage.cpp b/src/libs/clangsupport/updategeneratedfilesmessage.cpp deleted file mode 100644 index 9ef71a0df5..0000000000 --- a/src/libs/clangsupport/updategeneratedfilesmessage.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "updategeneratedfilesmessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const UpdateGeneratedFilesMessage &message) -{ - debug.nospace() << "UpdateGeneratedFilesMessage(" - << message.generatedFiles << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/updategeneratedfilesmessage.h b/src/libs/clangsupport/updategeneratedfilesmessage.h deleted file mode 100644 index fabfda0125..0000000000 --- a/src/libs/clangsupport/updategeneratedfilesmessage.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "filecontainerv2.h" - -namespace ClangBackEnd { - -class UpdateGeneratedFilesMessage -{ -public: - UpdateGeneratedFilesMessage() = default; - UpdateGeneratedFilesMessage(V2::FileContainers &&generatedFiles) - : generatedFiles(std::move(generatedFiles)) - {} - - V2::FileContainers takeGeneratedFiles() - { - return std::move(generatedFiles); - } - - friend QDataStream &operator<<(QDataStream &out, const UpdateGeneratedFilesMessage &message) - { - out << message.generatedFiles; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, UpdateGeneratedFilesMessage &message) - { - in >> message.generatedFiles; - - return in; - } - - friend bool operator==(const UpdateGeneratedFilesMessage &first, - const UpdateGeneratedFilesMessage &second) - { - return first.generatedFiles == second.generatedFiles; - } - - UpdateGeneratedFilesMessage clone() const - { - return *this; - } - -public: - V2::FileContainers generatedFiles; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UpdateGeneratedFilesMessage &message); - -DECLARE_MESSAGE(UpdateGeneratedFilesMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/updateprojectpartsmessage.cpp b/src/libs/clangsupport/updateprojectpartsmessage.cpp deleted file mode 100644 index 76e56405bc..0000000000 --- a/src/libs/clangsupport/updateprojectpartsmessage.cpp +++ /dev/null @@ -1,38 +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 "updateprojectpartsmessage.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const UpdateProjectPartsMessage &message) -{ - debug.nospace() << "UpdateProjectPartsMessage(" - << message.projectsParts << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/updateprojectpartsmessage.h b/src/libs/clangsupport/updateprojectpartsmessage.h deleted file mode 100644 index b1c6ca1f61..0000000000 --- a/src/libs/clangsupport/updateprojectpartsmessage.h +++ /dev/null @@ -1,85 +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 "filecontainerv2.h" -#include "projectpartcontainer.h" - -namespace ClangBackEnd { - -class UpdateProjectPartsMessage -{ -public: - UpdateProjectPartsMessage() = default; - UpdateProjectPartsMessage(ProjectPartContainers &&projectsParts, - Utils::SmallStringVector &&toolChainArguments) - : projectsParts(std::move(projectsParts)) - , toolChainArguments(toolChainArguments) - {} - - ProjectPartContainers takeProjectsParts() - { - return std::move(projectsParts); - } - - friend QDataStream &operator<<(QDataStream &out, const UpdateProjectPartsMessage &message) - { - out << message.projectsParts; - out << message.toolChainArguments; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, UpdateProjectPartsMessage &message) - { - in >> message.projectsParts; - in >> message.toolChainArguments; - - return in; - } - - friend bool operator==(const UpdateProjectPartsMessage &first, - const UpdateProjectPartsMessage &second) - { - return first.projectsParts == second.projectsParts - && first.toolChainArguments == second.toolChainArguments; - } - - UpdateProjectPartsMessage clone() const - { - return *this; - } - -public: - ProjectPartContainers projectsParts; - Utils::SmallStringVector toolChainArguments; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UpdateProjectPartsMessage &message); - -DECLARE_MESSAGE(UpdateProjectPartsMessage) - -} // namespace ClangBackEnd |