Skip to content

Commit cbe0054

Browse files
committed
[lldb][NFC] Implement llvm-style RTTI for DWARFASTParser
(cherry picked from commit 2cc3dc4)
1 parent a293b1e commit cbe0054

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
@@ -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;

0 commit comments

Comments
 (0)