1 //===-- UniqueDWARFASTType.h ------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_UniqueDWARFASTType_h_
11 #define lldb_UniqueDWARFASTType_h_
17 // Other libraries and framework includes
18 #include "llvm/ADT/DenseMap.h"
21 #include "lldb/Symbol/Declaration.h"
23 class DWARFCompileUnit;
24 class DWARFDebugInfoEntry;
25 class SymbolFileDWARF;
27 class UniqueDWARFASTType
30 //------------------------------------------------------------------
31 // Constructors and Destructors
32 //------------------------------------------------------------------
33 UniqueDWARFASTType () :
39 m_byte_size (-1) // Set to negative value to make sure we have a valid value
43 UniqueDWARFASTType (lldb::TypeSP &type_sp,
44 SymbolFileDWARF *symfile,
46 DWARFDebugInfoEntry *die,
47 const lldb_private::Declaration &decl,
54 m_byte_size (byte_size)
58 UniqueDWARFASTType (const UniqueDWARFASTType &rhs) :
59 m_type_sp (rhs.m_type_sp),
60 m_symfile (rhs.m_symfile),
63 m_declaration (rhs.m_declaration),
64 m_byte_size (rhs.m_byte_size)
73 operator= (const UniqueDWARFASTType &rhs)
77 m_type_sp = rhs.m_type_sp;
78 m_symfile = rhs.m_symfile;
81 m_declaration = rhs.m_declaration;
82 m_byte_size = rhs.m_byte_size;
87 lldb::TypeSP m_type_sp;
88 SymbolFileDWARF *m_symfile;
89 const DWARFCompileUnit *m_cu;
90 const DWARFDebugInfoEntry *m_die;
91 lldb_private::Declaration m_declaration;
95 class UniqueDWARFASTTypeList
98 UniqueDWARFASTTypeList () :
103 ~UniqueDWARFASTTypeList ()
110 return (uint32_t)m_collection.size();
114 Append (const UniqueDWARFASTType &entry)
116 m_collection.push_back (entry);
120 Find (SymbolFileDWARF *symfile,
121 const DWARFCompileUnit *cu,
122 const DWARFDebugInfoEntry *die,
123 const lldb_private::Declaration &decl,
124 const int32_t byte_size,
125 UniqueDWARFASTType &entry) const;
128 typedef std::vector<UniqueDWARFASTType> collection;
129 collection m_collection;
132 class UniqueDWARFASTTypeMap
135 UniqueDWARFASTTypeMap () :
140 ~UniqueDWARFASTTypeMap ()
145 Insert (const lldb_private::ConstString &name,
146 const UniqueDWARFASTType &entry)
148 m_collection[name.GetCString()].Append (entry);
152 Find (const lldb_private::ConstString &name,
153 SymbolFileDWARF *symfile,
154 const DWARFCompileUnit *cu,
155 const DWARFDebugInfoEntry *die,
156 const lldb_private::Declaration &decl,
157 const int32_t byte_size,
158 UniqueDWARFASTType &entry) const
160 const char *unique_name_cstr = name.GetCString();
161 collection::const_iterator pos = m_collection.find (unique_name_cstr);
162 if (pos != m_collection.end())
164 return pos->second.Find (symfile, cu, die, decl, byte_size, entry);
170 // A unique name string should be used
171 typedef llvm::DenseMap<const char *, UniqueDWARFASTTypeList> collection;
172 collection m_collection;
175 #endif // lldb_UniqueDWARFASTType_h_