Skip to content

Commit a99755a

Browse files
authored
Merge pull request #7664 from augusto2112/rtti-DWARFASTParserSwift
[lldb][NFC] Implement RTTI for DWARFASTParserSwift
2 parents 6e058c7 + 033ae47 commit a99755a

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

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

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

2727
class DWARFASTParser {
2828
public:
29+
enum class Kind { DWARFASTParserClang, DWARFASTParserSwift};
30+
DWARFASTParser(Kind kind) : m_kind(kind) {}
31+
2932
virtual ~DWARFASTParser() = default;
3033

3134
virtual lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc,
@@ -64,6 +67,11 @@ class DWARFASTParser {
6467
const lldb_private::ExecutionContext *exe_ctx = nullptr);
6568

6669
static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
70+
71+
Kind GetKind() const { return m_kind; }
72+
73+
private:
74+
const Kind m_kind;
6775
};
6876

6977
#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ using namespace lldb;
6161
using namespace lldb_private;
6262
using namespace lldb_private::dwarf;
6363
DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)
64-
: m_ast(ast), m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
64+
: DWARFASTParser(Kind::DWARFASTParserClang), m_ast(ast),
65+
m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
6566

6667
DWARFASTParserClang::~DWARFASTParserClang() = default;
6768

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ class DWARFASTParserClang : public DWARFASTParser {
218218
// module.
219219
lldb::ModuleSP GetModuleForType(const DWARFDIE &die);
220220

221+
static bool classof(const DWARFASTParser *Parser) {
222+
return Parser->GetKind() == Kind::DWARFASTParserClang;
223+
}
224+
221225
private:
222226
struct FieldInfo {
223227
uint64_t bit_size = 0;

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

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

4141
DWARFASTParserSwift::DWARFASTParserSwift(
4242
TypeSystemSwiftTypeRef &swift_typesystem)
43-
: m_swift_typesystem(swift_typesystem) {}
43+
: DWARFASTParser(Kind::DWARFASTParserSwift),
44+
m_swift_typesystem(swift_typesystem) {}
4445

4546
DWARFASTParserSwift::~DWARFASTParserSwift() {}
4647

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class DWARFASTParserSwift : public DWARFASTParser {
6767
return lldb_private::ConstString();
6868
}
6969

70+
static bool classof(const DWARFASTParser *Parser) {
71+
return Parser->GetKind() == Kind::DWARFASTParserSwift;
72+
}
73+
7074
protected:
7175
lldb_private::TypeSystemSwiftTypeRef &m_swift_typesystem;
7276
};

0 commit comments

Comments
 (0)