diff options
author | Marco Bubke <marco.bubke@qt.io> | 2018-09-11 17:02:45 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-09-24 14:33:05 +0000 |
commit | 4e6d09d8e1e9ba776ee20000d5a39b46ce2c25af (patch) | |
tree | 423e880fb98d221db033127d51917942854c7b92 /src/tools/clangrefactoringbackend/source/symbolindexertaskqueue.cpp | |
parent | a334650953880e29219e28bda89b4136875f3dc2 (diff) | |
download | qt-creator-4e6d09d8e1e9ba776ee20000d5a39b46ce2c25af.tar.gz |
Clang: Reuse thread based pipeline for pch creation
The pch creation so far used signal and slots but there was no explicit
pipeline. This patch is introducing the same architecture like the
refactoring plugin. It is filtering out older project parts from the
pipeline.
Change-Id: Iaa6bd2ca1272231b97ebe1f5f7b2ce8e43bc590c
Task-number: QTCREATORBUG-21111
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/tools/clangrefactoringbackend/source/symbolindexertaskqueue.cpp')
-rw-r--r-- | src/tools/clangrefactoringbackend/source/symbolindexertaskqueue.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexertaskqueue.cpp b/src/tools/clangrefactoringbackend/source/symbolindexertaskqueue.cpp deleted file mode 100644 index bb891467a6..0000000000 --- a/src/tools/clangrefactoringbackend/source/symbolindexertaskqueue.cpp +++ /dev/null @@ -1,71 +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 "symbolindexertaskqueue.h" - -#include <symbolindexertaskschedulerinterface.h> - -#include <utils/algorithm.h> - -namespace ClangBackEnd { - -void SymbolIndexerTaskQueue::addOrUpdateTasks(std::vector<SymbolIndexerTask> &&tasks) -{ - auto merge = [] (SymbolIndexerTask &&first, SymbolIndexerTask &&second) { - first.callable = std::move(second.callable); - - return std::move(first); - }; - - m_tasks = Utils::setUnionMerge<std::vector<SymbolIndexerTask>>(tasks, m_tasks, merge); -} - -void SymbolIndexerTaskQueue::removeTasks(const std::vector<int> &projectPartIds) -{ - auto shouldBeRemoved = [&] (const SymbolIndexerTask& task) { - return std::binary_search(projectPartIds.begin(), projectPartIds.end(), task.projectPartId); - }; - - auto newEnd = std::remove_if(m_tasks.begin(), m_tasks.end(), shouldBeRemoved); - - m_tasks.erase(newEnd, m_tasks.end()); -} - -const std::vector<SymbolIndexerTask> &SymbolIndexerTaskQueue::tasks() const -{ - return m_tasks; -} - -void SymbolIndexerTaskQueue::processTasks() -{ - int taskCount = m_symbolIndexerScheduler.freeSlots(); - - auto newEnd = std::prev(m_tasks.end(), std::min<int>(taskCount, int(m_tasks.size()))); - m_symbolIndexerScheduler.addTasks({std::make_move_iterator(newEnd), - std::make_move_iterator(m_tasks.end())}); - m_tasks.erase(newEnd, m_tasks.end()); -} - -} // namespace ClangBackEnd |