logic: Fixed source files within CDB not indexed unless within Indexed Header Paths

This commit is contained in:
Eberhard Graether
2017-05-22 23:02:35 +02:00
parent 3598fd357d
commit 082dfc2e1a
10 changed files with 41 additions and 26 deletions
+3 -3
View File
@@ -30,17 +30,17 @@ size_t IndexerCommand::getByteSize() const
return size; return size;
} }
FilePath IndexerCommand::getSourceFilePath() const const FilePath& IndexerCommand::getSourceFilePath() const
{ {
return m_sourceFilePath; return m_sourceFilePath;
} }
std::set<FilePath> IndexerCommand::getIndexedPaths() const const std::set<FilePath>& IndexerCommand::getIndexedPaths() const
{ {
return m_indexedPaths; return m_indexedPaths;
} }
std::set<FilePath> IndexerCommand::getExcludedPath() const const std::set<FilePath>& IndexerCommand::getExcludedPath() const
{ {
return m_excludedPaths; return m_excludedPaths;
} }
+3 -3
View File
@@ -17,9 +17,9 @@ public:
virtual size_t getByteSize() const; virtual size_t getByteSize() const;
FilePath getSourceFilePath() const; const FilePath& getSourceFilePath() const;
std::set<FilePath> getIndexedPaths() const; const std::set<FilePath>& getIndexedPaths() const;
std::set<FilePath> getExcludedPath() const; const std::set<FilePath>& getExcludedPath() const;
virtual bool preprocessorOnly() const = 0; virtual bool preprocessorOnly() const = 0;
virtual void setPreprocessorOnly(bool preprocessorOnly) = 0; virtual void setPreprocessorOnly(bool preprocessorOnly) = 0;
-3
View File
@@ -1,7 +1,6 @@
#include "data/indexer/TaskBuildIndex.h" #include "data/indexer/TaskBuildIndex.h"
#include "utility/AppPath.h" #include "utility/AppPath.h"
#include "utility/file/FileRegisterStateData.h"
#include "utility/logging/FileLogger.h" #include "utility/logging/FileLogger.h"
#include "utility/scheduling/Blackboard.h" #include "utility/scheduling/Blackboard.h"
#include "utility/UserPaths.h" #include "utility/UserPaths.h"
@@ -23,12 +22,10 @@ TaskBuildIndex::TaskBuildIndex(
unsigned int processCount, unsigned int processCount,
std::shared_ptr<IndexerCommandList> indexerCommandList, std::shared_ptr<IndexerCommandList> indexerCommandList,
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<StorageProvider> storageProvider,
std::shared_ptr<FileRegisterStateData> fileRegisterStateData,
bool multiProcessIndexing bool multiProcessIndexing
) )
: m_indexerCommandList(indexerCommandList) : m_indexerCommandList(indexerCommandList)
, m_storageProvider(storageProvider) , m_storageProvider(storageProvider)
, m_fileRegisterStateData(fileRegisterStateData)
, m_multiProcessIndexing(multiProcessIndexing) , m_multiProcessIndexing(multiProcessIndexing)
, m_interprocessIndexerCommandManager(Application::getUUID(), 0, true) , m_interprocessIndexerCommandManager(Application::getUUID(), 0, true)
, m_interprocessIndexingStatusManager(Application::getUUID(), 0, true) , m_interprocessIndexingStatusManager(Application::getUUID(), 0, true)
-4
View File
@@ -3,7 +3,6 @@
#include <thread> #include <thread>
#include "utility/file/FileRegisterStateData.h"
#include "utility/messaging/MessageListener.h" #include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageInterruptTasks.h" #include "utility/messaging/type/MessageInterruptTasks.h"
#include "utility/scheduling/Task.h" #include "utility/scheduling/Task.h"
@@ -13,7 +12,6 @@
#include "data/indexer/interprocess/InterprocessIntermediateStorageManager.h" #include "data/indexer/interprocess/InterprocessIntermediateStorageManager.h"
class DialogView; class DialogView;
class FileRegisterStateData;
class StorageProvider; class StorageProvider;
class IndexerCommandList; class IndexerCommandList;
@@ -26,7 +24,6 @@ public:
unsigned int processCount, unsigned int processCount,
std::shared_ptr<IndexerCommandList> indexerCommandList, std::shared_ptr<IndexerCommandList> indexerCommandList,
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<StorageProvider> storageProvider,
std::shared_ptr<FileRegisterStateData> fileRegisterStateData,
bool multiProcessIndexing bool multiProcessIndexing
); );
@@ -48,7 +45,6 @@ protected:
std::shared_ptr<IndexerCommandList> m_indexerCommandList; std::shared_ptr<IndexerCommandList> m_indexerCommandList;
std::shared_ptr<StorageProvider> m_storageProvider; std::shared_ptr<StorageProvider> m_storageProvider;
std::shared_ptr<FileRegisterStateData> m_fileRegisterStateData;
bool m_multiProcessIndexing; bool m_multiProcessIndexing;
InterprocessIndexerCommandManager m_interprocessIndexerCommandManager; InterprocessIndexerCommandManager m_interprocessIndexerCommandManager;
@@ -39,7 +39,7 @@ void InterprocessIndexer::work()
data.setIndexedFiles(m_interprocessIndexingStatusManager.getIndexedFiles()); data.setIndexedFiles(m_interprocessIndexingStatusManager.getIndexedFiles());
std::shared_ptr<FileRegister> fileRegister = std::make_shared<FileRegister>( std::shared_ptr<FileRegister> fileRegister = std::make_shared<FileRegister>(
data, indexerCommand->getIndexedPaths(), indexerCommand->getExcludedPath() data, indexerCommand->getSourceFilePath(), indexerCommand->getIndexedPaths(), indexerCommand->getExcludedPath()
); );
std::shared_ptr<IntermediateStorage> result = indexer->index(indexerCommand, fileRegister); std::shared_ptr<IntermediateStorage> result = indexer->index(indexerCommand, fileRegister);
+1 -3
View File
@@ -20,7 +20,6 @@
#include "settings/ProjectSettings.h" #include "settings/ProjectSettings.h"
#include "utility/file/FilePath.h" #include "utility/file/FilePath.h"
#include "utility/file/FileRegisterStateData.h"
#include "utility/file/FileSystem.h" #include "utility/file/FileSystem.h"
#include "utility/messaging/type/MessageClearErrorCount.h" #include "utility/messaging/type/MessageClearErrorCount.h"
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
@@ -466,7 +465,6 @@ void Project::buildIndex(const std::set<FilePath>& filesToClean, bool fullRefres
indexerCommandList->shuffle(); indexerCommandList->shuffle();
} }
std::shared_ptr<FileRegisterStateData> fileRegisterStateData = std::make_shared<FileRegisterStateData>();
std::shared_ptr<StorageProvider> storageProvider = std::make_shared<StorageProvider>(); std::shared_ptr<StorageProvider> storageProvider = std::make_shared<StorageProvider>();
// add tasks for setting some variables on the blackboard that are used during indexing // add tasks for setting some variables on the blackboard that are used during indexing
taskSequential->addTask(std::make_shared<TaskSetValue<int>>("source_file_count", indexerCommandList->size())); taskSequential->addTask(std::make_shared<TaskSetValue<int>>("source_file_count", indexerCommandList->size()));
@@ -485,7 +483,7 @@ void Project::buildIndex(const std::set<FilePath>& filesToClean, bool fullRefres
taskParallelIndexing->addChildTasks( taskParallelIndexing->addChildTasks(
std::make_shared<TaskDecoratorRepeat>(TaskDecoratorRepeat::CONDITION_WHILE_SUCCESS, Task::STATE_SUCCESS)->addChildTask( std::make_shared<TaskDecoratorRepeat>(TaskDecoratorRepeat::CONDITION_WHILE_SUCCESS, Task::STATE_SUCCESS)->addChildTask(
std::make_shared<TaskBuildIndex>(indexerThreadCount, indexerCommandList, storageProvider, fileRegisterStateData, multiProcess) std::make_shared<TaskBuildIndex>(indexerThreadCount, indexerCommandList, storageProvider, multiProcess)
) )
); );
} }
+20 -5
View File
@@ -2,20 +2,35 @@
#include "utility/file/FilePath.h" #include "utility/file/FilePath.h"
FileRegister::FileRegister(const FileRegisterStateData& stateData, const std::set<FilePath>& indexedPaths, const std::set<FilePath>& excludedPaths) FileRegister::FileRegister(
const FileRegisterStateData& stateData,
const FilePath& currentPath,
const std::set<FilePath>& indexedPaths,
const std::set<FilePath>& excludedPaths
)
: m_stateData(stateData) : m_stateData(stateData)
, m_currentPath(currentPath)
, m_indexedPaths(indexedPaths) , m_indexedPaths(indexedPaths)
, m_excludedPaths(excludedPaths) , m_excludedPaths(excludedPaths)
, m_hasFilePathCache( , m_hasFilePathCache(
[&](std::string f){ [&](std::string f){
const FilePath filePath(f); const FilePath filePath(f);
bool ret = false; bool ret = false;
for (const FilePath& indexedPath: m_indexedPaths)
if (filePath == m_currentPath)
{ {
if (indexedPath.contains(filePath)) ret = true;
}
if (!ret)
{
for (const FilePath& indexedPath: m_indexedPaths)
{ {
ret = true; if (indexedPath.contains(filePath))
break; {
ret = true;
break;
}
} }
} }
+7 -1
View File
@@ -9,7 +9,12 @@
class FileRegister class FileRegister
{ {
public: public:
FileRegister(const FileRegisterStateData& stateData, const std::set<FilePath>& indexedPaths, const std::set<FilePath>& excludedPaths); FileRegister(
const FileRegisterStateData& stateData,
const FilePath& currentPath,
const std::set<FilePath>& indexedPaths,
const std::set<FilePath>& excludedPaths
);
virtual ~FileRegister(); virtual ~FileRegister();
const FileRegisterStateData& getStateData() const; const FileRegisterStateData& getStateData() const;
@@ -21,6 +26,7 @@ public:
private: private:
FileRegisterStateData m_stateData; FileRegisterStateData m_stateData;
const FilePath& m_currentPath;
const std::set<FilePath> m_indexedPaths; const std::set<FilePath> m_indexedPaths;
const std::set<FilePath> m_excludedPaths; const std::set<FilePath> m_excludedPaths;
mutable Cache<std::string, bool> m_hasFilePathCache; mutable Cache<std::string, bool> m_hasFilePathCache;
+5 -2
View File
@@ -72,8 +72,11 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
m_loader.hide(); m_loader.hide();
} }
m_textString = text; if (text.size())
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(m_textString), Qt::ElideRight, m_text.width())); {
m_textString = text;
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(m_textString), Qt::ElideRight, m_text.width()));
}
} }
void QtStatusBar::setErrorCount(ErrorCountInfo errorCount) void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
+1 -1
View File
@@ -1,7 +1,7 @@
#include "TestFileRegister.h" #include "TestFileRegister.h"
TestFileRegister::TestFileRegister() TestFileRegister::TestFileRegister()
: FileRegister(FileRegisterStateData(), std::set<FilePath>(), std::set<FilePath>()) : FileRegister(FileRegisterStateData(), FilePath(), std::set<FilePath>(), std::set<FilePath>())
{ {
} }