================ @@ -0,0 +1,63 @@ +//===-- RealpathPrefixes.h --------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_CORE_REALPATHPREFIXES_H +#define LLDB_CORE_REALPATHPREFIXES_H + +#include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/Support/VirtualFileSystem.h" + +#include <optional> +#include <string> +#include <vector> + +namespace lldb_private { +class FileSpec; +class FileSpecList; +class Target; +} // namespace lldb_private + +namespace lldb_private { + +class RealpathPrefixes { +public: + // Prefixes are obtained from FileSpecList, through FileSpec::GetPath(), which + // ensures that the paths are normalized. For example: + // "./foo/.." -> "" + // "./foo/../bar" -> "bar" + explicit RealpathPrefixes(const FileSpecList &file_spec_list); + + // Sets an optional filesystem to use for realpath'ing. If not set, the real + // filesystem will be used. + void SetFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs); + + // Sets an optional Target instance to gather statistics. + void SetTarget(Target *target) { m_target = target; } ---------------- labath wrote:
Could these be set directly in the constructor (maybe as optional arguments)? From what I can tell they're only used to override values in tests, and immutable classes are much easier to reason about. https://github.com/llvm/llvm-project/pull/102223 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits