LLDB mainline
UniqueDWARFASTType.h
Go to the documentation of this file.
1//===-- UniqueDWARFASTType.h ------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_UNIQUEDWARFASTTYPE_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_UNIQUEDWARFASTTYPE_H
11
12#include <vector>
13
14#include "llvm/ADT/DenseMap.h"
15
16#include "DWARFDIE.h"
18
20public:
21 // Constructors and Destructors
23
24 UniqueDWARFASTType(lldb::TypeSP &type_sp, const DWARFDIE &die,
25 const lldb_private::Declaration &decl, int32_t byte_size)
26 : m_type_sp(type_sp), m_die(die), m_declaration(decl),
27 m_byte_size(byte_size) {}
28
30 : m_type_sp(rhs.m_type_sp), m_die(rhs.m_die),
32
34
36 if (this != &rhs) {
37 m_type_sp = rhs.m_type_sp;
38 m_die = rhs.m_die;
41 }
42 return *this;
43 }
44
45 lldb::TypeSP m_type_sp;
48 int32_t m_byte_size = -1;
49};
50
52public:
54
56
57 uint32_t GetSize() { return (uint32_t)m_collection.size(); }
58
59 void Append(const UniqueDWARFASTType &entry) {
60 m_collection.push_back(entry);
61 }
62
63 bool Find(const DWARFDIE &die, const lldb_private::Declaration &decl,
64 const int32_t byte_size, UniqueDWARFASTType &entry) const;
65
66protected:
67 typedef std::vector<UniqueDWARFASTType> collection;
69};
70
72public:
74
76
78 const UniqueDWARFASTType &entry) {
79 m_collection[name.GetCString()].Append(entry);
80 }
81
83 const lldb_private::Declaration &decl, const int32_t byte_size,
84 UniqueDWARFASTType &entry) const {
85 const char *unique_name_cstr = name.GetCString();
86 collection::const_iterator pos = m_collection.find(unique_name_cstr);
87 if (pos != m_collection.end()) {
88 return pos->second.Find(die, decl, byte_size, entry);
89 }
90 return false;
91 }
92
93protected:
94 // A unique name string should be used
95 typedef llvm::DenseMap<const char *, UniqueDWARFASTTypeList> collection;
97};
98
99#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_UNIQUEDWARFASTTYPE_H
~UniqueDWARFASTTypeList()=default
void Append(const UniqueDWARFASTType &entry)
std::vector< UniqueDWARFASTType > collection
bool Find(const DWARFDIE &die, const lldb_private::Declaration &decl, const int32_t byte_size, UniqueDWARFASTType &entry) const
void Insert(lldb_private::ConstString name, const UniqueDWARFASTType &entry)
llvm::DenseMap< const char *, UniqueDWARFASTTypeList > collection
~UniqueDWARFASTTypeMap()=default
bool Find(lldb_private::ConstString name, const DWARFDIE &die, const lldb_private::Declaration &decl, const int32_t byte_size, UniqueDWARFASTType &entry) const
lldb_private::Declaration m_declaration
UniqueDWARFASTType(const UniqueDWARFASTType &rhs)
~UniqueDWARFASTType()=default
UniqueDWARFASTType & operator=(const UniqueDWARFASTType &rhs)
UniqueDWARFASTType(lldb::TypeSP &type_sp, const DWARFDIE &die, const lldb_private::Declaration &decl, int32_t byte_size)
A uniqued constant string class.
Definition: ConstString.h:39
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24