logic: improved "prepare indexing" performance for cxx sourcegroups

* improved performance of "prepare indexing" step for all cxx source groups except empty
* unified code for filtering to contained file paths of source groups
* cleaned up code of SourceGroupFactoryModules
This commit is contained in:
mlangkabel
2018-07-31 14:17:14 +02:00
parent 445e7f339e
commit 40bd5ceb5a
13 changed files with 108 additions and 146 deletions
@@ -6,6 +6,7 @@
#include "utility/messaging/type/MessageStatus.h"
#include "utility/codeblocks/CodeblocksProject.h"
#include "utility/utility.h"
#include "utility/utilitySourceGroupCxx.h"
#include "Application.h"
SourceGroupCxxCodeblocks::SourceGroupCxxCodeblocks(std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings)
@@ -37,46 +38,12 @@ bool SourceGroupCxxCodeblocks::prepareIndexing()
std::set<FilePath> SourceGroupCxxCodeblocks::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
{
std::set<FilePath> containedFilePaths;
const std::set<FilePath> indexedPaths = utility::concat(
getAllSourceFilePaths(),
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute())
return utility::filterToContainedFilePaths(
filePaths,
getAllSourceFilePaths(),
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()),
m_settings->getExcludeFiltersExpandedAndAbsolute()
);
const std::vector<FilePathFilter> excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute();
for (const FilePath& filePath : filePaths)
{
bool isInIndexedPaths = false;
for (const FilePath& indexedPath : indexedPaths)
{
if (indexedPath == filePath || indexedPath.contains(filePath))
{
isInIndexedPaths = true;
break;
}
}
if (isInIndexedPaths)
{
for (const FilePathFilter& excludeFilter : excludeFilters)
{
if (excludeFilter.isMatching(filePath))
{
isInIndexedPaths = false;
break;
}
}
}
if (isInIndexedPaths)
{
containedFilePaths.insert(filePath);
}
}
return containedFilePaths;
}
std::set<FilePath> SourceGroupCxxCodeblocks::getAllSourceFilePaths() const