diff options
-rw-r--r-- | lldb/include/lldb/Host/FileSystem.h | 8 | ||||
-rw-r--r-- | lldb/include/lldb/Utility/FileCollector.h | 41 | ||||
-rw-r--r-- | lldb/include/lldb/Utility/Reproducer.h | 12 | ||||
-rw-r--r-- | lldb/source/Host/common/FileSystem.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h | 6 |
5 files changed, 15 insertions, 56 deletions
diff --git a/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h index 865b09b2310..a5f2e245140 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -11,12 +11,12 @@ #include "lldb/Host/File.h" #include "lldb/Utility/DataBufferLLVM.h" -#include "lldb/Utility/FileCollector.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/Chrono.h" +#include "llvm/Support/FileCollector.h" #include "llvm/Support/VirtualFileSystem.h" #include "lldb/lldb-types.h" @@ -34,7 +34,7 @@ public: FileSystem() : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr), m_mapped(false) {} - FileSystem(FileCollector &collector) + FileSystem(llvm::FileCollector &collector) : m_fs(llvm::vfs::getRealFileSystem()), m_collector(&collector), m_mapped(false) {} FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs, @@ -47,7 +47,7 @@ public: static FileSystem &Instance(); static void Initialize(); - static void Initialize(FileCollector &collector); + static void Initialize(llvm::FileCollector &collector); static llvm::Error Initialize(const FileSpec &mapping); static void Initialize(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs); static void Terminate(); @@ -188,7 +188,7 @@ public: private: static llvm::Optional<FileSystem> &InstanceImpl(); llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs; - FileCollector *m_collector; + llvm::FileCollector *m_collector; bool m_mapped; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Utility/FileCollector.h b/lldb/include/lldb/Utility/FileCollector.h deleted file mode 100644 index 22c1c6d7526..00000000000 --- a/lldb/include/lldb/Utility/FileCollector.h +++ /dev/null @@ -1,41 +0,0 @@ -//===-- FileCollector.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_UTILITY_FILE_COLLECTOR_H -#define LLDB_UTILITY_FILE_COLLECTOR_H - -#include "lldb/Utility/FileSpec.h" - -#include "llvm/Support/FileCollector.h" - -namespace lldb_private { - -/// Collects files into a directory and generates a mapping that can be used by -/// the VFS. -class FileCollector : public llvm::FileCollector { -public: - FileCollector(const FileSpec &root, const FileSpec &overlay) : - llvm::FileCollector(root.GetPath(), overlay.GetPath()) {} - - using llvm::FileCollector::addFile; - - void addFile(const FileSpec &file) { - std::string path = file.GetPath(); - llvm::FileCollector::addFile(path); - } - - /// Write the yaml mapping (for the VFS) to the given file. - std::error_code writeMapping(const FileSpec &mapping_file) { - std::string path = mapping_file.GetPath(); - return llvm::FileCollector::writeMapping(path); - } -}; - -} // namespace lldb_private - -#endif // LLDB_UTILITY_FILE_COLLECTOR_H diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h index 1c4486bef0f..ecd6b6f08f5 100644 --- a/lldb/include/lldb/Utility/Reproducer.h +++ b/lldb/include/lldb/Utility/Reproducer.h @@ -9,11 +9,11 @@ #ifndef LLDB_UTILITY_REPRODUCER_H #define LLDB_UTILITY_REPRODUCER_H -#include "lldb/Utility/FileCollector.h" #include "lldb/Utility/FileSpec.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FileCollector.h" #include "llvm/Support/YAMLTraits.h" #include <mutex> @@ -91,23 +91,23 @@ public: FileProvider(const FileSpec &directory) : Provider(directory), - m_collector(directory.CopyByAppendingPathComponent("root"), directory) { - } + m_collector(directory.CopyByAppendingPathComponent("root").GetPath(), + directory.GetPath()) {} - FileCollector &GetFileCollector() { return m_collector; } + llvm::FileCollector &GetFileCollector() { return m_collector; } void Keep() override { auto mapping = GetRoot().CopyByAppendingPathComponent(Info::file); // Temporary files that are removed during execution can cause copy errors. if (auto ec = m_collector.copyFiles(/*stop_on_error=*/false)) return; - m_collector.writeMapping(mapping); + m_collector.writeMapping(mapping.GetPath()); } static char ID; private: - FileCollector m_collector; + llvm::FileCollector m_collector; }; /// Provider for the LLDB version number. diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index 61ee73ff6ea..3b4db43966e 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -49,7 +49,7 @@ void FileSystem::Initialize() { InstanceImpl().emplace(); } -void FileSystem::Initialize(lldb_private::FileCollector &collector) { +void FileSystem::Initialize(FileCollector &collector) { lldbassert(!InstanceImpl() && "Already initialized."); InstanceImpl().emplace(collector); } @@ -418,7 +418,7 @@ static mode_t GetOpenMode(uint32_t permissions) { Status FileSystem::Open(File &File, const FileSpec &file_spec, uint32_t options, uint32_t permissions, bool should_close_fd) { if (m_collector) - m_collector->addFile(file_spec); + m_collector->addFile(file_spec.GetPath()); if (File.IsValid()) File.Close(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h b/lldb/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h index ad4c4690afb..9660abf1bfa 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h @@ -9,15 +9,15 @@ #ifndef liblldb_ModuleDependencyCollector_h_ #define liblldb_ModuleDependencyCollector_h_ -#include "lldb/Utility/FileCollector.h" #include "clang/Frontend/Utils.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/FileCollector.h" namespace lldb_private { class ModuleDependencyCollectorAdaptor : public clang::ModuleDependencyCollector { public: - ModuleDependencyCollectorAdaptor(FileCollector &file_collector) + ModuleDependencyCollectorAdaptor(llvm::FileCollector &file_collector) : clang::ModuleDependencyCollector(""), m_file_collector(file_collector) { } @@ -31,7 +31,7 @@ public: void writeFileMap() override {} private: - FileCollector &m_file_collector; + llvm::FileCollector &m_file_collector; }; } // namespace lldb_private |