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
72 AppendDeclContext (dw_tag_t tag, const char *name)
74 m_entries.push_back(Entry(tag, name));
78 operator ==(const DWARFDeclContext& rhs) const;
83 return m_entries.size();
87 operator[] (uint32_t idx)
89 // "idx" must be valid
90 return m_entries[idx];
94 operator[] (uint32_t idx) const
96 // "idx" must be valid
97 return m_entries[idx];
101 GetQualifiedName () const;
103 // Same as GetQaulifiedName, but the life time of the returned string will
104 // be that of the LLDB session.
105 lldb_private::ConstString
106 GetQualifiedNameAsConstString () const
108 return lldb_private::ConstString (GetQualifiedName ());
115 m_qualified_name.clear();
119 typedef std::vector<Entry> collection;
120 collection m_entries;
121 mutable std::string m_qualified_name;
124 #endif // SymbolFileDWARF_DWARFDeclContext_h_