#include "project/SourceGroupCxxEmpty.h" #include "data/indexer/IndexerCommandCxxManual.h" #include "settings/ApplicationSettings.h" #include "utility/utility.h" SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr settings) : m_settings(settings) { } SourceGroupCxxEmpty::~SourceGroupCxxEmpty() { } SourceGroupType SourceGroupCxxEmpty::getType() const { return m_settings->getType(); // may be either C or Cpp } std::vector> SourceGroupCxxEmpty::getIndexerCommands(const std::set& filesToIndex) { std::shared_ptr appSettings = ApplicationSettings::getInstance(); std::vector systemHeaderSearchPaths; utility::append(systemHeaderSearchPaths, m_settings->getHeaderSearchPathsExpandedAndAbsolute()); utility::append(systemHeaderSearchPaths, appSettings->getHeaderSearchPathsExpanded()); // Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files. for (const FilePath& sourcePath: m_settings->getSourcePathsExpandedAndAbsolute()) { if (sourcePath.isDirectory()) { systemHeaderSearchPaths.push_back(sourcePath); } } std::vector frameworkSearchPaths; utility::append(frameworkSearchPaths, m_settings->getFrameworkSearchPathsExpandedAndAbsolute()); utility::append(frameworkSearchPaths, appSettings->getFrameworkSearchPathsExpanded()); std::vector compilerFlags; { const std::string targetFlag = m_settings->getTargetFlag(); if (!targetFlag.empty()) { compilerFlags.push_back(targetFlag); } } utility::append(compilerFlags, m_settings->getCompilerFlags()); std::set indexedPaths = getIndexedPaths(); std::set excludedPaths = getExcludedPaths(); std::vector> indexerCommands; for (const FilePath& sourcePath: getAllSourceFilePaths()) { if (filesToIndex.find(sourcePath) != filesToIndex.end()) { indexerCommands.push_back(std::make_shared( sourcePath, indexedPaths, excludedPaths, m_settings->getStandard(), systemHeaderSearchPaths, frameworkSearchPaths, compilerFlags, m_settings->getShouldApplyAnonymousTypedefTransformation() )); } } return indexerCommands; } std::shared_ptr SourceGroupCxxEmpty::getSourceGroupSettingsCxx() { return m_settings; } std::vector SourceGroupCxxEmpty::getAllSourcePaths() const { return m_settings->getSourcePathsExpandedAndAbsolute(); }