[Lldb-commits] [lldb] [lldb] Remove ConstString from FileSpec (PR #211394)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 23 10:50:18 PDT 2026


================
@@ -391,32 +395,31 @@ std::string FileSpec::GetPath(bool denormalize) const {
 
 void FileSpec::GetPath(llvm::SmallVectorImpl<char> &path,
                        bool denormalize) const {
-  path.append(m_directory.GetStringRef().begin(),
-              m_directory.GetStringRef().end());
+  path.append(m_directory.begin(), m_directory.end());
   // Since the path was normalized and all paths use '/' when stored in these
   // objects, we don't need to look for the actual syntax specific path
   // separator, we just look for and insert '/'.
-  if (m_directory && m_filename && m_directory.GetStringRef().back() != '/' &&
-      m_filename.GetStringRef().back() != '/')
+  if (!m_directory.empty() && !m_filename.empty() &&
+      m_directory.back() != '/' && m_filename.back() != '/')
     path.insert(path.end(), '/');
-  path.append(m_filename.GetStringRef().begin(),
-              m_filename.GetStringRef().end());
+  path.append(m_filename.begin(), m_filename.end());
   if (denormalize && !path.empty())
     Denormalize(path, m_style);
 }
 
 llvm::StringRef FileSpec::GetFileNameExtension() const {
-  return llvm::sys::path::extension(m_filename.GetStringRef(), m_style);
+  return llvm::sys::path::extension(m_filename, m_style);
 }
 
 llvm::StringRef FileSpec::GetFileNameStrippingExtension() const {
-  return llvm::sys::path::stem(m_filename.GetStringRef(), m_style);
+  return llvm::sys::path::stem(m_filename, m_style);
 }
 
 // Return the size in bytes that this object takes in memory. This returns the
 // size in bytes of this object, not any shared string values it may refer to.
 size_t FileSpec::MemorySize() const {
-  return m_filename.MemorySize() + m_directory.MemorySize();
+  // TODO: This is kinda sus.
----------------
bulbazord wrote:

Yeah, I'll remove the comment before landing... Or maybe I'll even remove the method in a different PR first? If I can...

https://github.com/llvm/llvm-project/pull/211394


More information about the lldb-commits mailing list