[all-commits] [llvm/llvm-project] 57154a: [lldb] Introduce FileSpec::GetComponents

Alex via All-commits all-commits at lists.llvm.org
Tue May 30 15:13:41 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57154a63a07f732552968141136279350bcdf99d
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    M lldb/include/lldb/Utility/FileSpec.h
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    M lldb/source/Utility/FileSpec.cpp
    M lldb/unittests/Utility/FileSpecTest.cpp

  Log Message:
  [lldb] Introduce FileSpec::GetComponents

This patch introduces FileSpec::GetComponents, a method that splits a
FileSpec's path into its individual components. For example, given
/foo/bar/baz, you'll get back a vector of strings {"foo", "bar", baz"}.

The motivation here is to reduce the use of
`FileSpec::RemoveLastPathComponent`. Mutating a FileSpec is expensive,
so providing a way of doing this without mutation is useful.

Differential Revision: https://reviews.llvm.org/D151399

More information about the All-commits mailing list