logic: indexer count and fixes
* added option to define the amount of parallel indexers in the appsettings * fixed unparsed files query in ASTVisitor * fixed: to update a node's type in the storage the node does not have to be defined anymore
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<config>
|
||||
<user>
|
||||
<recent_projects>
|
||||
<recent_project>./data/projects/tutorial/tutorial.coatiproject</recent_project>
|
||||
<recent_project>./data/projects/tictactoe/tictactoe.coatiproject</recent_project>
|
||||
</recent_projects>
|
||||
</user>
|
||||
<application>
|
||||
<indexer_thread_count>4</indexer_thread_count>
|
||||
</application>
|
||||
<user>
|
||||
<recent_projects>
|
||||
<recent_project>./data/projects/tutorial/tutorial.coatiproject</recent_project>
|
||||
<recent_project>./data/projects/tictactoe/tictactoe.coatiproject</recent_project>
|
||||
</recent_projects>
|
||||
</user>
|
||||
</config>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<font_size_max><!-- INTEGER: maximum font size in pt --></font_size_max>
|
||||
<font_size_min><!-- INTEGER: minimum font size in pt --></font_size_min>
|
||||
<font_size_std><!-- INTEGER: standard font size in pt --></font_size_std>
|
||||
<indexer_thread_count><!-- INTEGER: number of threads indexing the source code --></indexer_thread_count>
|
||||
</application>
|
||||
|
||||
<code>
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ void Project::parseCode()
|
||||
|
||||
std::shared_ptr<std::mutex> storageMutex = std::make_shared<std::mutex>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < ApplicationSettings::getInstance()->getIndexerThreadCount(); i++)
|
||||
{
|
||||
taskParallel->addTask(std::make_shared<TaskParseCxx>(
|
||||
m_storage.get(),
|
||||
|
||||
@@ -47,18 +47,18 @@ Id IntermediateStorage::addNode(int type, const std::string& serializedName, int
|
||||
std::unordered_map<std::string, Id>::const_iterator it = m_nodeNamesToIds.find(serialized);
|
||||
if (it != m_nodeNamesToIds.end())
|
||||
{
|
||||
// update stored information
|
||||
if (definitionType > 0)
|
||||
std::map<Id, std::shared_ptr<StorageNode>>::const_iterator it2 = m_nodeIdsToData.find(it->second);
|
||||
std::shared_ptr<StorageNode> storageNode = it2->second;
|
||||
if (storageNode->definitionType == 0)
|
||||
{
|
||||
std::map<Id, std::shared_ptr<StorageNode>>::const_iterator it2 = m_nodeIdsToData.find(it->second);
|
||||
std::shared_ptr<StorageNode> storageNode = it2->second;
|
||||
if (storageNode->definitionType == 0)
|
||||
if (definitionType > 0)
|
||||
{
|
||||
storageNode->definitionType = definitionType;
|
||||
if (storageNode->type < type)
|
||||
{
|
||||
storageNode->type = type;
|
||||
}
|
||||
}
|
||||
|
||||
if (storageNode->type < type)
|
||||
{
|
||||
storageNode->type = type;
|
||||
}
|
||||
}
|
||||
return it->second;
|
||||
|
||||
@@ -65,10 +65,14 @@ Id PersistentStorage::addNode(int type, const std::string& serializedName, int d
|
||||
}
|
||||
else
|
||||
{
|
||||
if (storedNode.definitionType == 0 && definitionType > 0)
|
||||
if (storedNode.definitionType == 0)
|
||||
{
|
||||
m_sqliteStorage.setNodeDefinitionType(definitionType, nodeId);
|
||||
if(storedNode.type < type)
|
||||
if (definitionType > 0)
|
||||
{
|
||||
m_sqliteStorage.setNodeDefinitionType(definitionType, nodeId);
|
||||
}
|
||||
|
||||
if (storedNode.type < type)
|
||||
{
|
||||
m_sqliteStorage.setNodeType(type, nodeId);
|
||||
}
|
||||
|
||||
@@ -143,6 +143,16 @@ void ApplicationSettings::setFontSizeStd(const int fontSizeStd)
|
||||
setValue<int>("application/font_size_std", fontSizeStd);
|
||||
}
|
||||
|
||||
int ApplicationSettings::getIndexerThreadCount() const
|
||||
{
|
||||
return getValue<int>("application/indexer_thread_count", 4);
|
||||
}
|
||||
|
||||
void ApplicationSettings::setIndexerThreadCount(const int count)
|
||||
{
|
||||
setValue<int>("application/indexer_thread_count", count);
|
||||
}
|
||||
|
||||
int ApplicationSettings::getCodeTabWidth() const
|
||||
{
|
||||
return getValue<int>("code/tab_width", 4);
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
int getFontSizeStd() const;
|
||||
void setFontSizeStd(const int fontSizeStd);
|
||||
|
||||
int getIndexerThreadCount() const;
|
||||
void setIndexerThreadCount(const int count);
|
||||
|
||||
// code
|
||||
int getCodeTabWidth() const;
|
||||
void setCodeTabWidth(int codeTabWidth);
|
||||
|
||||
@@ -53,6 +53,14 @@ std::vector<FilePath> FileRegister::getUnparsedSourceFilePaths() const
|
||||
return files;
|
||||
}
|
||||
|
||||
bool FileRegister::hasIncludeFile(const FilePath& filePath) const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_includeFileMutex);
|
||||
|
||||
std::map<FilePath, ParseState>::const_iterator it = m_includeFilePaths.find(filePath);
|
||||
return (it != m_includeFilePaths.end());
|
||||
}
|
||||
|
||||
bool FileRegister::fileIsParsed(const FilePath& filePath) const
|
||||
{
|
||||
return sourceFileIsParsed(filePath) || includeFileIsParsed(filePath);
|
||||
|
||||
@@ -23,6 +23,8 @@ public:
|
||||
|
||||
std::vector<FilePath> getUnparsedSourceFilePaths() const;
|
||||
|
||||
bool hasIncludeFile(const FilePath& filePath) const;
|
||||
|
||||
bool fileIsParsed(const FilePath& filePath) const;
|
||||
bool includeFileIsParsed(const FilePath& filePath) const;
|
||||
bool sourceFileIsParsed(const FilePath& filePath) const;
|
||||
|
||||
@@ -1503,7 +1503,11 @@ bool ASTVisitor::isLocatedInUnparsedProjectFile(clang::SourceLocation loc)
|
||||
{
|
||||
std::string fileName = fileEntry->getName();
|
||||
FilePath filePath = FilePath(fileName).canonical();
|
||||
ret = m_fileRegister->includeFileIsParsed(filePath.str());
|
||||
|
||||
if (m_fileRegister->hasIncludeFile(filePath))
|
||||
{
|
||||
ret = !(m_fileRegister->includeFileIsParsed(filePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
m_inUnparsedProjectFileMap[fileId] = ret;
|
||||
|
||||
Reference in New Issue
Block a user