Changeset View
Changeset View
Standalone View
Standalone View
lldb/include/lldb/Core/DataFileCache.h
//===-- DataFileCache.h -----------------------------------------*- C++ -*-===// | //===-- DataFileCache.h -----------------------------------------*- C++ -*-===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#ifndef LLDB_CORE_DATAFILECACHE_H | #ifndef LLDB_CORE_DATAFILECACHE_H | ||||
#define LLDB_CORE_DATAFILECACHE_H | #define LLDB_CORE_DATAFILECACHE_H | ||||
#include "lldb/Utility/FileSpec.h" | #include "lldb/Utility/FileSpec.h" | ||||
#include "lldb/Utility/Status.h" | #include "lldb/Utility/Status.h" | ||||
#include "lldb/Utility/UUID.h" | #include "lldb/Utility/UUID.h" | ||||
#include "lldb/lldb-forward.h" | #include "lldb/lldb-forward.h" | ||||
#include "llvm/ADT/DenseMap.h" | |||||
#include "llvm/Support/Caching.h" | #include "llvm/Support/Caching.h" | ||||
#include <mutex> | #include <mutex> | ||||
namespace lldb_private { | namespace lldb_private { | ||||
/// This class enables data to be cached into a directory using the llvm | /// This class enables data to be cached into a directory using the llvm | ||||
/// caching code. Data can be stored and accessed using a unique string key. | /// caching code. Data can be stored and accessed using a unique string key. | ||||
/// The data will be stored in the directory that is specified in the | /// The data will be stored in the directory that is specified in the | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | public: | ||||
/// string. Duplicate strings that get inserted will return the same | /// string. Duplicate strings that get inserted will return the same | ||||
/// byte offset. | /// byte offset. | ||||
uint32_t Add(ConstString s); | uint32_t Add(ConstString s); | ||||
bool Encode(DataEncoder &encoder); | bool Encode(DataEncoder &encoder); | ||||
private: | private: | ||||
std::vector<ConstString> m_strings; | std::vector<ConstString> m_strings; | ||||
std::map<ConstString, uint32_t> m_string_to_offset; | llvm::DenseMap<ConstString, uint32_t> m_string_to_offset; | ||||
/// Skip one byte to start the string table off with an empty string. | /// Skip one byte to start the string table off with an empty string. | ||||
uint32_t m_next_offset = 1; | uint32_t m_next_offset = 1; | ||||
}; | }; | ||||
/// Many cache files require string tables to store data efficiently. This | /// Many cache files require string tables to store data efficiently. This | ||||
/// class helps give out strings from a string table that was read from a | /// class helps give out strings from a string table that was read from a | ||||
/// cache file. | /// cache file. | ||||
class StringTableReader { | class StringTableReader { | ||||
Show All 15 Lines |