Author: jdevlieghere Date: Wed Jul 24 18:08:10 2019 New Revision: 366975 URL: http://llvm.org/viewvc/llvm-project?rev=366975&view=rev Log: [FileCollector] Remove LLDB shim around llvm::FileCollector (NFC)
The FileCollector got lifted into LLVM and a shim was introduced in LLDB to keep the old API that takes FileSpecs. This patch removes that shim and converts the arguments in place. Removed: lldb/trunk/include/lldb/Utility/FileCollector.h Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/Reproducer.h lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=366975&r1=366974&r2=366975&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Jul 24 18:08:10 2019 @@ -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 Removed: lldb/trunk/include/lldb/Utility/FileCollector.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileCollector.h?rev=366974&view=auto ============================================================================== --- lldb/trunk/include/lldb/Utility/FileCollector.h (original) +++ lldb/trunk/include/lldb/Utility/FileCollector.h (removed) @@ -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 Modified: lldb/trunk/include/lldb/Utility/Reproducer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=366975&r1=366974&r2=366975&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/Reproducer.h (original) +++ lldb/trunk/include/lldb/Utility/Reproducer.h Wed Jul 24 18:08:10 2019 @@ -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. Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=366975&r1=366974&r2=366975&view=diff ============================================================================== --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Jul 24 18:08:10 2019 @@ -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 permi 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(); Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h?rev=366975&r1=366974&r2=366975&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h Wed Jul 24 18:08:10 2019 @@ -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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits