logic: removed C/C++ "unparsed" check from indexer
Cxx AstVisitor re-visits previously or simultaneously indexed files because the "visible" content may have changed due to other preprocessor defines etc.
This commit is contained in:
@@ -4,13 +4,11 @@
|
||||
#include "utility/file/FilePathFilter.h"
|
||||
|
||||
FileRegister::FileRegister(
|
||||
const FileRegisterStateData& stateData,
|
||||
const FilePath& currentPath,
|
||||
const std::set<FilePath>& indexedPaths,
|
||||
const std::set<FilePathFilter>& excludeFilters
|
||||
)
|
||||
: m_stateData(stateData)
|
||||
, m_currentPath(currentPath)
|
||||
: m_currentPath(currentPath)
|
||||
, m_indexedPaths(indexedPaths)
|
||||
, m_excludeFilters(excludeFilters)
|
||||
, m_hasFilePathCache(
|
||||
@@ -64,31 +62,10 @@ FileRegister::FileRegister(
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FileRegister::~FileRegister()
|
||||
{
|
||||
}
|
||||
|
||||
const FileRegisterStateData& FileRegister::getStateData() const
|
||||
{
|
||||
return m_stateData;
|
||||
}
|
||||
|
||||
void FileRegister::markFileIndexing(const FilePath& filePath)
|
||||
{
|
||||
m_stateData.markFileIndexing(filePath);
|
||||
}
|
||||
|
||||
void FileRegister::markIndexingFilesIndexed()
|
||||
{
|
||||
m_stateData.markIndexingFilesIndexed();
|
||||
}
|
||||
|
||||
bool FileRegister::fileIsIndexed(const FilePath& filePath) const
|
||||
{
|
||||
return m_stateData.fileIsIndexed(filePath);
|
||||
}
|
||||
|
||||
bool FileRegister::hasFilePath(const FilePath& filePath) const
|
||||
{
|
||||
return m_hasFilePathCache.getValue(filePath.wstr());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "utility/file/FileRegisterStateData.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/UnorderedCache.h"
|
||||
|
||||
class FilePathFilter;
|
||||
@@ -12,22 +12,15 @@ class FileRegister
|
||||
{
|
||||
public:
|
||||
FileRegister(
|
||||
const FileRegisterStateData& stateData,
|
||||
const FilePath& currentPath,
|
||||
const std::set<FilePath>& indexedPaths,
|
||||
const std::set<FilePathFilter>& excludeFilters
|
||||
);
|
||||
virtual ~FileRegister();
|
||||
|
||||
const FileRegisterStateData& getStateData() const;
|
||||
|
||||
void markFileIndexing(const FilePath& filePath);
|
||||
void markIndexingFilesIndexed();
|
||||
virtual bool fileIsIndexed(const FilePath& filePath) const;
|
||||
virtual bool hasFilePath(const FilePath& filePath) const;
|
||||
|
||||
private:
|
||||
FileRegisterStateData m_stateData;
|
||||
const FilePath& m_currentPath;
|
||||
const std::set<FilePath> m_indexedPaths;
|
||||
const std::set<FilePathFilter> m_excludeFilters;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#include "utility/file/FileRegisterStateData.h"
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
FileRegisterStateData::FileRegisterStateData()
|
||||
{
|
||||
}
|
||||
|
||||
FileRegisterStateData::FileRegisterStateData(const FileRegisterStateData& o)
|
||||
{
|
||||
this->inject(o);
|
||||
}
|
||||
|
||||
void FileRegisterStateData::inject(const FileRegisterStateData& o)
|
||||
{
|
||||
for (const auto& it: o.m_filePaths)
|
||||
{
|
||||
if (it.second == STATE_INDEXED)
|
||||
{
|
||||
m_filePaths[it.first] = STATE_INDEXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileRegisterStateData::markFileIndexing(const FilePath& filePath)
|
||||
{
|
||||
m_filePaths[filePath] = STATE_INDEXING;
|
||||
}
|
||||
|
||||
void FileRegisterStateData::markIndexingFilesIndexed()
|
||||
{
|
||||
for (auto& it: m_filePaths)
|
||||
{
|
||||
if (it.second == STATE_INDEXING)
|
||||
{
|
||||
it.second = STATE_INDEXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileRegisterStateData::fileIsIndexed(const FilePath& filePath) const
|
||||
{
|
||||
auto it = m_filePaths.find(filePath);
|
||||
if (it != m_filePaths.end())
|
||||
{
|
||||
return it->second == STATE_INDEXED;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void FileRegisterStateData::setIndexedFiles(const std::set<FilePath>& filePaths)
|
||||
{
|
||||
for (auto& path : filePaths)
|
||||
{
|
||||
m_filePaths[path] = STATE_INDEXED;
|
||||
}
|
||||
}
|
||||
|
||||
std::set<FilePath> FileRegisterStateData::getIndexedFiles() const
|
||||
{
|
||||
std::set<FilePath> paths;
|
||||
for (auto& it : m_filePaths)
|
||||
{
|
||||
if (it.second == STATE_INDEXED)
|
||||
{
|
||||
paths.insert(it.first);
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef FILE_REGISTER_STATE_DATA_H
|
||||
#define FILE_REGISTER_STATE_DATA_H
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class FileRegisterStateData
|
||||
{
|
||||
public:
|
||||
FileRegisterStateData();
|
||||
FileRegisterStateData(const FileRegisterStateData& o);
|
||||
|
||||
void inject(const FileRegisterStateData& o);
|
||||
|
||||
void markFileIndexing(const FilePath& filePath);
|
||||
void markIndexingFilesIndexed();
|
||||
bool fileIsIndexed(const FilePath& filePath) const;
|
||||
|
||||
void setIndexedFiles(const std::set<FilePath>& filePaths);
|
||||
std::set<FilePath> getIndexedFiles() const;
|
||||
|
||||
private:
|
||||
enum IndexingState
|
||||
{
|
||||
STATE_NON_INDEXED,
|
||||
STATE_INDEXING,
|
||||
STATE_INDEXED
|
||||
};
|
||||
|
||||
std::map<FilePath, IndexingState> m_filePaths;
|
||||
};
|
||||
|
||||
#endif // FILE_REGISTER_STATE_DATA_H
|
||||
Reference in New Issue
Block a user