From 009404dd379eb21738b42a9481f0327fbfee675b Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Mon, 18 Jun 2018 18:11:43 +0200 Subject: [PATCH] logic: reduced overhead in indexed files for indexer commands generated from CDB * done by removing unrelated .cpp files from the indexed files because they don't get indexed by the respective compilation unit --- src/lib_cxx/project/SourceGroupCxxCdb.cpp | 20 +++++++++----------- src/lib_cxx/project/SourceGroupCxxCdb.h | 1 - 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/lib_cxx/project/SourceGroupCxxCdb.cpp b/src/lib_cxx/project/SourceGroupCxxCdb.cpp index daa3c314..9bbcefd3 100644 --- a/src/lib_cxx/project/SourceGroupCxxCdb.cpp +++ b/src/lib_cxx/project/SourceGroupCxxCdb.cpp @@ -40,7 +40,11 @@ std::set SourceGroupCxxCdb::filterToContainedFilePaths(const std::set< { std::set containedFilePaths; - const std::set indexedPaths = getIndexedPaths(); + const std::set indexedPaths = utility::concat( + getAllSourceFilePaths(), + utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()) + ); + const std::vector excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute(); for (const FilePath& filePath : filePaths) @@ -121,7 +125,7 @@ std::vector> SourceGroupCxxCdb::getIndexerComman const std::vector compilerFlags = m_settings->getCompilerFlags(); - const std::set indexedPaths = getIndexedPaths(); + const std::set indexedHeaderPaths = utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute()); const std::set excludeFilters = utility::toSet(m_settings->getExcludeFiltersExpandedAndAbsolute()); std::vector> indexerCommands; @@ -160,7 +164,7 @@ std::vector> SourceGroupCxxCdb::getIndexerComman { indexerCommands.push_back(std::make_shared( sourcePath, - indexedPaths, + utility::concat(indexedHeaderPaths, { sourcePath }), excludeFilters, std::set(), FilePath(utility::decodeFromUtf8(command.Directory)), @@ -171,6 +175,8 @@ std::vector> SourceGroupCxxCdb::getIndexerComman systemHeaderSearchPaths, frameworkSearchPaths )); + LOG_INFO(std::wstring(L"IndexerCommand: ") + IndexerCommandCxxCdb::serialize(indexerCommands.front()).c_str()); + return indexerCommands; } } } @@ -187,11 +193,3 @@ std::shared_ptr SourceGroupCxxCdb::getSourceGroupSett { return m_settings; } - -std::set SourceGroupCxxCdb::getIndexedPaths() const -{ - std::set indexedPaths; - utility::append(indexedPaths, getAllSourceFilePaths()); - utility::append(indexedPaths, utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute())); - return indexedPaths; -} diff --git a/src/lib_cxx/project/SourceGroupCxxCdb.h b/src/lib_cxx/project/SourceGroupCxxCdb.h index a262c957..6267518c 100644 --- a/src/lib_cxx/project/SourceGroupCxxCdb.h +++ b/src/lib_cxx/project/SourceGroupCxxCdb.h @@ -22,7 +22,6 @@ public: private: std::shared_ptr getSourceGroupSettings() override; std::shared_ptr getSourceGroupSettings() const override; - std::set getIndexedPaths() const; std::shared_ptr m_settings; };