[Lldb-commits] [PATCH] D149625: [lldb] Refactor SBFileSpec::GetDirectory

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 1 17:31:25 PDT 2023


bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, mib, jingham.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

There's no reason to create an entire new filespec to mutate and grab
data from when we can just grab the data directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149625

Files:
  lldb/source/API/SBFileSpec.cpp


Index: lldb/source/API/SBFileSpec.cpp
===================================================================
--- lldb/source/API/SBFileSpec.cpp
+++ lldb/source/API/SBFileSpec.cpp
@@ -114,9 +114,7 @@
 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149625.518611.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230502/f9fd5a99/attachment-0001.bin>


More information about the lldb-commits mailing list