Skip to content

Commit

Permalink
[DWARF] Guess the path style
Browse files Browse the repository at this point in the history
Try to guess the FileSpec path style before defaulting to native.

llvm-svn: 368746
  • Loading branch information
JDevlieghere committed Aug 13, 2019
1 parent edb7885 commit 4d82fa6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,22 @@ ParseSupportFilesFromPrologue(const lldb::ModuleSP &module,
continue;
}

auto maybe_path_style = FileSpec::GuessPathStyle(original_file);
FileSpec::Style style =
maybe_path_style ? *maybe_path_style : FileSpec::Style::native;

std::string remapped_file;
if (!prologue.getFileNameByIndex(
idx, compile_dir,
llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
remapped_file)) {
// Always add an entry so the indexes remain correct.
support_files.EmplaceBack(original_file, FileSpec::Style::native);
support_files.EmplaceBack(original_file, style);
continue;
}

module->RemapSourceFile(llvm::StringRef(original_file), remapped_file);
support_files.EmplaceBack(remapped_file, FileSpec::Style::native);
support_files.EmplaceBack(remapped_file, style);
}

return support_files;
Expand Down

0 comments on commit 4d82fa6

Please sign in to comment.