logic: reduce access to filesystem while indexing

* use canonical filepath cache in cxx indexer
* made constructors of FilePath explicit
* use FilePath at more places instead of string
* forward declares FilePath wherever possible
This commit is contained in:
malte_langkabel
2017-05-04 10:55:16 +02:00
parent 55d3f9c189
commit 054b8fab17
156 changed files with 656 additions and 444 deletions
+5 -3
View File
@@ -4,6 +4,8 @@
#include <queue>
#include "utility/Cache.h"
#include "utility/file/FileInfo.h"
#include "utility/file/FilePath.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageNewErrors.h"
@@ -1273,7 +1275,7 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getSourceLocationsF
for (const StorageFile& file : m_sqliteIndexStorage.getAllByIds<StorageFile>(fileIds))
{
collection->addSourceLocationFile(m_sqliteIndexStorage.getSourceLocationsForFile(file.filePath));
collection->addSourceLocationFile(m_sqliteIndexStorage.getSourceLocationsForFile(FilePath(file.filePath)));
}
if (nonFileIds.size())
@@ -1351,7 +1353,7 @@ std::shared_ptr<SourceLocationFile> PersistentStorage::getSourceLocationsForFile
}
std::shared_ptr<SourceLocationFile> PersistentStorage::getSourceLocationsForLinesInFile(
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
const FilePath& filePath, uint firstLineNumber, uint lastLineNumber
) const
{
TRACE();
@@ -2041,7 +2043,7 @@ void PersistentStorage::buildSearchIndex()
auto it = fileMap.find(node.id);
if (it != fileMap.end())
{
FilePath filePath = it->second.filePath;
FilePath filePath(it->second.filePath);
if (filePath.exists())
{