logic: fixed indexed header paths for compilation database project screw up the processing order of includes (issue #571)

* prevented indexed header paths for CDB to be appended to compile command
* fixed exists check for relative paths in QtSelectPathsDialog
* indexed header paths will automatically be updated when a new compilation database is picked
This commit is contained in:
mlangkabel
2018-04-27 17:51:03 +02:00
parent 872d24bf6a
commit a7ef02459a
12 changed files with 145 additions and 78 deletions
+4 -3
View File
@@ -26,7 +26,7 @@ public:
virtual bool prepareIndexing();
void fetchAllSourceFilePaths();
std::set<FilePath> getIndexedPaths() const;
virtual std::set<FilePath> getIndexedPaths() const;
std::set<FilePathFilter> getExcludeFilters() const;
std::set<FilePath> getAllSourceFilePaths() const;
std::set<FilePath> getSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths) const;
@@ -35,12 +35,13 @@ public:
std::set<FilePath> m_allSourceFilePaths;
protected:
std::set<FilePath> findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths) const;
private:
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() = 0;
virtual std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const = 0;
virtual std::vector<FilePath> getAllSourcePaths() const = 0;
std::set<FilePath> findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths) const;
};
#endif // SOURCE_GROUP_H
+10 -1
View File
@@ -12,7 +12,7 @@
#include "utility/utilityString.h"
#include "utility/utilityUuid.h"
const size_t ProjectSettings::VERSION = 5;
const size_t ProjectSettings::VERSION = 6;
const wchar_t PROJECT_FILE_EXTENSION[] = L".srctrlprj";
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
@@ -320,6 +320,15 @@ SettingsMigrator ProjectSettings::getMigrations() const
migrator.addMigration(5, std::make_shared<SettingsMigrationMoveKey>(key + "/exclude_paths/exclude_path", key + "/exclude_filters/exclude_filter"));
}
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings : getAllSourceGroupSettings())
{
if (sourceGroupSettings->getType() == SOURCE_GROUP_CXX_CDB)
{
const std::string key = SourceGroupSettings::s_keyPrefix + sourceGroupSettings->getId();
migrator.addMigration(6, std::make_shared<SettingsMigrationMoveKey>(key + "/source_paths/source_path", key + "/indexed_header_paths/indexed_header_path"));
}
}
return migrator;
}
@@ -20,6 +20,7 @@ void SourceGroupSettingsCxxCdb::load(std::shared_ptr<const ConfigManager> config
const std::string key = s_keyPrefix + getId();
setCompilationDatabasePath(FilePath(getValue<std::wstring>(key + "/build_file_path/compilation_db_path", L"", config)));
setIndexedHeaderPaths(getPathValues(key + "/indexed_header_paths/indexed_header_path", config));
}
void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
@@ -29,6 +30,7 @@ void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
const std::string key = s_keyPrefix + getId();
setValue(key + "/build_file_path/compilation_db_path", getCompilationDatabasePath().wstr(), config);
setPathValues(key + "/indexed_header_paths/indexed_header_path", getIndexedHeaderPaths(), config);
}
bool SourceGroupSettingsCxxCdb::equals(std::shared_ptr<SourceGroupSettings> other) const
@@ -56,3 +58,19 @@ void SourceGroupSettingsCxxCdb::setCompilationDatabasePath(const FilePath& compi
{
m_compilationDatabasePath = compilationDatabasePath;
}
std::vector<FilePath> SourceGroupSettingsCxxCdb::getIndexedHeaderPaths() const
{
return m_indexedHeaderPaths;
}
std::vector<FilePath> SourceGroupSettingsCxxCdb::getIndexedHeaderPathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsExpandedAndAbsolute(getIndexedHeaderPaths());
}
void SourceGroupSettingsCxxCdb::setIndexedHeaderPaths(const std::vector<FilePath>& indexedHeaderPaths)
{
m_indexedHeaderPaths = indexedHeaderPaths;
}
@@ -19,8 +19,13 @@ public:
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
std::vector<FilePath> getIndexedHeaderPaths() const;
std::vector<FilePath> getIndexedHeaderPathsExpandedAndAbsolute() const;
void setIndexedHeaderPaths(const std::vector<FilePath>& indexedHeaderPaths);
private:
FilePath m_compilationDatabasePath;
std::vector<FilePath> m_indexedHeaderPaths;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CDB_H