Skip to content

[lldb][NFC] Implement llvm-style RTTI for DWARFASTParser #69762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class SymbolFileDWARF;

class DWARFASTParser {
public:
enum class Kind { DWARFASTParserClang, DWARFASTParserSwift };
DWARFASTParser(Kind kind) : m_kind(kind) {}

virtual ~DWARFASTParser() = default;

virtual lldb::TypeSP ParseTypeFromDWARF(const SymbolContext &sc,
Expand Down Expand Up @@ -62,6 +65,11 @@ class DWARFASTParser {
const ExecutionContext *exe_ctx = nullptr);

static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);

Kind GetKind() const { return m_kind; }

private:
const Kind m_kind;
};
} // namespace dwarf
} // namespace lldb_private::plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ using namespace lldb_private::dwarf;
using namespace lldb_private::plugin::dwarf;

DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)
: m_ast(ast), m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
: DWARFASTParser(Kind::DWARFASTParserClang), m_ast(ast),
m_die_to_decl_ctx(), m_decl_ctx_to_die() {}

DWARFASTParserClang::~DWARFASTParserClang() = default;

Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {
lldb::ModuleSP
GetModuleForType(const lldb_private::plugin::dwarf::DWARFDIE &die);

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

private:
struct FieldInfo {
uint64_t bit_size = 0;
Expand Down