logic: clearing unused includes

* refresh also clears referenced (included or imported) files if they are not part of the project's source files and are not referenced by any other unchanged file anymore.
This commit is contained in:
malte_langkabel
2017-01-23 10:36:42 +01:00
parent 0e5f65b475
commit 6ea248b500
6 changed files with 192 additions and 89 deletions
+14 -3
View File
@@ -65,7 +65,8 @@ public:
void clear();
void clearCaches();
std::set<FilePath> getDependingFilePaths(const std::set<FilePath>& filePaths);
std::set<FilePath> getReferenced(const std::set<FilePath>& filePaths);
std::set<FilePath> getReferencing(const std::set<FilePath>& filePaths);
void clearFileElements(const std::vector<FilePath>& filePaths);
@@ -129,10 +130,20 @@ public:
private:
Id getFileNodeId(const FilePath& filePath) const;
std::vector<Id> getFileNodeIds(const std::vector<FilePath>& filePaths) const;
std::set<Id> getFileNodeIds(const std::set<FilePath>& filePaths) const;
FilePath getFileNodePath(Id fileId) const;
std::set<FilePath> getDependingFilePathsForIncludes(const std::set<FilePath>& filePaths);
std::set<FilePath> getDependingFilePathsForImports(const std::set<FilePath>& filePaths);
std::unordered_map<Id, std::set<Id>> getFileIdToIncludingFileIdMap() const;
std::unordered_map<Id, std::set<Id>> getFileIdToImportingFileIdMap() const;
std::set<Id> getReferenced(const std::set<Id>& filePaths, std::unordered_map<Id, std::set<Id>> idToReferencingIdMap) const;
std::set<Id> getReferencing(const std::set<Id>& filePaths, std::unordered_map<Id, std::set<Id>> idToReferencingIdMap) const;
std::set<FilePath> getReferencedByIncludes(const std::set<FilePath>& filePaths);
std::set<FilePath> getReferencedByImports(const std::set<FilePath>& filePaths);
std::set<FilePath> getReferencingByIncludes(const std::set<FilePath>& filePaths);
std::set<FilePath> getReferencingByImports(const std::set<FilePath>& filePaths);
Id getLastVisibleParentNodeId(const Id nodeId) const;
std::vector<Id> getAllChildNodeIds(const Id nodeId) const;