diff --git a/bin/app/user/ApplicationSettings_for_package.xml b/bin/app/user/ApplicationSettings_for_package.xml index e22c48fa..3fcdae1f 100644 --- a/bin/app/user/ApplicationSettings_for_package.xml +++ b/bin/app/user/ApplicationSettings_for_package.xml @@ -1,9 +1,12 @@ - - - ./data/projects/tutorial/tutorial.coatiproject - ./data/projects/tictactoe/tictactoe.coatiproject - - + + 4 + + + + ./data/projects/tutorial/tutorial.coatiproject + ./data/projects/tictactoe/tictactoe.coatiproject + + diff --git a/bin/app/user/ApplicationSettings_template.xml b/bin/app/user/ApplicationSettings_template.xml index e6e665b7..609daffb 100644 --- a/bin/app/user/ApplicationSettings_template.xml +++ b/bin/app/user/ApplicationSettings_template.xml @@ -29,6 +29,7 @@ + diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp index a311cd5b..79cec11c 100644 --- a/src/lib/Project.cpp +++ b/src/lib/Project.cpp @@ -177,7 +177,7 @@ void Project::parseCode() std::shared_ptr storageMutex = std::make_shared(); - for (int i = 0; i < 4; i++) + for (int i = 0; i < ApplicationSettings::getInstance()->getIndexerThreadCount(); i++) { taskParallel->addTask(std::make_shared( m_storage.get(), diff --git a/src/lib/data/IntermediateStorage.cpp b/src/lib/data/IntermediateStorage.cpp index 50859b13..e45c2800 100644 --- a/src/lib/data/IntermediateStorage.cpp +++ b/src/lib/data/IntermediateStorage.cpp @@ -47,18 +47,18 @@ Id IntermediateStorage::addNode(int type, const std::string& serializedName, int std::unordered_map::const_iterator it = m_nodeNamesToIds.find(serialized); if (it != m_nodeNamesToIds.end()) { - // update stored information - if (definitionType > 0) + std::map>::const_iterator it2 = m_nodeIdsToData.find(it->second); + std::shared_ptr storageNode = it2->second; + if (storageNode->definitionType == 0) { - std::map>::const_iterator it2 = m_nodeIdsToData.find(it->second); - std::shared_ptr 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; diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/PersistentStorage.cpp index 57c8c75e..a5f999ae 100644 --- a/src/lib/data/PersistentStorage.cpp +++ b/src/lib/data/PersistentStorage.cpp @@ -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); } diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index a4430cde..457321ce 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -143,6 +143,16 @@ void ApplicationSettings::setFontSizeStd(const int fontSizeStd) setValue("application/font_size_std", fontSizeStd); } +int ApplicationSettings::getIndexerThreadCount() const +{ + return getValue("application/indexer_thread_count", 4); +} + +void ApplicationSettings::setIndexerThreadCount(const int count) +{ + setValue("application/indexer_thread_count", count); +} + int ApplicationSettings::getCodeTabWidth() const { return getValue("code/tab_width", 4); diff --git a/src/lib/settings/ApplicationSettings.h b/src/lib/settings/ApplicationSettings.h index 6e171e69..ec45eec9 100644 --- a/src/lib/settings/ApplicationSettings.h +++ b/src/lib/settings/ApplicationSettings.h @@ -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); diff --git a/src/lib/utility/file/FileRegister.cpp b/src/lib/utility/file/FileRegister.cpp index aaa05ad3..3d538139 100644 --- a/src/lib/utility/file/FileRegister.cpp +++ b/src/lib/utility/file/FileRegister.cpp @@ -53,6 +53,14 @@ std::vector FileRegister::getUnparsedSourceFilePaths() const return files; } +bool FileRegister::hasIncludeFile(const FilePath& filePath) const +{ + std::lock_guard lock(m_includeFileMutex); + + std::map::const_iterator it = m_includeFilePaths.find(filePath); + return (it != m_includeFilePaths.end()); +} + bool FileRegister::fileIsParsed(const FilePath& filePath) const { return sourceFileIsParsed(filePath) || includeFileIsParsed(filePath); diff --git a/src/lib/utility/file/FileRegister.h b/src/lib/utility/file/FileRegister.h index 4b5d9a17..1d85ce7b 100644 --- a/src/lib/utility/file/FileRegister.h +++ b/src/lib/utility/file/FileRegister.h @@ -23,6 +23,8 @@ public: std::vector 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; diff --git a/src/lib_parser/data/parser/cxx/ASTVisitor.cpp b/src/lib_parser/data/parser/cxx/ASTVisitor.cpp index 1f4b77d8..649a2c0f 100644 --- a/src/lib_parser/data/parser/cxx/ASTVisitor.cpp +++ b/src/lib_parser/data/parser/cxx/ASTVisitor.cpp @@ -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;