diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-15 23:53:15 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-15 23:53:15 +0000 |
commit | de0ce98abec0c2ace8e4f7cc2bc7a28fa4cff550 (patch) | |
tree | 87d9cbdcfd732fc7800d8d556af27899e6bf3e0a /llvm/lib/DebugInfo | |
parent | 4660ea953e55dcbb00c0dcc077b08e03dd504df0 (diff) | |
download | bcm5719-llvm-de0ce98abec0c2ace8e4f7cc2bc7a28fa4cff550.tar.gz bcm5719-llvm-de0ce98abec0c2ace8e4f7cc2bc7a28fa4cff550.zip |
[DebugLine] Don't try to guess the path style
In r368879 I made an attempt to guess the path style from the files in
the line table. After some consideration I now think this is a poor
idea. This patch undoes that behavior and instead adds an optional
argument to specify the path style. This allows us to make that decision
elsewhere where we have more information. In case of LLDB based on the
Unit.
llvm-svn: 369072
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp index bc32b742394..dbee28ff5ab 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -16,7 +16,6 @@ #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" #include "llvm/Support/Errc.h" #include "llvm/Support/Format.h" -#include "llvm/Support/Path.h" #include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> @@ -1041,28 +1040,9 @@ static bool isPathAbsoluteOnWindowsOrPosix(const Twine &Path) { sys::path::is_absolute(Path, sys::path::Style::windows); } -/// If given an absolute path, guess the path style. -static sys::path::Style GuessPathStyle(StringRef Path) { - bool Posix = sys::path::is_absolute(Path, sys::path::Style::posix); - bool Windows = sys::path::is_absolute(Path, sys::path::Style::windows); - // This is a relative path. - if (!Posix && !Windows) - return sys::path::Style::native; - // This is a valid absolute path for both Windows and Posix. - if (Posix && Windows) - return sys::path::Style::native; - if (Posix) - return sys::path::Style::posix; - if (Windows) - return sys::path::Style::windows; - - llvm_unreachable("All combinations should have been handled."); -} - -bool DWARFDebugLine::Prologue::getFileNameByIndex(uint64_t FileIndex, - StringRef CompDir, - FileLineInfoKind Kind, - std::string &Result) const { +bool DWARFDebugLine::Prologue::getFileNameByIndex( + uint64_t FileIndex, StringRef CompDir, FileLineInfoKind Kind, + std::string &Result, sys::path::Style Style) const { if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex)) return false; const FileNameEntry &Entry = getFileNameEntry(FileIndex); @@ -1088,11 +1068,11 @@ bool DWARFDebugLine::Prologue::getFileNameByIndex(uint64_t FileIndex, // We know that FileName is not absolute, the only way to have an // absolute path at this point would be if IncludeDir is absolute. if (!CompDir.empty() && !isPathAbsoluteOnWindowsOrPosix(IncludeDir)) - sys::path::append(FilePath, GuessPathStyle(CompDir), CompDir); + sys::path::append(FilePath, Style, CompDir); } // sys::path::append skips empty strings. - sys::path::append(FilePath, GuessPathStyle(IncludeDir), IncludeDir, FileName); + sys::path::append(FilePath, Style, IncludeDir, FileName); Result = FilePath.str(); return true; } |