1//===-- DWARFDIE.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 SymbolFileDWARF_DWARFDIE_h_
10#define SymbolFileDWARF_DWARFDIE_h_
11
12#include "DWARFBaseDIE.h"
13#include "llvm/ADT/SmallSet.h"
14
15class DWARFDIE : public DWARFBaseDIE {
16public:
17  using DWARFBaseDIE::DWARFBaseDIE;
18
19  // Tests
20  bool IsStructUnionOrClass() const;
21
22  bool IsMethod() const;
23
24  // Accessors
25
26  // Accessing information about a DIE
27  const char *GetMangledName() const;
28
29  const char *GetPubname() const;
30
31  const char *GetQualifiedName(std::string &storage) const;
32
33  using DWARFBaseDIE::GetName;
34  void GetName(lldb_private::Stream &s) const;
35
36  void AppendTypeName(lldb_private::Stream &s) const;
37
38  lldb_private::Type *ResolveType() const;
39
40  // Resolve a type by UID using this DIE's DWARF file
41  lldb_private::Type *ResolveTypeUID(const DWARFDIE &die) const;
42
43  // Functions for obtaining DIE relations and references
44
45  DWARFDIE
46  GetParent() const;
47
48  DWARFDIE
49  GetFirstChild() const;
50
51  DWARFDIE
52  GetSibling() const;
53
54  DWARFDIE
55  GetReferencedDIE(const dw_attr_t attr) const;
56
57  // Get a another DIE from the same DWARF file as this DIE. This will
58  // check the current DIE's compile unit first to see if "die_offset" is
59  // in the same compile unit, and fall back to checking the DWARF file.
60  DWARFDIE
61  GetDIE(dw_offset_t die_offset) const;
62  using DWARFBaseDIE::GetDIE;
63
64  DWARFDIE
65  LookupDeepestBlock(lldb::addr_t file_addr) const;
66
67  DWARFDIE
68  GetParentDeclContextDIE() const;
69
70  // DeclContext related functions
71  std::vector<DWARFDIE> GetDeclContextDIEs() const;
72
73  void GetDWARFDeclContext(DWARFDeclContext &dwarf_decl_ctx) const;
74
75  /// Return this DIE's decl context as it is needed to look up types
76  /// in Clang's -gmodules debug info format.
77  void GetDeclContext(
78      llvm::SmallVectorImpl<lldb_private::CompilerContext> &context) const;
79
80  // Getting attribute values from the DIE.
81  //
82  // GetAttributeValueAsXXX() functions should only be used if you are
83  // looking for one or two attributes on a DIE. If you are trying to
84  // parse all attributes, use GetAttributes (...) instead
85  DWARFDIE
86  GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const;
87
88  bool GetDIENamesAndRanges(const char *&name, const char *&mangled,
89                            DWARFRangeList &ranges, int &decl_file,
90                            int &decl_line, int &decl_column, int &call_file,
91                            int &call_line, int &call_column,
92                            lldb_private::DWARFExpression *frame_base) const;
93
94  // CompilerDecl related functions
95
96  lldb_private::CompilerDecl GetDecl() const;
97
98  lldb_private::CompilerDeclContext GetDeclContext() const;
99
100  lldb_private::CompilerDeclContext GetContainingDeclContext() const;
101};
102
103#endif // SymbolFileDWARF_DWARFDIE_h_
104