diff --git a/bin/app/data/color_schemes/bad_rainbow.xml b/bin/app/data/color_schemes/bad_rainbow.xml index 740ac1c1..b99b01c6 100644 --- a/bin/app/data/color_schemes/bad_rainbow.xml +++ b/bin/app/data/color_schemes/bad_rainbow.xml @@ -97,6 +97,8 @@ #BBBBBB #AAAAAA black + #B1B1B1 + grey @@ -331,6 +333,9 @@ #FFFFFF + + #999999 + file diff --git a/bin/app/data/color_schemes/bright.xml b/bin/app/data/color_schemes/bright.xml index d6bcfdbd..c136a732 100644 --- a/bin/app/data/color_schemes/bright.xml +++ b/bin/app/data/color_schemes/bright.xml @@ -97,6 +97,8 @@ #B2B2B2 #626262 black + white + bright diff --git a/bin/app/data/color_schemes/dark.xml b/bin/app/data/color_schemes/dark.xml index c5053034..3608f91f 100644 --- a/bin/app/data/color_schemes/dark.xml +++ b/bin/app/data/color_schemes/dark.xml @@ -97,6 +97,8 @@ #555555 #444444 white + #272728 + dark diff --git a/bin/app/data/gui/code_view/code_view.css b/bin/app/data/gui/code_view/code_view.css index 1c571130..8817e045 100644 --- a/bin/app/data/gui/code_view/code_view.css +++ b/bin/app/data/gui/code_view/code_view.css @@ -96,24 +96,35 @@ padding-right: 5px; } -#code_file #title_label { +#code_file #title_label, #single_file_title_bar #file_title { background-color: ; border: none; border-radius: 3px; color: ; font-size: px; padding: 2px 4px; +} + +#code_file #title_label { margin: 1px 8px 3px; } -#code_file #title_label:hover { +#single_file_title_bar #file_title { + margin: 3px 8px; +} + +#code_file #title_label:hover, #single_file_title_bar #file_title:hover { background-color: ; } -#code_file #title_label:pressed { +#code_file #title_label:pressed, #single_file_title_bar #file_title:pressed { background-color: ; } +#code_file #title_label[complete=false], #single_file_title_bar #file_title[complete=false] { + border: 1px solid ; +} + #code_file #references_label, #single_file_title_bar #references_label { background-color: ; border: none; @@ -209,21 +220,3 @@ background-color: ; padding-right: 5px; } - -#single_file_title_bar #file_title { - background-color: ; - border: none; - border-radius: 3px; - color: ; - font-size: px; - padding: 2px 4px; - margin: 3px 8px; -} - -#single_file_title_bar #file_title:hover { - background-color: ; -} - -#single_file_title_bar #file_title:pressed { - background-color: ; -} diff --git a/bin/app/data/gui/code_view/images/pattern.png b/bin/app/data/gui/code_view/images/pattern.png deleted file mode 100644 index 67c2960d..00000000 Binary files a/bin/app/data/gui/code_view/images/pattern.png and /dev/null differ diff --git a/bin/app/data/gui/code_view/images/pattern_bright.png b/bin/app/data/gui/code_view/images/pattern_bright.png new file mode 100644 index 00000000..339f59d5 Binary files /dev/null and b/bin/app/data/gui/code_view/images/pattern_bright.png differ diff --git a/bin/app/data/gui/code_view/images/pattern_dark.png b/bin/app/data/gui/code_view/images/pattern_dark.png new file mode 100644 index 00000000..c70240f1 Binary files /dev/null and b/bin/app/data/gui/code_view/images/pattern_dark.png differ diff --git a/bin/app/data/gui/code_view/images/pattern_grey.png b/bin/app/data/gui/code_view/images/pattern_grey.png new file mode 100644 index 00000000..f5ebb4ea Binary files /dev/null and b/bin/app/data/gui/code_view/images/pattern_grey.png differ diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 3109ff22..a740111e 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -49,7 +49,7 @@ void CodeController::handleMessage(MessageActivateAll* message) statsSnippet.reduced = true; - statsSnippet.locationFile = std::make_shared(FilePath(), true); + statsSnippet.locationFile = std::make_shared(FilePath(), true, true); std::vector description = getProjectDescription(statsSnippet.locationFile.get()); @@ -68,7 +68,8 @@ void CodeController::handleMessage(MessageActivateAll* message) ErrorCountInfo errorCount = m_storageAccess->getErrorCount(); ss << "\n"; - ss << "\t" + std::to_string(stats.fileCount) + " files\n"; + ss << "\t" + std::to_string(stats.fileCount) + " files"; + ss << (stats.completedFileCount != stats.fileCount ? " (" + std::to_string(stats.completedFileCount) + " complete)" : "") + "\n"; ss << "\t" + std::to_string(stats.fileLOCCount) + " lines of code\n"; ss << "\n"; ss << "\t" + std::to_string(stats.nodeCount) + " symbols\n"; @@ -77,9 +78,9 @@ void CodeController::handleMessage(MessageActivateAll* message) ss << "\t" + std::to_string(errorCount.total) + " errors (" + std::to_string(errorCount.fatal) + " fatal)\n"; ss << "\n"; - if (errorCount.total > 0) + if (stats.completedFileCount != stats.fileCount) { - ss << "\tWarning: Indexing may be incomplete as long as it yields fatal errors.\n"; + ss << "\tWarning: Indexing is incomplete as long as it yields fatal errors.\n"; ss << "\tTry resolving them and refresh the project.\n"; ss << "\n"; } @@ -732,7 +733,7 @@ std::shared_ptr CodeController::getSourceLocationOfParentSco } ); - std::shared_ptr file = std::make_shared(location->getFilePath(), false); + std::shared_ptr file = std::make_shared(location->getFilePath(), false, false); if (parent) { file->addSourceLocationCopy(parent); diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 1dfc3c98..7e8a71e1 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -779,19 +779,21 @@ void GraphController::bundleNodes() } } - if (!fileOrMacroActive) + if (fileOrMacroActive) { - bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { - return data->isType(Node::NODE_FILE); - }, - 1, - false, - "Importing Files" - ); + return; } + bundleNodesAndEdgesMatching( + [](const DummyNode::BundleInfo& info, const Node* data) + { + return data->isType(Node::NODE_FILE); + }, + 1, + false, + "Importing Files" + ); + bundleNodesAndEdgesMatching( [](const DummyNode::BundleInfo& info, const Node* data) { @@ -822,28 +824,25 @@ void GraphController::bundleNodes() "Built-in Types" ); - if (!fileOrMacroActive) - { - bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { - return info.isDefined && info.isReferencing && !info.layoutVertical; - }, - 10, - false, - "Referencing Symbols" - ); + bundleNodesAndEdgesMatching( + [](const DummyNode::BundleInfo& info, const Node* data) + { + return info.isDefined && info.isReferencing && !info.layoutVertical; + }, + 10, + false, + "Referencing Symbols" + ); - bundleNodesAndEdgesMatching( - [](const DummyNode::BundleInfo& info, const Node* data) - { - return info.isDefined && info.isReferenced && !info.layoutVertical; - }, - 10, - false, - "Referenced Symbols" - ); - } + bundleNodesAndEdgesMatching( + [](const DummyNode::BundleInfo& info, const Node* data) + { + return info.isDefined && info.isReferenced && !info.layoutVertical; + }, + 10, + false, + "Referenced Symbols" + ); bundleNodesAndEdgesMatching( [](const DummyNode::BundleInfo& info, const Node* data) diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index 7d8eea30..415f00c3 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -35,7 +35,9 @@ void DialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, s { } -void DialogView::finishedIndexingDialog(size_t fileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo) +void DialogView::finishedIndexingDialog( + size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, + float time, ErrorCountInfo errorInfo) { } diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index ce36965d..9bb03e67 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -30,7 +30,9 @@ public: virtual IndexMode startIndexingDialog( size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, bool forceRefresh, bool needsFullRefresh); virtual void updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath); - virtual void finishedIndexingDialog(size_t fileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo); + virtual void finishedIndexingDialog( + size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, + float time, ErrorCountInfo errorInfo); int confirm(const std::string& message); virtual int confirm(const std::string& message, const std::vector& options); diff --git a/src/lib/data/IntermediateStorage.cpp b/src/lib/data/IntermediateStorage.cpp index 74584506..512800e2 100644 --- a/src/lib/data/IntermediateStorage.cpp +++ b/src/lib/data/IntermediateStorage.cpp @@ -31,6 +31,14 @@ void IntermediateStorage::clear() m_nextId = 1; } +void IntermediateStorage::setFilesIncomplete() +{ + for (StorageFile& file : m_files) + { + file.complete = false; + } +} + size_t IntermediateStorage::getSourceLocationCount() const { return m_sourceLocationNamesToIds.size(); @@ -60,9 +68,9 @@ Id IntermediateStorage::addNode(int type, const std::string& serializedName) return id; } -void IntermediateStorage::addFile(const Id id, const std::string& filePath, const std::string& modificationTime) +void IntermediateStorage::addFile(const Id id, const std::string& filePath, const std::string& modificationTime, bool complete) { - const StorageFile file(id, filePath, modificationTime); + const StorageFile file(id, filePath, modificationTime, complete); const std::string serialized = serialize(file); if (m_serializedFiles.find(serialized) == m_serializedFiles.end()) diff --git a/src/lib/data/IntermediateStorage.h b/src/lib/data/IntermediateStorage.h index 8ec7bdcf..0be89f7a 100644 --- a/src/lib/data/IntermediateStorage.h +++ b/src/lib/data/IntermediateStorage.h @@ -16,10 +16,11 @@ public: virtual ~IntermediateStorage(); void clear(); + void setFilesIncomplete(); size_t getSourceLocationCount() const; virtual Id addNode(int type, const std::string& serializedName); - virtual void addFile(const Id id, const std::string& filePath, const std::string& modificationTime); + virtual void addFile(const Id id, const std::string& filePath, const std::string& modificationTime, bool complete); virtual void addSymbol(const Id id, int definitionKind); virtual Id addEdge(int type, Id sourceId, Id targetId); virtual Id addLocalSymbol(const std::string& name); diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/PersistentStorage.cpp index eed7d424..04c981e4 100644 --- a/src/lib/data/PersistentStorage.cpp +++ b/src/lib/data/PersistentStorage.cpp @@ -57,11 +57,16 @@ Id PersistentStorage::addNode(int type, const std::string& serializedName) return id; } -void PersistentStorage::addFile(const Id id, const std::string& filePath, const std::string& modificationTime) +void PersistentStorage::addFile(const Id id, const std::string& filePath, const std::string& modificationTime, bool complete) { - if (m_sqliteStorage.getFirstById(id).id == 0) + StorageFile file = m_sqliteStorage.getFirstById(id); + if (file.id == 0) { - m_sqliteStorage.addFile(id, filePath, modificationTime); + m_sqliteStorage.addFile(id, filePath, modificationTime, complete); + } + else if (!file.complete && complete) + { + m_sqliteStorage.setFileComplete(complete, id); } } @@ -1194,7 +1199,7 @@ std::shared_ptr PersistentStorage::getCommentLocationsInFile { TRACE(); - std::shared_ptr file = std::make_shared(filePath, false); + std::shared_ptr file = std::make_shared(filePath, false, false); std::vector storageLocations = m_sqliteStorage.getCommentLocationsInFile(filePath); for (size_t i = 0; i < storageLocations.size(); i++) @@ -1246,6 +1251,7 @@ StorageStats PersistentStorage::getStorageStats() const stats.edgeCount = m_sqliteStorage.getEdgeCount(); stats.fileCount = m_sqliteStorage.getFileCount(); + stats.completedFileCount = m_sqliteStorage.getCompletedFileCount(); stats.fileLOCCount = m_sqliteStorage.getFileLineSum(); return stats; @@ -1552,20 +1558,34 @@ void PersistentStorage::addNodesToGraph(const std::vector& nodeIds, Graph* g symbolMap[symbol.id] = symbol; } + std::unordered_map fileMap; + for (const StorageFile& file : m_sqliteStorage.getAllByIds(nodeIds)) + { + fileMap[file.id] = file; + } + for (const StorageNode& storageNode : m_sqliteStorage.getAllByIds(nodeIds)) { const Node::NodeType type = Node::intToType(storageNode.type); if (type == Node::NODE_FILE) { const FilePath filePath(NameHierarchy::deserialize(storageNode.serializedName).getRawName()); + + bool defined = true; + auto it = fileMap.find(storageNode.id); + if (it != fileMap.end()) + { + defined = it->second.complete; + } + Node* node = graph->createNode( storageNode.id, Node::NODE_FILE, NameHierarchy(filePath.fileName()), - true + defined ); node->addComponentFilePath(std::make_shared(filePath)); - node->setExplicit(true); + node->setExplicit(defined); } else { diff --git a/src/lib/data/PersistentStorage.h b/src/lib/data/PersistentStorage.h index c5465641..335a831c 100644 --- a/src/lib/data/PersistentStorage.h +++ b/src/lib/data/PersistentStorage.h @@ -27,7 +27,7 @@ public: virtual ~PersistentStorage(); virtual Id addNode(int type, const std::string& serializedName); - virtual void addFile(const Id id, const std::string& filePath, const std::string& modificationTime); + virtual void addFile(const Id id, const std::string& filePath, const std::string& modificationTime, bool complete); virtual void addSymbol(const Id id, int definitionKind); virtual Id addEdge(int type, Id sourceId, Id targetId); virtual Id addLocalSymbol(const std::string& name); diff --git a/src/lib/data/SqliteStorage.cpp b/src/lib/data/SqliteStorage.cpp index a6b434e7..f0b5284a 100644 --- a/src/lib/data/SqliteStorage.cpp +++ b/src/lib/data/SqliteStorage.cpp @@ -8,7 +8,7 @@ #include "utility/text/TextAccess.h" #include "utility/Version.h" -const size_t SqliteStorage::STORAGE_VERSION = 10; +const size_t SqliteStorage::STORAGE_VERSION = 11; SqliteStorage::SqliteStorage(const FilePath& dbFilePath) : m_dbFilePath(dbFilePath.canonical()) @@ -204,14 +204,14 @@ void SqliteStorage::addSymbol(const int id, const int definitionKind) ); } -void SqliteStorage::addFile(const int id, const std::string& filePath, const std::string& modificationTime) +void SqliteStorage::addFile(const int id, const std::string& filePath, const std::string& modificationTime, bool complete) { std::shared_ptr content = TextAccess::createFromFile(filePath); unsigned int lineCount = content->getLineCount(); executeStatement( - "INSERT INTO file(id, path, modification_time, line_count) VALUES(" - + std::to_string(id) + ", '" + filePath + "', '" + modificationTime + "', " + std::to_string(lineCount) + ");" + "INSERT INTO file(id, path, modification_time, complete, line_count) VALUES(" + + std::to_string(id) + ", '" + filePath + "', '" + modificationTime + "', '" + std::to_string(complete) + "', " + std::to_string(lineCount) + ");" ); CppSQLite3Statement stmt = m_database.compileStatement(( @@ -827,6 +827,13 @@ std::shared_ptr SqliteStorage::getFileContentByPath(const std::strin return TextAccess::createFromFile(filePath); } +void SqliteStorage::setFileComplete(bool complete, Id fileId) +{ + executeStatement( + "UPDATE file SET complete = " + std::to_string(complete) + " WHERE id == " + std::to_string(fileId) + ";" + ); +} + void SqliteStorage::setNodeType(int type, Id nodeId) { executeStatement( @@ -848,17 +855,20 @@ StorageSourceLocation SqliteStorage::getSourceLocationByAll(const Id fileNodeId, std::shared_ptr SqliteStorage::getSourceLocationsForFile(const FilePath& filePath) const { - std::shared_ptr ret = std::make_shared(filePath, true); + std::shared_ptr ret = std::make_shared(filePath, true, false); - const Id fileNodeId = getFileByPath(filePath.str()).id; - if (fileNodeId == 0) // early out + const StorageFile file = getFileByPath(filePath.str()); + if (file.id == 0) // early out { return ret; } + ret->setIsComplete(file.complete); + std::vector sourceLocationIds; std::unordered_map sourceLocationIdToData; - for (const StorageSourceLocation& storageLocation: doGetAll("WHERE file_node_id == " + std::to_string(fileNodeId))) + for (const StorageSourceLocation& storageLocation: + doGetAll("WHERE file_node_id == " + std::to_string(file.id))) { sourceLocationIds.push_back(storageLocation.id); sourceLocationIdToData[storageLocation.id] = storageLocation; @@ -1200,6 +1210,11 @@ int SqliteStorage::getFileCount() const return executeScalar("SELECT COUNT(*) FROM file;"); } +int SqliteStorage::getCompletedFileCount() const +{ + return executeScalar("SELECT COUNT(*) FROM file WHERE complete = 1;"); +} + int SqliteStorage::getFileLineSum() const { return executeScalar("SELECT SUM(line_count) FROM file;"); @@ -1286,6 +1301,7 @@ void SqliteStorage::setupTables() "id INTEGER NOT NULL, " "path TEXT, " "modification_time TEXT, " + "complete INTEGER, " "line_count INTEGER, " "UNIQUE(path) ON CONFLICT REPLACE," "PRIMARY KEY(id), " @@ -1662,7 +1678,7 @@ template <> std::vector SqliteStorage::doGetAll(const std::string& query) const { CppSQLite3Query q = executeQuery( - "SELECT id, path, modification_time FROM file " + query + ";" + "SELECT id, path, modification_time, complete FROM file " + query + ";" ); std::vector files; @@ -1671,10 +1687,11 @@ std::vector SqliteStorage::doGetAll(const std::string& const Id id = q.getIntField(0, 0); const std::string filePath = q.getStringField(1, ""); const std::string modificationTime = q.getStringField(2, ""); + const bool complete = q.getIntField(3, 0); if (id != 0) { - files.push_back(StorageFile(id, filePath, modificationTime)); + files.push_back(StorageFile(id, filePath, modificationTime, complete)); } q.nextRow(); } diff --git a/src/lib/data/SqliteStorage.h b/src/lib/data/SqliteStorage.h index 1acae5a8..bf5fe8a9 100644 --- a/src/lib/data/SqliteStorage.h +++ b/src/lib/data/SqliteStorage.h @@ -61,7 +61,7 @@ public: Id addNode(const int type, const std::string& serializedName); void addSymbol(const int id, int definitionKind); - void addFile(const int id, const std::string& filePath, const std::string& modificationTime); + void addFile(const int id, const std::string& filePath, const std::string& modificationTime, bool complete); Id addLocalSymbol(const std::string& name); Id addSourceLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type); bool addOccurrence(Id elementId, Id sourceLocationId); @@ -111,6 +111,7 @@ public: std::shared_ptr getFileContentByPath(const std::string& filePath) const; std::shared_ptr getFileContentById(Id fileId) const; + void setFileComplete(bool complete, Id fileId); void setNodeType(int type, Id nodeId); StorageSourceLocation getSourceLocationByAll(const Id fileNodeId, const uint startLine, const uint startCol, const uint endLine, const uint endCol, const int type) const; @@ -162,12 +163,17 @@ public: template std::vector getAllByIds(const std::vector& ids) const { - return doGetAll("WHERE id IN (" + utility::join(utility::toStrings(ids), ',') + ")"); + if (ids.size()) + { + return doGetAll("WHERE id IN (" + utility::join(utility::toStrings(ids), ',') + ")"); + } + return std::vector(); } int getNodeCount() const; int getEdgeCount() const; int getFileCount() const; + int getCompletedFileCount() const; int getFileLineSum() const; int getSourceLocationCount() const; diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index 8583399c..655afdf2 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -46,7 +46,7 @@ void Storage::inject(Storage* injected) } const Id ownId = it->second; - addFile(ownId, injectedData.filePath, injectedData.modificationTime); + addFile(ownId, injectedData.filePath, injectedData.modificationTime, injectedData.complete); } ); diff --git a/src/lib/data/Storage.h b/src/lib/data/Storage.h index 517ecad6..b90806cd 100644 --- a/src/lib/data/Storage.h +++ b/src/lib/data/Storage.h @@ -16,7 +16,7 @@ public: virtual ~Storage(); virtual Id addNode(int type, const std::string& serializedName) = 0; - virtual void addFile(const Id id, const std::string& filePath, const std::string& modificationTime) = 0; + virtual void addFile(const Id id, const std::string& filePath, const std::string& modificationTime, bool complete) = 0; virtual void addSymbol(const Id id, int definitionKind) = 0; virtual Id addEdge(int type, Id sourceId, Id targetId) = 0; virtual Id addLocalSymbol(const std::string& name) = 0; diff --git a/src/lib/data/StorageStats.h b/src/lib/data/StorageStats.h index 695a47e6..29930d40 100644 --- a/src/lib/data/StorageStats.h +++ b/src/lib/data/StorageStats.h @@ -7,6 +7,7 @@ struct StorageStats : nodeCount(0) , edgeCount(0) , fileCount(0) + , completedFileCount(0) , fileLOCCount(0) {} @@ -14,6 +15,7 @@ struct StorageStats size_t edgeCount; size_t fileCount; + size_t completedFileCount; size_t fileLOCCount; }; diff --git a/src/lib/data/StorageTypes.h b/src/lib/data/StorageTypes.h index bd68d6ee..bf63090e 100644 --- a/src/lib/data/StorageTypes.h +++ b/src/lib/data/StorageTypes.h @@ -71,17 +71,20 @@ struct StorageFile : id(0) , filePath("") , modificationTime("") + , complete(true) {} - StorageFile(Id id, const std::string& filePath, const std::string& modificationTime) + StorageFile(Id id, const std::string& filePath, const std::string& modificationTime, bool complete) : id(id) , filePath(filePath) , modificationTime(modificationTime) + , complete(complete) {} Id id; std::string filePath; std::string modificationTime; + bool complete; }; struct StorageLocalSymbol diff --git a/src/lib/data/TaskFinishParsing.cpp b/src/lib/data/TaskFinishParsing.cpp index 51d0495c..138f2ca6 100644 --- a/src/lib/data/TaskFinishParsing.cpp +++ b/src/lib/data/TaskFinishParsing.cpp @@ -32,22 +32,22 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr blackboa std::shared_ptr dialogView = Application::getInstance()->getDialogView(); - if (dialogView) - { + if (dialogView) + { dialogView->showStatusDialog("Finish Indexing", "Optimizing database"); - } + } m_storage->optimizeMemory(); - if (dialogView) - { + if (dialogView) + { dialogView->showStatusDialog("Finish Indexing", "Building caches"); - } + } m_storage->buildCaches(); - if (dialogView) - { + if (dialogView) + { dialogView->hideStatusDialog(); - } + } MessageFinishedParsing().dispatch(); float time = utility::duration(start); @@ -72,15 +72,19 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr blackboa int sourceFileCount = 0; blackboard->get("source_file_count", sourceFileCount); - if (dialogView) - { + if (dialogView) + { + StorageStats stats = m_storageAccess->getStorageStats(); + dialogView->finishedIndexingDialog( - indexedSourceFileCount, - sourceFileCount, - time, - m_storageAccess->getErrorCount() - ); - } + indexedSourceFileCount, + sourceFileCount, + stats.completedFileCount, + stats.fileCount, + time, + m_storageAccess->getErrorCount() + ); + } return STATE_SUCCESS; } diff --git a/src/lib/data/access/StorageAccessProxy.cpp b/src/lib/data/access/StorageAccessProxy.cpp index 12bde9be..ed57c0fc 100644 --- a/src/lib/data/access/StorageAccessProxy.cpp +++ b/src/lib/data/access/StorageAccessProxy.cpp @@ -233,7 +233,7 @@ std::shared_ptr StorageAccessProxy::getSourceLocationsForFil return m_subject->getSourceLocationsForFile(filePath); } - return std::make_shared("", false); + return std::make_shared("", false, false); } std::shared_ptr StorageAccessProxy::getSourceLocationsForLinesInFile( @@ -245,7 +245,7 @@ std::shared_ptr StorageAccessProxy::getSourceLocationsForLin return m_subject->getSourceLocationsForLinesInFile(filePath, firstLineNumber, lastLineNumber); } - return std::make_shared("", false); + return std::make_shared("", false, false); } std::shared_ptr StorageAccessProxy::getCommentLocationsInFile(const FilePath& filePath) const @@ -255,7 +255,7 @@ std::shared_ptr StorageAccessProxy::getCommentLocationsInFil return m_subject->getCommentLocationsInFile(filePath); } - return std::make_shared("", false); + return std::make_shared("", false, false); } std::shared_ptr StorageAccessProxy::getFileContent(const FilePath& filePath) const diff --git a/src/lib/data/indexer/Indexer.h b/src/lib/data/indexer/Indexer.h index 15a34f67..02d50f27 100644 --- a/src/lib/data/indexer/Indexer.h +++ b/src/lib/data/indexer/Indexer.h @@ -4,10 +4,13 @@ #include #include "data/indexer/IndexerBase.h" +#include "data/parser/ParserClientImpl.h" +#include "utility/file/FileRegister.h" #include "utility/logging/logging.h" -template -class Indexer: public IndexerBase +template +class Indexer + : public IndexerBase { public: virtual ~Indexer(); @@ -15,32 +18,54 @@ public: virtual std::string getKindString() const; virtual std::shared_ptr index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister); - -private: - virtual std::shared_ptr index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister) = 0; }; -template -Indexer::~Indexer() +template +Indexer::~Indexer() { } -template -std::string Indexer::getKindString() const +template +std::string Indexer::getKindString() const { return IndexerCommandType::getIndexerKindString(); } -template -std::shared_ptr Indexer::index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister) +template +std::shared_ptr Indexer::index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister) { - if (std::shared_ptr castedCommand = std::dynamic_pointer_cast(indexerCommand)) + std::shared_ptr castedCommand = std::dynamic_pointer_cast(indexerCommand); + if (!castedCommand) { - return index(castedCommand, fileRegister); + LOG_ERROR("Trying to process " + indexerCommand->getKindString() + " indexer command with " + getKindString() + " indexer."); + return std::shared_ptr(); } - LOG_ERROR("Trying to process " + indexerCommand->getKindString() + " indexer command with " + getKindString() + " indexer."); - return std::shared_ptr(); + std::shared_ptr parserClient = std::make_shared(); + std::shared_ptr parser = std::make_shared(parserClient, fileRegister); + + std::shared_ptr storage = std::make_shared(); + parserClient->setStorage(storage); + + parser->buildIndex(castedCommand); + + parserClient->resetStorage(); + + if (parserClient->hasFatalErrors()) + { + storage->setFilesIncomplete(); + } + else + { + fileRegister->markIndexingFilesIndexed(); + } + + if (interrupted()) + { + return std::shared_ptr(); + } + + return storage; } #endif // INDEXER_H diff --git a/src/lib/data/location/SourceLocationCollection.cpp b/src/lib/data/location/SourceLocationCollection.cpp index e6c8bb51..1378d865 100644 --- a/src/lib/data/location/SourceLocationCollection.cpp +++ b/src/lib/data/location/SourceLocationCollection.cpp @@ -113,7 +113,7 @@ SourceLocationFile* SourceLocationCollection::createSourceLocationFile(const Fil return file; } - std::shared_ptr filePtr = std::make_shared(filePath, false); + std::shared_ptr filePtr = std::make_shared(filePath, false, false); m_files.emplace(filePath, filePtr); return filePtr.get(); } diff --git a/src/lib/data/location/SourceLocationFile.cpp b/src/lib/data/location/SourceLocationFile.cpp index ddf970e2..c5bfa5d1 100644 --- a/src/lib/data/location/SourceLocationFile.cpp +++ b/src/lib/data/location/SourceLocationFile.cpp @@ -1,8 +1,9 @@ #include "data/location/SourceLocationFile.h" -SourceLocationFile::SourceLocationFile(const FilePath& filePath, bool isWhole) +SourceLocationFile::SourceLocationFile(const FilePath& filePath, bool isWhole, bool isComplete) : m_filePath(filePath) , m_isWhole(isWhole) + , m_isComplete(isComplete) { } @@ -25,6 +26,16 @@ bool SourceLocationFile::isWhole() const return m_isWhole; } +void SourceLocationFile::setIsComplete(bool isComplete) +{ + m_isComplete = isComplete; +} + +bool SourceLocationFile::isComplete() const +{ + return m_isComplete; +} + const std::multiset, SourceLocationFile::LocationComp>& SourceLocationFile::getSourceLocations() const { return m_locations; @@ -141,7 +152,7 @@ void SourceLocationFile::forEachEndSourceLocation(std::function SourceLocationFile::getFilteredByLines(size_t firstLineNumber, size_t lastLineNumber) const { - std::shared_ptr ret = std::make_shared(getFilePath(), false); + std::shared_ptr ret = std::make_shared(getFilePath(), false, isComplete()); for (std::shared_ptr location : m_locations) { @@ -156,7 +167,7 @@ std::shared_ptr SourceLocationFile::getFilteredByLines(size_ std::shared_ptr SourceLocationFile::getFilteredByType(LocationType type) const { - std::shared_ptr ret = std::make_shared(getFilePath(), false); + std::shared_ptr ret = std::make_shared(getFilePath(), false, isComplete()); for (std::shared_ptr location : m_locations) { diff --git a/src/lib/data/location/SourceLocationFile.h b/src/lib/data/location/SourceLocationFile.h index e41f7c2b..d27af6ae 100644 --- a/src/lib/data/location/SourceLocationFile.h +++ b/src/lib/data/location/SourceLocationFile.h @@ -21,7 +21,7 @@ public: } }; - SourceLocationFile(const FilePath& filePath, bool isWhole); + SourceLocationFile(const FilePath& filePath, bool isWhole, bool isComplete); virtual ~SourceLocationFile(); const FilePath& getFilePath() const; @@ -29,6 +29,9 @@ public: void setIsWhole(bool isWhole); bool isWhole() const; + void setIsComplete(bool isComplete); + bool isComplete() const; + const std::multiset, LocationComp>& getSourceLocations() const; size_t getSourceLocationCount() const; @@ -52,6 +55,7 @@ public: private: const FilePath m_filePath; bool m_isWhole; + bool m_isComplete; std::multiset, LocationComp> m_locations; std::map m_locationIndex; diff --git a/src/lib/data/parser/ParserClient.cpp b/src/lib/data/parser/ParserClient.cpp index 87cb5f59..ffffffcd 100644 --- a/src/lib/data/parser/ParserClient.cpp +++ b/src/lib/data/parser/ParserClient.cpp @@ -72,9 +72,25 @@ std::string ParserClient::addLocationSuffix( } ParserClient::ParserClient() + : m_hasFatalErrors(false) { } ParserClient::~ParserClient() { } + +void ParserClient::onErrorParsed(const ParseLocation& location, const std::string& message, bool fatal, bool indexed) +{ + this->onError(location, message, fatal, indexed); + + if (fatal) + { + m_hasFatalErrors = true; + } +} + +bool ParserClient::hasFatalErrors() const +{ + return m_hasFatalErrors; +} diff --git a/src/lib/data/parser/ParserClient.h b/src/lib/data/parser/ParserClient.h index a7527aa2..73d601b3 100644 --- a/src/lib/data/parser/ParserClient.h +++ b/src/lib/data/parser/ParserClient.h @@ -28,9 +28,6 @@ public: ParserClient(); virtual ~ParserClient(); - virtual void startParsingFile() = 0; - virtual void finishParsingFile() = 0; - virtual Id recordSymbol( const NameHierarchy& symbolName, SymbolKind symbolKind, AccessKind access, DefinitionKind definitionKind) = 0; @@ -53,6 +50,13 @@ public: virtual void onLocalSymbolParsed(const std::string& name, const ParseLocation& location) = 0; virtual void onFileParsed(const FileInfo& fileInfo) = 0; virtual void onCommentParsed(const ParseLocation& location) = 0; + + void onErrorParsed(const ParseLocation& location, const std::string& message, bool fatal, bool indexed); + + bool hasFatalErrors() const; + +protected: + bool m_hasFatalErrors; }; #endif // PARSER_CLIENT_H diff --git a/src/lib/data/parser/ParserClientImpl.cpp b/src/lib/data/parser/ParserClientImpl.cpp index 6ecce464..9d56a498 100644 --- a/src/lib/data/parser/ParserClientImpl.cpp +++ b/src/lib/data/parser/ParserClientImpl.cpp @@ -18,19 +18,15 @@ ParserClientImpl::~ParserClientImpl() void ParserClientImpl::setStorage(std::shared_ptr storage) { m_storage = storage; + + m_hasFatalErrors = 0; } void ParserClientImpl::resetStorage() { m_storage.reset(); -} -void ParserClientImpl::startParsingFile() -{ -} - -void ParserClientImpl::finishParsingFile() -{ + m_hasFatalErrors = 0; } Id ParserClientImpl::recordSymbol( @@ -236,7 +232,7 @@ void ParserClientImpl::addFile(Id id, const FilePath& filePath, const std::strin return; } - m_storage->addFile(id, filePath.str(), modificationTime); + m_storage->addFile(id, filePath.str(), modificationTime, true); } void ParserClientImpl::addSymbol(Id id, DefinitionKind definitionKind) diff --git a/src/lib/data/parser/ParserClientImpl.h b/src/lib/data/parser/ParserClientImpl.h index 74e62249..48a8c1f7 100644 --- a/src/lib/data/parser/ParserClientImpl.h +++ b/src/lib/data/parser/ParserClientImpl.h @@ -19,9 +19,6 @@ public: void setStorage(std::shared_ptr storage); void resetStorage(); - virtual void startParsingFile(); - virtual void finishParsingFile(); - virtual Id recordSymbol( const NameHierarchy& symbolName, SymbolKind symbolKind, AccessKind access, DefinitionKind definitionKind); diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index da7a7a60..00b52838 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -270,6 +270,7 @@ bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh) } std::set filesToClean; + if (!needsFullRefresh) { std::set unchangedFilePaths; std::set changedFilePaths; diff --git a/src/lib_cxx/CMakeLists.txt b/src/lib_cxx/CMakeLists.txt index 484e063e..9bc63df4 100644 --- a/src/lib_cxx/CMakeLists.txt +++ b/src/lib_cxx/CMakeLists.txt @@ -1,20 +1,16 @@ add_files( LIB_CXX_FILES - + data/indexer/IndexerCommandCxxCdb.cpp data/indexer/IndexerCommandCxxCdb.h data/indexer/IndexerCommandCxxManual.cpp data/indexer/IndexerCommandCxxManual.h - data/indexer/IndexerCxxCdb.cpp - data/indexer/IndexerCxxCdb.h - data/indexer/IndexerCxxManual.cpp - data/indexer/IndexerCxxManual.h data/indexer/IndexerFactoryModuleCxxCdb.cpp data/indexer/IndexerFactoryModuleCxxCdb.h data/indexer/IndexerFactoryModuleCxxManual.cpp data/indexer/IndexerFactoryModuleCxxManual.h - + data/parser/cxx/name/CxxDeclName.cpp data/parser/cxx/name/CxxDeclName.h data/parser/cxx/name/CxxFunctionDeclName.cpp @@ -25,7 +21,7 @@ add_files( data/parser/cxx/name/CxxQualifierFlags.h data/parser/cxx/name/CxxTypeName.cpp data/parser/cxx/name/CxxTypeName.h - + data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp data/parser/cxx/name_resolver/CxxDeclNameResolver.h data/parser/cxx/name_resolver/CxxNameResolver.cpp @@ -73,7 +69,7 @@ add_files( data/parser/cxx/PreprocessorCallbacks.h data/parser/cxx/utilityCxxAstVisitor.cpp data/parser/cxx/utilityCxxAstVisitor.h - + project/SourceGroupCxx.cpp project/SourceGroupCxx.h project/SourceGroupFactoryModuleCpp.cpp diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp index 119502df..9faffae5 100644 --- a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp +++ b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp @@ -1,6 +1,25 @@ #include "data/indexer/IndexerCommandCxxCdb.h" #include "clang/Tooling/CompilationDatabase.h" +#include "clang/Tooling/JSONCompilationDatabase.h" + +std::vector IndexerCommandCxxCdb::getSourceFilesFromCDB(const FilePath& compilationDatabasePath) +{ + std::string error; + std::shared_ptr cdb = std::shared_ptr + (clang::tooling::JSONCompilationDatabase::loadFromFile(compilationDatabasePath.str(), error)); + + std::vector filePaths; + if (cdb) + { + std::vector files = cdb->getAllFiles(); + for (const std::string& file : files) + { + filePaths.push_back(FilePath(file)); + } + } + return filePaths; +} std::string IndexerCommandCxxCdb::getIndexerKindString() { diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h index 19ffc216..c64a0b54 100644 --- a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h +++ b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h @@ -17,6 +17,8 @@ namespace clang class IndexerCommandCxxCdb: public IndexerCommand { public: + static std::vector getSourceFilesFromCDB(const FilePath& compilationDatabasePath); + static std::string getIndexerKindString(); IndexerCommandCxxCdb( diff --git a/src/lib_cxx/data/indexer/IndexerCxxCdb.cpp b/src/lib_cxx/data/indexer/IndexerCxxCdb.cpp deleted file mode 100644 index 3bcb8f8a..00000000 --- a/src/lib_cxx/data/indexer/IndexerCxxCdb.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "data/indexer/IndexerCxxCdb.h" - -#include "clang/Tooling/JSONCompilationDatabase.h" -#include "data/parser/ParserClientImpl.h" -#include "data/parser/cxx/CxxParser.h" -#include "utility/file/FileRegister.h" - -std::vector IndexerCxxCdb::getSourceFilesFromCDB(const FilePath& compilationDatabasePath) -{ - std::string error; - std::shared_ptr cdb = std::shared_ptr - (clang::tooling::JSONCompilationDatabase::loadFromFile(compilationDatabasePath.str(), error)); - - std::vector filePaths; - if (cdb) - { - std::vector files = cdb->getAllFiles(); - for (const std::string& file : files) - { - filePaths.push_back(FilePath(file)); - } - } - return filePaths; -} - -std::shared_ptr IndexerCxxCdb::index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister) -{ - std::shared_ptr parserClient = std::make_shared(); - std::shared_ptr parser = std::make_shared(parserClient, fileRegister); - - std::shared_ptr storage = std::make_shared(); - parserClient->setStorage(storage); - parserClient->startParsingFile(); - - parser->buildIndex(indexerCommand); - fileRegister->markIndexingFilesIndexed(); - - parserClient->finishParsingFile(); - parserClient->resetStorage(); - - if (interrupted()) - { - return std::shared_ptr(); - } - - return storage; -} diff --git a/src/lib_cxx/data/indexer/IndexerCxxCdb.h b/src/lib_cxx/data/indexer/IndexerCxxCdb.h deleted file mode 100644 index 7af3bb84..00000000 --- a/src/lib_cxx/data/indexer/IndexerCxxCdb.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef INDEXER_CXX_CDB_H -#define INDEXER_CXX_CDB_H - -#include - -#include "data/indexer/Indexer.h" -#include "data/indexer/IndexerCommandCxxCdb.h" -#include "utility/file/FilePath.h" - -class IndexerCxxCdb: public Indexer -{ -public: - static std::vector getSourceFilesFromCDB(const FilePath& compilationDatabasePath); - -private: - virtual std::shared_ptr index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister); - -}; - -#endif // INDEXER_CXX_CDB_H diff --git a/src/lib_cxx/data/indexer/IndexerCxxManual.cpp b/src/lib_cxx/data/indexer/IndexerCxxManual.cpp deleted file mode 100644 index d550e6e5..00000000 --- a/src/lib_cxx/data/indexer/IndexerCxxManual.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "data/indexer/IndexerCxxManual.h" - -#include "data/parser/ParserClientImpl.h" -#include "data/parser/cxx/CxxParser.h" -#include "utility/file/FileRegister.h" - -std::shared_ptr IndexerCxxManual::index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister) -{ - std::shared_ptr parserClient = std::make_shared(); - std::shared_ptr parser = std::make_shared(parserClient, fileRegister); - - std::shared_ptr storage = std::make_shared(); - parserClient->setStorage(storage); - parserClient->startParsingFile(); - - parser->buildIndex(indexerCommand); - fileRegister->markIndexingFilesIndexed(); - - parserClient->finishParsingFile(); - parserClient->resetStorage(); - - if (interrupted()) - { - return std::shared_ptr(); - } - - return storage; -} diff --git a/src/lib_cxx/data/indexer/IndexerCxxManual.h b/src/lib_cxx/data/indexer/IndexerCxxManual.h deleted file mode 100644 index 3c38cfa3..00000000 --- a/src/lib_cxx/data/indexer/IndexerCxxManual.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef INDEXER_CXX_MANUAL_H -#define INDEXER_CXX_MANUAL_H - -#include "data/indexer/Indexer.h" -#include "data/indexer/IndexerCommandCxxManual.h" - -class IndexerCxxManual: public Indexer -{ -private: - virtual std::shared_ptr index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister); -}; - -#endif // INDEXER_CXX_MANUAL_H diff --git a/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxCdb.cpp b/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxCdb.cpp index 56b1f4ce..e66bcd49 100644 --- a/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxCdb.cpp +++ b/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxCdb.cpp @@ -1,6 +1,8 @@ #include "data/indexer/IndexerFactoryModuleCxxCdb.h" -#include "data/indexer/IndexerCxxCdb.h" +#include "data/indexer/Indexer.h" +#include "data/indexer/IndexerCommandCxxCdb.h" +#include "data/parser/cxx/CxxParser.h" IndexerFactoryModuleCxxCdb::~IndexerFactoryModuleCxxCdb() { @@ -8,5 +10,5 @@ IndexerFactoryModuleCxxCdb::~IndexerFactoryModuleCxxCdb() std::shared_ptr IndexerFactoryModuleCxxCdb::createIndexer() { - return std::make_shared(); + return std::make_shared>(); } diff --git a/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxManual.cpp b/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxManual.cpp index 30bda838..32e37638 100644 --- a/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxManual.cpp +++ b/src/lib_cxx/data/indexer/IndexerFactoryModuleCxxManual.cpp @@ -1,6 +1,8 @@ #include "data/indexer/IndexerFactoryModuleCxxManual.h" -#include "data/indexer/IndexerCxxManual.h" +#include "data/indexer/Indexer.h" +#include "data/indexer/IndexerCommandCxxManual.h" +#include "data/parser/cxx/CxxParser.h" IndexerFactoryModuleCxxManual::~IndexerFactoryModuleCxxManual() { @@ -8,5 +10,5 @@ IndexerFactoryModuleCxxManual::~IndexerFactoryModuleCxxManual() std::shared_ptr IndexerFactoryModuleCxxManual::createIndexer() { - return std::make_shared(); + return std::make_shared>(); } diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp index 477f210f..86d125ae 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp @@ -13,6 +13,7 @@ #include "data/parser/cxx/CxxAstVisitorComponentImplicitCode.h" #include "data/parser/cxx/CxxAstVisitorComponentIndexer.h" #include "data/parser/cxx/utilityCxxAstVisitor.h" +#include "data/parser/ParserClient.h" #include "data/parser/ParseLocation.h" @@ -282,6 +283,11 @@ bool CxxAstVisitor::TraverseTemplateTemplateParmDecl(clang::TemplateTemplateParm return true; } +bool CxxAstVisitor::VisitTranslationUnitDecl(clang::TranslationUnitDecl *d) +{ + return !m_client->hasFatalErrors(); +} + bool CxxAstVisitor::TraverseNestedNameSpecifierLoc(clang::NestedNameSpecifierLoc loc) { bool ret = true; diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.h b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.h index 22e2f41b..0b6ce404 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.h +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.h @@ -117,6 +117,7 @@ public: virtual bool VisitNonTypeTemplateParmDecl(clang::NonTypeTemplateParmDecl* d); virtual bool VisitTemplateTypeParmDecl(clang::TemplateTypeParmDecl* d); virtual bool VisitTemplateTemplateParmDecl(clang::TemplateTemplateParmDecl* d); + virtual bool VisitTranslationUnitDecl(clang::TranslationUnitDecl *d); virtual bool VisitTypeLoc(clang::TypeLoc tl); diff --git a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp index f397ccef..463e1580 100644 --- a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp @@ -81,7 +81,7 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev ParseLocation location(filePath, line, column); - m_client->onError( + m_client->onErrorParsed( location, message, level == clang::DiagnosticsEngine::Fatal, diff --git a/src/lib_cxx/project/SourceGroupCxx.cpp b/src/lib_cxx/project/SourceGroupCxx.cpp index 8a105e26..26ddad5b 100644 --- a/src/lib_cxx/project/SourceGroupCxx.cpp +++ b/src/lib_cxx/project/SourceGroupCxx.cpp @@ -5,7 +5,7 @@ #include "clang/Tooling/JSONCompilationDatabase.h" #include "data/indexer/IndexerCommandCxxManual.h" -#include "data/indexer/IndexerCxxCdb.h" +#include "data/indexer/IndexerCommandCxxCdb.h" #include "settings/ApplicationSettings.h" #include "utility/file/FileRegister.h" #include "utility/file/FileSystem.h" @@ -59,7 +59,7 @@ void SourceGroupCxx::fetchAllSourceFilePaths() FilePath cdbPath = m_settings->getAbsoluteCompilationDatabasePath(); if (cdbPath.exists()) { - sourcePaths = IndexerCxxCdb::getSourceFilesFromCDB(cdbPath); + sourcePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath); } else { diff --git a/src/lib_gui/qt/element/QtCodeFile.cpp b/src/lib_gui/qt/element/QtCodeFile.cpp index 12abf3de..8fe1eff8 100644 --- a/src/lib_gui/qt/element/QtCodeFile.cpp +++ b/src/lib_gui/qt/element/QtCodeFile.cpp @@ -293,6 +293,11 @@ void QtCodeFile::setWholeFile(bool isWholeFile, int refCount) updateRefCount(isWholeFile ? 0 : refCount); } +void QtCodeFile::setIsComplete(bool isComplete) +{ + m_title->setIsComplete(isComplete); +} + void QtCodeFile::setMinimized() { for (std::shared_ptr snippet : m_snippets) @@ -376,7 +381,7 @@ void QtCodeFile::updateSnippets() void QtCodeFile::updateTitleBar() { - m_title->checkModification(); + m_title->updateTexts(); } void QtCodeFile::clickedMinimizeButton() const diff --git a/src/lib_gui/qt/element/QtCodeFile.h b/src/lib_gui/qt/element/QtCodeFile.h index 5af56b5b..14970e6b 100644 --- a/src/lib_gui/qt/element/QtCodeFile.h +++ b/src/lib_gui/qt/element/QtCodeFile.h @@ -47,6 +47,7 @@ public: void updateContent(); void setWholeFile(bool isWholeFile, int refCount); + void setIsComplete(bool isComplete); void setMinimized(); void setSnippets(); diff --git a/src/lib_gui/qt/element/QtCodeFileList.cpp b/src/lib_gui/qt/element/QtCodeFileList.cpp index bddd14e6..cb4e74af 100644 --- a/src/lib_gui/qt/element/QtCodeFileList.cpp +++ b/src/lib_gui/qt/element/QtCodeFileList.cpp @@ -70,11 +70,12 @@ QtCodeFile* QtCodeFileList::getFile(const FilePath filePath) return file; } -void QtCodeFileList::addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimePoint modificationTime) +void QtCodeFileList::addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimePoint modificationTime, bool isComplete) { QtCodeFile* file = getFile(filePath); file->setWholeFile(isWholeFile, refCount); file->setModificationTime(modificationTime); + file->setIsComplete(isComplete); } QScrollArea* QtCodeFileList::getScrollArea() @@ -99,6 +100,7 @@ void QtCodeFileList::addCodeSnippet( } file->setModificationTime(params.modificationTime); + file->setIsComplete(params.locationFile->isComplete()); } void QtCodeFileList::requestFileContent(const FilePath& filePath, bool isFirstInList) diff --git a/src/lib_gui/qt/element/QtCodeFileList.h b/src/lib_gui/qt/element/QtCodeFileList.h index a4368644..f08bc554 100644 --- a/src/lib_gui/qt/element/QtCodeFileList.h +++ b/src/lib_gui/qt/element/QtCodeFileList.h @@ -28,7 +28,7 @@ public: void clear(); QtCodeFile* getFile(const FilePath filePath); - void addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimePoint modificationTime); + void addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimePoint modificationTime, bool isComplete); // QtCodeNaviatebale implementation virtual QScrollArea* getScrollArea(); diff --git a/src/lib_gui/qt/element/QtCodeFileSingle.cpp b/src/lib_gui/qt/element/QtCodeFileSingle.cpp index 3e536878..000e3945 100644 --- a/src/lib_gui/qt/element/QtCodeFileSingle.cpp +++ b/src/lib_gui/qt/element/QtCodeFileSingle.cpp @@ -101,6 +101,7 @@ void QtCodeFileSingle::addCodeSnippet(const CodeSnippetParams& params, bool inse file.filePath = params.locationFile->getFilePath(); file.modificationTime = params.modificationTime; + file.isComplete = params.locationFile->isComplete(); if (params.reduced) { @@ -198,7 +199,7 @@ void QtCodeFileSingle::showContents() void QtCodeFileSingle::onWindowFocus() { - m_title->checkModification(); + m_title->updateTexts(); } const FilePath& QtCodeFileSingle::getCurrentFilePath() const @@ -260,11 +261,13 @@ void QtCodeFileSingle::setFileData(const FileData& file) if (file.title.size()) { m_title->setProject(file.title); + m_title->setIsComplete(true); } else { m_title->setFilePath(file.filePath); m_title->setModificationTime(file.modificationTime); + m_title->setIsComplete(file.isComplete); } updateRefCount(m_area->getActiveLocationCount()); diff --git a/src/lib_gui/qt/element/QtCodeFileSingle.h b/src/lib_gui/qt/element/QtCodeFileSingle.h index 18b3ffce..5f92b858 100644 --- a/src/lib_gui/qt/element/QtCodeFileSingle.h +++ b/src/lib_gui/qt/element/QtCodeFileSingle.h @@ -50,6 +50,7 @@ private: { FilePath filePath; TimePoint modificationTime; + bool isComplete; std::string title; std::shared_ptr area; diff --git a/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp b/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp index f2b79a51..54c77876 100644 --- a/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp +++ b/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp @@ -13,6 +13,7 @@ QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent) : QPushButton(parent) + , m_isComplete(true) { setObjectName("title_label"); minimumSizeHint(); // force font loading @@ -49,7 +50,25 @@ void QtCodeFileTitleButton::setModificationTime(const TimePoint modificationTime if (modificationTime.isValid()) { m_modificationTime = modificationTime; - checkModification(); + updateTexts(); + } +} + +void QtCodeFileTitleButton::setIsComplete(bool isComplete) +{ + m_isComplete = isComplete; + setProperty("complete", isComplete); + + if (!isComplete) + { + setStyleSheet(( + "background-image: url(" + ResourcePaths::getGuiPath() + "code_view/images/pattern_" + + ColorScheme::getInstance()->getColor("code/file/title/hatching") + ".png);" + ).c_str()); + } + else + { + setStyleSheet(""); } } @@ -74,25 +93,31 @@ void QtCodeFileTitleButton::setProject(const std::string& name) } } -void QtCodeFileTitleButton::checkModification() +void QtCodeFileTitleButton::updateTexts() { if (Application::getInstance()->isInTrial() || m_filePath.empty()) { return; } + std::string title = m_filePath.fileName(); + std::string toolTip = "file: " + m_filePath.str(); + // cannot use m_filePath.exists() here since it is only checked when FilePath is constructed. if ((!FileSystem::exists(m_filePath.str())) || (FileSystem::getLastWriteTime(m_filePath) > m_modificationTime)) { - setText(QString(m_filePath.fileName().c_str()) + "*"); - setToolTip(QString::fromStdString("out of date: " + m_filePath.str())); + title += "*"; + toolTip = "out of date " + toolTip; } - else + + if (!m_isComplete) { - setText(m_filePath.fileName().c_str()); - setToolTip(QString::fromStdString(m_filePath.str())); + toolTip = "incomplete " + toolTip; } + + setText(title.c_str()); + setToolTip(toolTip.c_str()); } void QtCodeFileTitleButton::contextMenuEvent(QContextMenuEvent* event) diff --git a/src/lib_gui/qt/element/QtCodeFileTitleButton.h b/src/lib_gui/qt/element/QtCodeFileTitleButton.h index f88b73d4..929d2b79 100644 --- a/src/lib_gui/qt/element/QtCodeFileTitleButton.h +++ b/src/lib_gui/qt/element/QtCodeFileTitleButton.h @@ -17,9 +17,10 @@ public: void setFilePath(const FilePath& filePath); void setModificationTime(const TimePoint modificationTime); + void setIsComplete(bool isComplete); void setProject(const std::string& name); - void checkModification(); + void updateTexts(); protected: void contextMenuEvent(QContextMenuEvent* event); @@ -30,6 +31,7 @@ private slots: private: FilePath m_filePath; TimePoint m_modificationTime; + bool m_isComplete; }; #endif // QT_CODE_FILE_TITLE_BUTTON_H diff --git a/src/lib_gui/qt/element/QtCodeNavigator.cpp b/src/lib_gui/qt/element/QtCodeNavigator.cpp index 8e23842b..f11f9848 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/QtCodeNavigator.cpp @@ -152,7 +152,7 @@ void QtCodeNavigator::addCodeSnippet(const CodeSnippetParams& params, bool inser void QtCodeNavigator::addFile(std::shared_ptr locationFile, int refCount, TimePoint modificationTime) { - m_list->addFile(locationFile->getFilePath(), locationFile->isWhole(), refCount, modificationTime); + m_list->addFile(locationFile->getFilePath(), locationFile->isWhole(), refCount, modificationTime, locationFile->isComplete()); if (locationFile->isWhole()) { diff --git a/src/lib_gui/qt/element/QtCodeSnippet.cpp b/src/lib_gui/qt/element/QtCodeSnippet.cpp index 025221d2..c9bf94e6 100644 --- a/src/lib_gui/qt/element/QtCodeSnippet.cpp +++ b/src/lib_gui/qt/element/QtCodeSnippet.cpp @@ -20,7 +20,7 @@ std::shared_ptr QtCodeSnippet::merged( SourceLocationFile* aFile = a->m_codeArea->getSourceLocationFile().get(); SourceLocationFile* bFile = b->m_codeArea->getSourceLocationFile().get(); - std::shared_ptr locationFile = std::make_shared(aFile->getFilePath(), aFile->isWhole()); + std::shared_ptr locationFile = std::make_shared(aFile->getFilePath(), aFile->isWhole(), aFile->isWhole()); aFile->forEachSourceLocation( [&locationFile](SourceLocation* loc) diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 605db366..9aa1027e 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -180,11 +180,13 @@ void QtDialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, ); } -void QtDialogView::finishedIndexingDialog(size_t fileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo) +void QtDialogView::finishedIndexingDialog( + size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, + float time, ErrorCountInfo errorInfo) { std::stringstream ss; ss << "Finished indexing: "; - ss << fileCount << "/" << totalFileCount << " files; "; + ss << indexedFileCount << "/" << totalIndexedFileCount << " source files indexed; "; ss << utility::timeToString(time); ss << "; " << errorInfo.total << " error" << (errorInfo.total != 1 ? "s" : ""); if (errorInfo.fatal > 0) @@ -199,7 +201,7 @@ void QtDialogView::finishedIndexingDialog(size_t fileCount, size_t totalFileCoun m_windowStack.clearWindows(); QtIndexingDialog* window = createWindow(); - window->setupReport(fileCount, totalFileCount, time); + window->setupReport(indexedFileCount, totalIndexedFileCount, completedFileCount, totalFileCount, time); window->updateErrorCount(errorInfo.total, errorInfo.fatal); setUIBlocked(false); diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index 9624a4d7..854318b0 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -37,7 +37,9 @@ public: virtual DialogView::IndexMode startIndexingDialog(size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, bool forceRefresh, bool needsFullRefresh) override; virtual void updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath) override; - virtual void finishedIndexingDialog(size_t fileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo) override; + virtual void finishedIndexingDialog( + size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, + float time, ErrorCountInfo errorInfo) override; int confirm(const std::string& message, const std::vector& options) override; diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp index dbcf543a..a35923fc 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp @@ -397,7 +397,7 @@ void QtGraphNode::setStyle(const GraphViewStyle::NodeStyle& style) if (style.hasHatching) { QtDeviceScaledPixmap pattern((ResourcePaths::getGuiPath() + "graph_view/images/pattern.png").c_str()); - pattern.scaleToHeight(10); + pattern.scaleToHeight(12); QPixmap pixmap = utility::colorizePixmap(pattern.pixmap(), style.color.hatching.c_str()); pen.setWidth(0); diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp index 3bd1adbd..25a89936 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp @@ -19,7 +19,11 @@ QtGraphNodeData::QtGraphNodeData(const Node* data, const std::string& name, bool this->setName(name); std::string toolTip = data->getReadableTypeString(); - if (!data->isDefined() && !data->isType(Node::NODE_NON_INDEXED)) + if (!data->isDefined() && data->isType(Node::NODE_FILE)) + { + toolTip = "incomplete " + toolTip; + } + else if (!data->isDefined() && !data->isType(Node::NODE_NON_INDEXED)) { toolTip = "non-indexed " + toolTip; } diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 33399871..e76d94ae 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -131,22 +131,25 @@ void QtIndexingDialog::setupIndexing() finishSetup(); } -void QtIndexingDialog::setupReport(size_t fileCount, size_t totalFileCount, float time) +void QtIndexingDialog::setupReport( + size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, + float time) { QBoxLayout* layout = createLayout(); addTitle("Finished Indexing", layout); layout->addSpacing(5); - addMessageLabel(layout); - updateMessage( - QString::number(fileCount) + "/" + QString::number(totalFileCount) + " File" + (totalFileCount > 1 ? "s" : "") + createMessageLabel(layout)->setText( + "Source Files indexed: " + QString::number(indexedFileCount) + "/" + QString::number(totalIndexedFileCount) ); - QLabel* timeLabel = new QLabel("Total Time: " + QString::fromStdString(utility::timeToString(time))); - timeLabel->setObjectName("message"); - timeLabel->setAlignment(Qt::AlignRight); - layout->addWidget(timeLabel, 0, Qt::AlignRight); + createMessageLabel(layout)->setText( + "Files completed: " + QString::number(completedFileCount) + "/" + QString::number(totalFileCount) + ); + + layout->addSpacing(12); + createMessageLabel(layout)->setText("Total Time: " + QString::fromStdString(utility::timeToString(time))); layout->addSpacing(12); addErrorLabel(layout); @@ -157,9 +160,9 @@ void QtIndexingDialog::setupReport(size_t fileCount, size_t totalFileCount, floa updateNextButton("OK"); setCloseVisible(false); - m_sizeHint = QSize(400, 260); + m_sizeHint = QSize(400, 280); - if (fileCount != totalFileCount) + if (indexedFileCount != totalIndexedFileCount) { updateTitle("Interrupted Indexing"); } @@ -364,11 +367,7 @@ void QtIndexingDialog::addPercentLabel(QBoxLayout* layout) void QtIndexingDialog::addMessageLabel(QBoxLayout* layout) { - m_messageLabel = new QLabel(); - m_messageLabel->setObjectName("message"); - m_messageLabel->setAlignment(Qt::AlignRight); - m_messageLabel->setWordWrap(true); - layout->addWidget(m_messageLabel, 0, Qt::AlignRight); + m_messageLabel = createMessageLabel(layout); } QLabel* QtIndexingDialog::createMessageLabel(QBoxLayout* layout) @@ -377,7 +376,7 @@ QLabel* QtIndexingDialog::createMessageLabel(QBoxLayout* layout) label->setObjectName("message"); label->setAlignment(Qt::AlignRight); label->setWordWrap(true); - layout->addWidget(label, 0, Qt::AlignRight); + layout->addWidget(label); return label; } diff --git a/src/lib_gui/qt/window/QtIndexingDialog.h b/src/lib_gui/qt/window/QtIndexingDialog.h index 455a2f78..9d0bad64 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.h +++ b/src/lib_gui/qt/window/QtIndexingDialog.h @@ -31,7 +31,8 @@ public: void setupStart(size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, bool forceRefresh, bool needsFullRefresh, std::function callback); void setupIndexing(); - void setupReport(size_t fileCount, size_t totalFileCount, float time); + void setupReport( + size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time); void setupStatus(); void setupProgress(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp index 86830b97..d788d0c8 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp @@ -1,7 +1,7 @@ #include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h" #include "settings/SourceGroupSettingsCxx.h" -#include "data/indexer/IndexerCxxCdb.h" +#include "data/indexer/IndexerCommandCxxCdb.h" QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource( std::shared_ptr settings, QtProjectWizzardWindow* window @@ -36,7 +36,7 @@ void QtProjectWizzardContentCDBSource::load() std::shared_ptr cxxSettings = std::dynamic_pointer_cast(m_settings); if (cxxSettings) { - std::vector filePaths = IndexerCxxCdb::getSourceFilesFromCDB(cxxSettings->getAbsoluteCompilationDatabasePath()); + std::vector filePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cxxSettings->getAbsoluteCompilationDatabasePath()); for (FilePath path : filePaths) { diff --git a/src/lib_java/CMakeLists.txt b/src/lib_java/CMakeLists.txt index edcbed73..5bb5066c 100644 --- a/src/lib_java/CMakeLists.txt +++ b/src/lib_java/CMakeLists.txt @@ -6,21 +6,19 @@ add_files( data/indexer/IndexerCommandJava.h data/indexer/IndexerFactoryModuleJava.cpp data/indexer/IndexerFactoryModuleJava.h - data/indexer/IndexerJava.cpp - data/indexer/IndexerJava.h - + data/parser/java/JavaParser.cpp data/parser/java/JavaParser.h data/parser/java/JavaEnvironment.cpp data/parser/java/JavaEnvironment.h data/parser/java/JavaEnvironmentFactory.cpp data/parser/java/JavaEnvironmentFactory.h - + project/SourceGroupJava.cpp project/SourceGroupJava.h project/SourceGroupFactoryModuleJava.cpp project/SourceGroupFactoryModuleJava.h - + utility/utilityMaven.cpp utility/utilityMaven.h ) diff --git a/src/lib_java/data/indexer/IndexerFactoryModuleJava.cpp b/src/lib_java/data/indexer/IndexerFactoryModuleJava.cpp index cb68183f..4e78aebf 100644 --- a/src/lib_java/data/indexer/IndexerFactoryModuleJava.cpp +++ b/src/lib_java/data/indexer/IndexerFactoryModuleJava.cpp @@ -1,6 +1,8 @@ #include "data/indexer/IndexerFactoryModuleJava.h" -#include "data/indexer/IndexerJava.h" +#include "data/indexer/Indexer.h" +#include "data/indexer/IndexerCommandJava.h" +#include "data/parser/java/JavaParser.h" IndexerFactoryModuleJava::~IndexerFactoryModuleJava() { @@ -8,5 +10,5 @@ IndexerFactoryModuleJava::~IndexerFactoryModuleJava() std::shared_ptr IndexerFactoryModuleJava::createIndexer() { - return std::make_shared(); + return std::make_shared>(); } diff --git a/src/lib_java/data/indexer/IndexerJava.cpp b/src/lib_java/data/indexer/IndexerJava.cpp deleted file mode 100644 index f4d51ed8..00000000 --- a/src/lib_java/data/indexer/IndexerJava.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "data/indexer/IndexerJava.h" - -#include "data/parser/ParserClientImpl.h" -#include "data/parser/java/JavaParser.h" -#include "utility/file/FileRegister.h" - -IndexerJava::IndexerJava() -{ -} - -IndexerJava::~IndexerJava() -{ -} - -std::shared_ptr IndexerJava::index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister) -{ - std::shared_ptr parserClient = std::make_shared(); - std::shared_ptr parser = std::make_shared(parserClient); - - std::shared_ptr storage = std::make_shared(); - parserClient->setStorage(storage); - parserClient->startParsingFile(); - - fileRegister->markFileIndexing(indexerCommand->getSourceFilePath()); - parser->buildIndex(indexerCommand); - fileRegister->markIndexingFilesIndexed(); - - parserClient->finishParsingFile(); - parserClient->resetStorage(); - - if (interrupted()) - { - return std::shared_ptr(); - } - - return storage; -} diff --git a/src/lib_java/data/indexer/IndexerJava.h b/src/lib_java/data/indexer/IndexerJava.h deleted file mode 100644 index 0a09febd..00000000 --- a/src/lib_java/data/indexer/IndexerJava.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef INDEXER_JAVA_H -#define INDEXER_JAVA_H - -#include "data/indexer/Indexer.h" -#include "data/indexer/IndexerCommandJava.h" - -class IndexerJava: public Indexer -{ -public: - IndexerJava(); - virtual ~IndexerJava(); - -private: - virtual std::shared_ptr index(std::shared_ptr indexerCommand, std::shared_ptr fileRegister); -}; - -#endif // INDEXER_JAVA_H diff --git a/src/lib_java/data/parser/java/JavaParser.cpp b/src/lib_java/data/parser/java/JavaParser.cpp index feb2d554..1329ba3d 100644 --- a/src/lib_java/data/parser/java/JavaParser.cpp +++ b/src/lib_java/data/parser/java/JavaParser.cpp @@ -11,7 +11,7 @@ #include "utility/text/TextAccess.h" #include "utility/utilityString.h" -JavaParser::JavaParser(std::shared_ptr client) +JavaParser::JavaParser(std::shared_ptr client, std::shared_ptr fileRegister) : Parser(client) , m_id(s_nextParserId++) , m_currentFilePath("") diff --git a/src/lib_java/data/parser/java/JavaParser.h b/src/lib_java/data/parser/java/JavaParser.h index 2ddb8361..710748a2 100644 --- a/src/lib_java/data/parser/java/JavaParser.h +++ b/src/lib_java/data/parser/java/JavaParser.h @@ -29,7 +29,7 @@ class FileRegister; class JavaParser: public Parser { public: - JavaParser(std::shared_ptr client); + JavaParser(std::shared_ptr client, std::shared_ptr fileRegister); ~JavaParser(); void buildIndex(std::shared_ptr indexerCommand); @@ -168,7 +168,6 @@ private: void doRecordComment(jint beginLine, jint beginColumn, jint endLine, jint endColumn); void doRecordError(jstring jMessage, jint jFatal, jint jIndexed, jint beginLine, jint beginColumn, jint endLine, jint endColumn); - std::shared_ptr m_fileRegister; std::shared_ptr m_javaEnvironment; const int m_id; diff --git a/src/test/JavaParserTestSuite.h b/src/test/JavaParserTestSuite.h index d050c0e3..4f6ad8dc 100644 --- a/src/test/JavaParserTestSuite.h +++ b/src/test/JavaParserTestSuite.h @@ -10,7 +10,6 @@ #include "data/parser/java/JavaEnvironmentFactory.h" #include "data/parser/java/JavaParser.h" -#include "helper/TestFileRegister.h" #include "helper/TestParserClient.h" @@ -842,7 +841,7 @@ private: setupJavaEnvironmentFactory(); - JavaParser parser(parserClient); + JavaParser parser(parserClient, nullptr); parser.buildIndex("input.cc", textAccess); return parserClient; diff --git a/src/test/StorageTestSuite.h b/src/test/StorageTestSuite.h index d8f8a944..44e87fa8 100644 --- a/src/test/StorageTestSuite.h +++ b/src/test/StorageTestSuite.h @@ -24,7 +24,7 @@ public: std::shared_ptr intermetiateStorage = std::make_shared(); Id id = intermetiateStorage->addNode(Node::typeToInt(Node::NODE_FILE), NameHierarchy::serialize(NameHierarchy(filePath))); - intermetiateStorage->addFile(id, filePath, "someTime"); + intermetiateStorage->addFile(id, filePath, "someTime", true); storage.inject(intermetiateStorage.get()); diff --git a/src/test/helper/TestParserClient.h b/src/test/helper/TestParserClient.h index 65e645d1..2bdd3522 100644 --- a/src/test/helper/TestParserClient.h +++ b/src/test/helper/TestParserClient.h @@ -7,14 +7,6 @@ class TestParserClient: public ParserClient { public: - virtual void startParsingFile() - { - } - - virtual void finishParsingFile() - { - } - virtual Id recordSymbol( const NameHierarchy& symbolName, SymbolKind symbolKind, AccessKind access, DefinitionKind definitionKind)