diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
| commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
| tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Target/PathMappingList.cpp | |
| parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) | |
Diffstat (limited to 'source/Target/PathMappingList.cpp')
| -rw-r--r-- | source/Target/PathMappingList.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/source/Target/PathMappingList.cpp b/source/Target/PathMappingList.cpp index 778728eebb09..c2249cce89b9 100644 --- a/source/Target/PathMappingList.cpp +++ b/source/Target/PathMappingList.cpp @@ -7,19 +7,16 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes #include <climits> #include <cstring> -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private-enumerations.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" +#include "lldb/lldb-private-enumerations.h" using namespace lldb; using namespace lldb_private; @@ -37,7 +34,7 @@ namespace { ConstString NormalizePath(const ConstString &path) { // If we use "path" to construct a FileSpec, it will normalize the path for // us. We then grab the string and turn it back into a ConstString. - return ConstString(FileSpec(path.GetStringRef(), false).GetPath()); + return ConstString(FileSpec(path.GetStringRef()).GetPath()); } } //---------------------------------------------------------------------- @@ -176,13 +173,13 @@ bool PathMappingList::RemapPath(llvm::StringRef path, // We need to figure out if the "path" argument is relative. If it is, // then we should remap, else skip this entry. if (path_is_relative == eLazyBoolCalculate) { - path_is_relative = FileSpec(path, false).IsRelative() ? eLazyBoolYes : - eLazyBoolNo; + path_is_relative = + FileSpec(path).IsRelative() ? eLazyBoolYes : eLazyBoolNo; } if (!path_is_relative) continue; } - FileSpec remapped(it.second.GetStringRef(), false); + FileSpec remapped(it.second.GetStringRef()); remapped.AppendPathComponent(path); new_path = remapped.GetPath(); return true; @@ -196,7 +193,7 @@ bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) co for (const auto &it : m_pairs) { if (!path_ref.consume_front(it.second.GetStringRef())) continue; - fixed.SetFile(it.first.GetStringRef(), false, FileSpec::Style::native); + fixed.SetFile(it.first.GetStringRef(), FileSpec::Style::native); fixed.AppendPathComponent(path_ref); return true; } @@ -216,10 +213,9 @@ bool PathMappingList::FindFile(const FileSpec &orig_spec, if (orig_path_len >= prefix_len) { if (::strncmp(pos->first.GetCString(), orig_path, prefix_len) == 0) { - new_spec.SetFile(pos->second.GetCString(), false, - FileSpec::Style::native); + new_spec.SetFile(pos->second.GetCString(), FileSpec::Style::native); new_spec.AppendPathComponent(orig_path + prefix_len); - if (new_spec.Exists()) + if (FileSystem::Instance().Exists(new_spec)) return true; } } |
