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
+8 -33
View File
@@ -8,6 +8,7 @@
#include "settings/SourceGroupSettingsWithCStandard.h"
#include "utility/file/FileManager.h"
#include "utility/utility.h"
#include "utility/utilitySourceGroupCxx.h"
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings)
: m_settings(settings)
@@ -16,8 +17,6 @@ SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx>
std::set<FilePath> SourceGroupCxxEmpty::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
{
std::set<FilePath> containedFilePaths;
std::vector<FilePath> indexedPaths;
std::vector<FilePathFilter> excludeFilters;
if (std::shared_ptr<SourceGroupSettingsCEmpty> settings =
@@ -33,36 +32,12 @@ std::set<FilePath> SourceGroupCxxEmpty::filterToContainedFilePaths(const std::se
excludeFilters = 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;
return utility::filterToContainedFilePaths(
filePaths,
utility::toSet(indexedPaths),
std::set<FilePath>(),
excludeFilters
);
}
std::set<FilePath> SourceGroupCxxEmpty::getAllSourceFilePaths() const
@@ -86,7 +61,7 @@ std::set<FilePath> SourceGroupCxxEmpty::getAllSourceFilePaths() const
settings->getSourceExtensions()
);
}
return fileManager.getAllSourceFilePaths();
}