diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -408,8 +408,6 @@ /// A boolean value indicating whether the path was updated. bool RemoveLastPathComponent(); - ConstString GetLastPathComponent() const; - protected: // Convenience method for setting the file without changing the style. void SetFile(llvm::StringRef path); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -623,7 +623,7 @@ if (!gnu_debuglink_crc) { LLDB_SCOPED_TIMERF( "Calculating module crc32 %s with size %" PRIu64 " KiB", - file.GetLastPathComponent().AsCString(), + file.GetFilename().AsCString(), (length - file_offset) / 1024); // For core files - which usually don't happen to have a diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -166,7 +166,7 @@ auto raw_data = coff_obj.getData(); LLDB_SCOPED_TIMERF( "Calculating module crc32 %s with size %" PRIu64 " KiB", - FileSpec(coff_obj.getFileName()).GetLastPathComponent().AsCString(), + FileSpec(coff_obj.getFileName()).GetFilename().AsCString(), static_cast(raw_data.size()) / 1024); gnu_debuglink_crc = llvm::crc32(0, llvm::arrayRefFromStringRef(raw_data)); } @@ -295,7 +295,7 @@ const auto *map = GetGlobalPluginProperties().ModuleABIMap(); if (map->GetNumValues() > 0) { // Step 1: Try with the exact file name. - auto name = file.GetLastPathComponent(); + auto name = file.GetFilename(); module_env_option = map->GetValueForKey(name); if (!module_env_option) { // Step 2: Try with the file name in lowercase. diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1238,10 +1238,9 @@ FileSpec platform_pull_upart(platform_file); std::vector path_parts; - path_parts.push_back( - platform_pull_upart.GetLastPathComponent().AsCString()); + path_parts.push_back(platform_pull_upart.GetFilename().AsCString()); while (platform_pull_upart.RemoveLastPathComponent()) { - ConstString part = platform_pull_upart.GetLastPathComponent(); + ConstString part = platform_pull_upart.GetFilename(); path_parts.push_back(part.AsCString()); } const size_t path_parts_size = path_parts.size(); diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -1268,7 +1268,7 @@ auto &file_spec = module_sp->GetFileSpec(); found_logging_support_module = - (file_spec.GetLastPathComponent() == logging_module_name); + (file_spec.GetFilename() == logging_module_name); if (found_logging_support_module) break; } diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -435,7 +435,7 @@ // make the new directory and get in there FileSpec dst_dir = rc_baton->dst; if (!dst_dir.GetFilename()) - dst_dir.SetFilename(src.GetLastPathComponent()); + dst_dir.SetFilename(src.GetFilename()); Status error = rc_baton->platform_ptr->MakeDirectory( dst_dir, lldb::eFilePermissionsDirectoryDefault); if (error.Fail()) { diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -429,12 +429,6 @@ return *this; } -ConstString FileSpec::GetLastPathComponent() const { - llvm::SmallString<64> current_path; - GetPath(current_path, false); - return ConstString(llvm::sys::path::filename(current_path, m_style)); -} - void FileSpec::PrependPathComponent(llvm::StringRef component) { llvm::SmallString<64> new_path(component); llvm::SmallString<64> current_path; diff --git a/lldb/source/Utility/XcodeSDK.cpp b/lldb/source/Utility/XcodeSDK.cpp --- a/lldb/source/Utility/XcodeSDK.cpp +++ b/lldb/source/Utility/XcodeSDK.cpp @@ -242,7 +242,7 @@ bool XcodeSDK::SDKSupportsModules(XcodeSDK::Type desired_type, const FileSpec &sdk_path) { - ConstString last_path_component = sdk_path.GetLastPathComponent(); + ConstString last_path_component = sdk_path.GetFilename(); if (!last_path_component) return false;