From: Alex Langford Date: Tue, 2 May 2023 00:29:28 +0000 (-0700) Subject: [lldb] Refactor SBFileSpec::GetDirectory X-Git-Tag: upstream/17.0.6~9742 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2bea2d7b070dc5df723ce2b92dbc654b8bb1847e;p=platform%2Fupstream%2Fllvm.git [lldb] Refactor SBFileSpec::GetDirectory There's no reason to create an entire new filespec to mutate and grab data from when we can just grab the data directly. Differential Revision: https://reviews.llvm.org/D149625 --- diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index a7df9afc4b8e..8668b64b4ce7 100644 --- a/lldb/source/API/SBFileSpec.cpp +++ b/lldb/source/API/SBFileSpec.cpp @@ -114,9 +114,7 @@ const char *SBFileSpec::GetFilename() const { const char *SBFileSpec::GetDirectory() const { LLDB_INSTRUMENT_VA(this); - FileSpec directory{*m_opaque_up}; - directory.ClearFilename(); - return directory.GetPathAsConstString().GetCString(); + return m_opaque_up->GetDirectory().GetCString(); } void SBFileSpec::SetFilename(const char *filename) {