Skip to content

Commit 61c4ee9

Browse files
authored
[lldb][NFC] Implement llvm-style RTTI for DWARFASTParser (#69762)
1 parent ef33659 commit 61c4ee9

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class SymbolFileDWARF;
2929

3030
class DWARFASTParser {
3131
public:
32+
enum class Kind { DWARFASTParserClang, DWARFASTParserSwift };
33+
DWARFASTParser(Kind kind) : m_kind(kind) {}
34+
3235
virtual ~DWARFASTParser() = default;
3336

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

6467
static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
68+
69+
Kind GetKind() const { return m_kind; }
70+
71+
private:
72+
const Kind m_kind;
6573
};
6674
} // namespace dwarf
6775
} // namespace lldb_private::plugin

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ using namespace lldb_private::dwarf;
6363
using namespace lldb_private::plugin::dwarf;
6464

6565
DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)
66-
: m_ast(ast), m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
66+
: DWARFASTParser(Kind::DWARFASTParserClang), m_ast(ast),
67+
m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
6768

6869
DWARFASTParserClang::~DWARFASTParserClang() = default;
6970

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {
248248
lldb::ModuleSP
249249
GetModuleForType(const lldb_private::plugin::dwarf::DWARFDIE &die);
250250

251+
static bool classof(const DWARFASTParser *Parser) {
252+
return Parser->GetKind() == Kind::DWARFASTParserClang;
253+
}
254+
251255
private:
252256
struct FieldInfo {
253257
uint64_t bit_size = 0;

0 commit comments

Comments
 (0)