Rename `FileSpec::IsRelativeToCurrentWorkingDirectory` to `IsRelative`.
Summary:
`IsRelativeToCurrentWorkingDirectory` was misleading, because relative paths
are sometimes appended to other directories, not just the cwd. Plus, the new
name is shorter. Also added `IsAbsolute` for completeness.
Reviewers: clayborg, ovyalov
Reviewed By: ovyalov
Subscribers: tberghammer, lldb-commits
Differential Revision: http://reviews.llvm.org/D10262
llvm-svn: 239419
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index c3b6aa5..d988b7f 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -1484,7 +1484,7 @@
}
bool
-FileSpec::IsRelativeToCurrentWorkingDirectory () const
+FileSpec::IsRelative() const
{
const char *dir = m_directory.GetCString();
llvm::StringRef directory(dir ? dir : "");
@@ -1519,3 +1519,9 @@
}
return false;
}
+
+bool
+FileSpec::IsAbsolute() const
+{
+ return !FileSpec::IsRelative();
+}
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 3666b5a..3a3023b 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -225,7 +225,7 @@
HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec)
{
if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) &&
- !file_spec.IsRelativeToCurrentWorkingDirectory() &&
+ file_spec.IsAbsolute() &&
file_spec.Exists())
return true;
file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory();
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 997742d..ed74957 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -215,7 +215,7 @@
return PlatformLinux::GetFile(source, destination);
FileSpec source_spec (source.GetPath (false), false, FileSpec::ePathSyntaxPosix);
- if (source_spec.IsRelativeToCurrentWorkingDirectory ())
+ if (source_spec.IsRelative())
source_spec = GetRemoteWorkingDirectory ().CopyByAppendingPathComponent (source_spec.GetCString (false));
AdbClient adb (m_device_id);
@@ -232,7 +232,7 @@
return PlatformLinux::PutFile (source, destination, uid, gid);
FileSpec destination_spec (destination.GetPath (false), false, FileSpec::ePathSyntaxPosix);
- if (destination_spec.IsRelativeToCurrentWorkingDirectory ())
+ if (destination_spec.IsRelative())
destination_spec = GetRemoteWorkingDirectory ().CopyByAppendingPathComponent (destination_spec.GetCString (false));
AdbClient adb (m_device_id);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index 2ca0974..48e11bd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -519,14 +519,14 @@
debug_line_data.Skip_LEB128(&offset); // Skip mod_time
debug_line_data.Skip_LEB128(&offset); // Skip length
- if (file_spec.IsRelativeToCurrentWorkingDirectory())
+ if (file_spec.IsRelative())
{
if (0 < dir_idx && dir_idx < include_directories.size())
{
const FileSpec &dir = include_directories[dir_idx];
file_spec.PrependPathComponent(dir);
}
- if (file_spec.IsRelativeToCurrentWorkingDirectory())
+ if (file_spec.IsRelative())
file_spec.PrependPathComponent(cu_comp_dir);
}
std::string remapped_file;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 7ed2998..6078d3a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -977,7 +977,7 @@
{
// If we have a full path to the compile unit, we don't need to resolve
// the file. This can be expensive e.g. when the source files are NFS mounted.
- if (cu_file_spec.IsRelativeToCurrentWorkingDirectory())
+ if (cu_file_spec.IsRelative())
{
// DWARF2/3 suggests the form hostname:pathname for compilation directory.
// Remove the host part if present.
diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp
index ec1c3c6..30c5aee 100644
--- a/lldb/source/Target/ProcessLaunchInfo.cpp
+++ b/lldb/source/Target/ProcessLaunchInfo.cpp
@@ -423,7 +423,7 @@
// is a relative path.
const char *argv0 = argv[0];
FileSpec arg_spec(argv0, false);
- if (arg_spec.IsRelativeToCurrentWorkingDirectory())
+ if (arg_spec.IsRelative())
{
// We have a relative path to our executable which may not work if
// we just try to run "a.out" (without it being converted to "./a.out")
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 70ccd04..552e951 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -412,7 +412,7 @@
if (file.GetFileType() == FileSpec::eFileTypeDirectory)
user_exe_path_is_bundle = true;
- if (file.IsRelativeToCurrentWorkingDirectory() && user_exe_path)
+ if (file.IsRelative() && user_exe_path)
{
// Ignore paths that start with "./" and "../"
if (!((user_exe_path[0] == '.' && user_exe_path[1] == '/') ||