1//===-- DWARFASTParser.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_DWARFASTPARSER_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
11
12#include "DWARFDefines.h"
13#include "lldb/Core/PluginInterface.h"
14#include "lldb/Symbol/SymbolFile.h"
15#include "lldb/Symbol/CompilerDecl.h"
16#include "lldb/Symbol/CompilerDeclContext.h"
17#include "lldb/lldb-enumerations.h"
18#include <optional>
19
20namespace lldb_private {
21class CompileUnit;
22class ExecutionContext;
23}
24
25namespace lldb_private::plugin {
26namespace dwarf {
27class DWARFDIE;
28class SymbolFileDWARF;
29
30class DWARFASTParser {
31public:
32 enum class Kind { DWARFASTParserClang };
33 DWARFASTParser(Kind kind) : m_kind(kind) {}
34
35 virtual ~DWARFASTParser() = default;
36
37 virtual lldb::TypeSP ParseTypeFromDWARF(const SymbolContext &sc,
38 const DWARFDIE &die,
39 bool *type_is_new_ptr) = 0;
40
41 virtual ConstString ConstructDemangledNameFromDWARF(const DWARFDIE &die) = 0;
42
43 virtual Function *ParseFunctionFromDWARF(CompileUnit &comp_unit,
44 const DWARFDIE &die,
45 const AddressRange &range) = 0;
46
47 virtual bool CompleteTypeFromDWARF(const DWARFDIE &die, Type *type,
48 CompilerType &compiler_type) = 0;
49
50 virtual CompilerDecl GetDeclForUIDFromDWARF(const DWARFDIE &die) = 0;
51
52 virtual CompilerDeclContext
53 GetDeclContextForUIDFromDWARF(const DWARFDIE &die) = 0;
54
55 virtual CompilerDeclContext
56 GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) = 0;
57
58 virtual void EnsureAllDIEsInDeclContextHaveBeenParsed(
59 CompilerDeclContext decl_context) = 0;
60
61 virtual ConstString GetDIEClassTemplateParams(const DWARFDIE &die) = 0;
62
63 static std::optional<SymbolFile::ArrayInfo>
64 ParseChildArrayInfo(const DWARFDIE &parent_die,
65 const ExecutionContext *exe_ctx = nullptr);
66
67 lldb_private::Type *GetTypeForDIE(const DWARFDIE &die);
68
69 static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
70
71 Kind GetKind() const { return m_kind; }
72
73private:
74 const Kind m_kind;
75};
76} // namespace dwarf
77} // namespace lldb_private::plugin
78
79#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
80

source code of lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h