1 //===-- DWARFDeclContext.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 SymbolFileDWARF_DWARFDeclContext_h_
11 #define SymbolFileDWARF_DWARFDeclContext_h_
17 // Other libraries and framework includes
18 #include "lldb/Core/ConstString.h"
20 #include "DWARFDefines.h"
22 //----------------------------------------------------------------------
25 // A class that represents a declaration context all the way down to a
26 // DIE. This is useful when trying to find a DIE in one DWARF to a DIE
27 // in another DWARF file.
28 //----------------------------------------------------------------------
30 class DWARFDeclContext
40 Entry (dw_tag_t t, const char *n) :
47 NameMatches (const Entry& rhs) const
51 else if (name && rhs.name)
52 return strcmp(name, rhs.name) == 0;
57 explicit operator bool() const
68 m_language(lldb::eLanguageTypeUnknown)
73 AppendDeclContext (dw_tag_t tag, const char *name)
75 m_entries.push_back(Entry(tag, name));
79 operator ==(const DWARFDeclContext& rhs) const;
84 return m_entries.size();
88 operator[] (uint32_t idx)
90 // "idx" must be valid
91 return m_entries[idx];
95 operator[] (uint32_t idx) const
97 // "idx" must be valid
98 return m_entries[idx];
102 GetQualifiedName () const;
104 // Same as GetQaulifiedName, but the life time of the returned string will
105 // be that of the LLDB session.
106 lldb_private::ConstString
107 GetQualifiedNameAsConstString () const
109 return lldb_private::ConstString (GetQualifiedName ());
116 m_qualified_name.clear();
126 SetLanguage(lldb::LanguageType language)
128 m_language = language;
132 typedef std::vector<Entry> collection;
133 collection m_entries;
134 mutable std::string m_qualified_name;
135 lldb::LanguageType m_language;
138 #endif // SymbolFileDWARF_DWARFDeclContext_h_