File: DWARFASTParserSwift.h

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (105 lines) | stat: -rw-r--r-- 3,767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//===-- DWARFASTParserSwift.h -----------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#ifndef SymbolFileDWARF_DWARFASTParserSwift_h_
#define SymbolFileDWARF_DWARFASTParserSwift_h_

#include "DWARFASTParser.h"
#include "DWARFDIE.h"
#include "swift/RemoteInspection/DescriptorFinder.h"
#include "swift/RemoteInspection/TypeRef.h"

namespace swift {
namespace reflection {
class TypeInfo;
} // namespace reflection
namespace remote {
struct TypeInfoProvider;
} // namespace remote
} // namespace swift

namespace lldb_private { class TypeSystemSwiftTypeRef; }

class DWARFASTParserSwift : public lldb_private::plugin::dwarf::DWARFASTParser,
                            public swift::reflection::DescriptorFinder {
public:
  using DWARFDIE = lldb_private::plugin::dwarf::DWARFDIE;
  DWARFASTParserSwift(lldb_private::TypeSystemSwiftTypeRef &swift_typesystem);

  virtual ~DWARFASTParserSwift();

  lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc,
                                  const DWARFDIE &die,
                                  bool *type_is_new_ptr) override;

  lldb_private::ConstString
  ConstructDemangledNameFromDWARF(const DWARFDIE &die) override;

  lldb_private::Function *
  ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit,
                         const DWARFDIE &die,
                         const lldb_private::AddressRange &func_range) override;

  bool
  CompleteTypeFromDWARF(const DWARFDIE &die, lldb_private::Type *type,
                        lldb_private::CompilerType &compiler_type) override {
    return false;
  }

  lldb_private::CompilerDecl
  GetDeclForUIDFromDWARF(const DWARFDIE &die) override {
    return lldb_private::CompilerDecl();
  }

  lldb_private::CompilerDeclContext
  GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override;

  lldb_private::CompilerDeclContext
  GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) override;

  void EnsureAllDIEsInDeclContextHaveBeenParsed(
      lldb_private::CompilerDeclContext decl_context) override {}

  // FIXME: What should this do?
  lldb_private::ConstString
  GetDIEClassTemplateParams(const DWARFDIE &die) override {
    assert(false && "DWARFASTParserSwift::GetDIEClassTemplateParams has not "
                    "yet been implemented");
    return lldb_private::ConstString();
  }

  static bool classof(const DWARFASTParser *Parser) {
    return Parser->GetKind() == Kind::DWARFASTParserSwift;
  }

  /// Returns a field descriptor constructed from DWARF info.
  std::unique_ptr<swift::reflection::FieldDescriptorBase>
  getFieldDescriptor(const swift::reflection::TypeRef *TR) override;

  /// Returns a builtin descriptor constructed from DWARF info.
  std::unique_ptr<swift::reflection::BuiltinTypeDescriptorBase>
  getBuiltinTypeDescriptor(const swift::reflection::TypeRef *TR) override;

  /// Returns a builtin descriptor constructed from DWARF info.
  std::unique_ptr<swift::reflection::MultiPayloadEnumDescriptorBase>
  getMultiPayloadEnumDescriptor(const swift::reflection::TypeRef *TR) override;

private:
  /// Returns the canonical demangle tree of a die's type.
  NodePointer GetCanonicalDemangleTree(DWARFDIE &die);

protected:
  lldb_private::TypeSystemSwiftTypeRef &m_swift_typesystem;
  swift::Demangle::Demangler m_dem;
};

#endif // SymbolFileDWARF_DWARFASTParserSwift_h_