Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:48

0001 //===-- FileCache.h ---------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 #ifndef LLDB_HOST_FILECACHE_H
0009 #define LLDB_HOST_FILECACHE_H
0010 
0011 #include <cstdint>
0012 #include <map>
0013 
0014 #include "lldb/lldb-forward.h"
0015 #include "lldb/lldb-types.h"
0016 
0017 #include "lldb/Host/File.h"
0018 #include "lldb/Utility/FileSpec.h"
0019 #include "lldb/Utility/Status.h"
0020 
0021 namespace lldb_private {
0022 class FileCache {
0023 private:
0024   FileCache() = default;
0025 
0026   typedef std::map<lldb::user_id_t, lldb::FileUP> FDToFileMap;
0027 
0028 public:
0029   static FileCache &GetInstance();
0030 
0031   lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
0032                            uint32_t mode, Status &error);
0033   bool CloseFile(lldb::user_id_t fd, Status &error);
0034 
0035   uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
0036                      uint64_t src_len, Status &error);
0037   uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
0038                     uint64_t dst_len, Status &error);
0039 
0040 private:
0041   static FileCache *m_instance;
0042 
0043   FDToFileMap m_cache;
0044 };
0045 }
0046 
0047 #endif