LLDB mainline
FormatCache.h
Go to the documentation of this file.
1//===-- FormatCache.h ---------------------------------------------*- C++
2//-*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_DATAFORMATTERS_FORMATCACHE_H
11#define LLDB_DATAFORMATTERS_FORMATCACHE_H
12
13#include "lldb/lldb-public.h"
14
15#include "llvm/ADT/StringMap.h"
16
17#include <mutex>
18
19namespace lldb_private {
21private:
48 llvm::StringMap<Entry> m_entries;
49 std::recursive_mutex m_mutex;
50
51 uint64_t m_cache_hits = 0;
52 uint64_t m_cache_misses = 0;
53
54public:
55 FormatCache() = default;
56
57 template <typename ImplSP>
58 bool Get(llvm::StringRef type, ImplSP &format_impl_sp);
59 void Set(llvm::StringRef type, lldb::TypeFormatImplSP &format_sp);
60 void Set(llvm::StringRef type, lldb::TypeSummaryImplSP &summary_sp);
61 void Set(llvm::StringRef type, lldb::SyntheticChildrenSP &synthetic_sp);
62
63 void Clear();
64
65 uint64_t GetCacheHits() { return m_cache_hits; }
66
67 uint64_t GetCacheMisses() { return m_cache_misses; }
68};
69
70} // namespace lldb_private
71
72#endif // LLDB_DATAFORMATTERS_FORMATCACHE_H
void Set(llvm::StringRef type, lldb::TypeSummaryImplSP &summary_sp)
bool Get(llvm::StringRef type, ImplSP &format_impl_sp)
void Set(llvm::StringRef type, lldb::TypeFormatImplSP &format_sp)
llvm::StringMap< Entry > m_entries
Definition FormatCache.h:48
std::recursive_mutex m_mutex
Definition FormatCache.h:49
void Set(llvm::StringRef type, lldb::SyntheticChildrenSP &synthetic_sp)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::TypeSummaryImpl > TypeSummaryImplSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
void Set(lldb::SyntheticChildrenSP)
lldb::SyntheticChildrenSP m_synthetic_sp
Definition FormatCache.h:30
lldb::TypeSummaryImplSP m_summary_sp
Definition FormatCache.h:29
void Set(lldb::TypeFormatImplSP)
void Get(lldb::TypeSummaryImplSP &)
void Get(lldb::SyntheticChildrenSP &)
void Get(lldb::TypeFormatImplSP &)
lldb::TypeFormatImplSP m_format_sp
Definition FormatCache.h:28
void Set(lldb::TypeSummaryImplSP)