data: Fixed no indexer commands created for relative file paths in cdb (issue #388)
bug id = 388
This commit is contained in:
@@ -21,10 +21,14 @@ std::vector<FilePath> IndexerCommandCxxCdb::getSourceFilesFromCDB(const FilePath
|
||||
std::vector<FilePath> filePaths;
|
||||
if (cdb)
|
||||
{
|
||||
std::vector<std::string> files = cdb->getAllFiles();
|
||||
for (const std::string& file : files)
|
||||
for (const clang::tooling::CompileCommand& command : cdb->getAllCompileCommands())
|
||||
{
|
||||
filePaths.push_back(FilePath(file));
|
||||
FilePath path = FilePath(command.Filename).canonical();
|
||||
if (!path.isAbsolute())
|
||||
{
|
||||
path = FilePath(command.Directory + '/' + command.Filename).canonical();
|
||||
}
|
||||
filePaths.push_back(path);
|
||||
}
|
||||
}
|
||||
return filePaths;
|
||||
|
||||
@@ -145,13 +145,19 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxx::getIndexerCommands(
|
||||
|
||||
for (clang::tooling::CompileCommand command: cdb->getAllCompileCommands())
|
||||
{
|
||||
if (sourceFilePathsToIndex.find(FilePath(command.Filename)) != sourceFilePathsToIndex.end())
|
||||
FilePath path = FilePath(command.Filename).canonical();
|
||||
if (!path.isAbsolute())
|
||||
{
|
||||
path = FilePath(command.Directory + '/' + command.Filename).canonical();
|
||||
}
|
||||
|
||||
if (sourceFilePathsToIndex.find(path) != sourceFilePathsToIndex.end())
|
||||
{
|
||||
std::vector<std::string> currentCompilerFlags = compilerFlags;
|
||||
currentCompilerFlags.insert(currentCompilerFlags.end(), command.CommandLine.begin(), command.CommandLine.end());
|
||||
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCxxCdb>(
|
||||
FilePath(command.Filename),
|
||||
FilePath(path),
|
||||
indexedPaths,
|
||||
excludedPaths,
|
||||
FilePath(command.Directory),
|
||||
|
||||
Reference in New Issue
Block a user