Skip to content

Commit 7d71dd9

Browse files
committed
Add RTTI support to the SymbolFile class hierarchy
Differential Revision: https://reviews.llvm.org/D70322
1 parent 2f95b64 commit 7d71dd9

19 files changed

+115
-1
lines changed

lldb/include/lldb/Expression/UserExpression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace lldb_private {
3333
/// implementations of UserExpression - which will be vended through the
3434
/// appropriate TypeSystem.
3535
class UserExpression : public Expression {
36-
// LLVM RTTI support
36+
/// LLVM RTTI support.
3737
static char ID;
3838

3939
public:

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@
3333
namespace lldb_private {
3434

3535
class SymbolFile : public PluginInterface {
36+
/// LLVM RTTI support.
37+
static char ID;
38+
3639
public:
40+
/// LLVM RTTI support.
41+
/// \{
42+
virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
43+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
44+
/// \}
45+
3746
// Symbol file ability bits.
3847
//
3948
// Each symbol file can claim to support one or more symbol file abilities.

lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ using namespace lldb;
2525
using namespace lldb_private;
2626
using namespace lldb_private::breakpad;
2727

28+
char SymbolFileBreakpad::ID;
29+
2830
class SymbolFileBreakpad::LineIterator {
2931
public:
3032
// begin iterator for sections of given type

lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ namespace lldb_private {
2121
namespace breakpad {
2222

2323
class SymbolFileBreakpad : public SymbolFile {
24+
/// LLVM RTTI support.
25+
static char ID;
26+
2427
public:
28+
/// LLVM RTTI support.
29+
/// \{
30+
bool isA(const void *ClassID) const override {
31+
return ClassID == &ID || SymbolFile::isA(ClassID);
32+
}
33+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
34+
/// \}
35+
2536
// Static Functions
2637
static void Initialize();
2738
static void Terminate();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
using namespace lldb;
9595
using namespace lldb_private;
9696

97+
char SymbolFileDWARF::ID;
98+
9799
// static inline bool
98100
// child_requires_parent_class_union_or_struct_to_be_completed (dw_tag_t tag)
99101
//{

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ class SymbolFileDWARFDwp;
5959

6060
class SymbolFileDWARF : public lldb_private::SymbolFile,
6161
public lldb_private::UserID {
62+
/// LLVM RTTI support.
63+
static char ID;
64+
6265
public:
66+
/// LLVM RTTI support.
67+
/// \{
68+
bool isA(const void *ClassID) const override {
69+
return ClassID == &ID || SymbolFile::isA(ClassID);
70+
}
71+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
72+
/// \}
73+
6374
friend class SymbolFileDWARFDebugMap;
6475
friend class SymbolFileDWARFDwo;
6576
friend class DebugMapModule;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
using namespace lldb;
4040
using namespace lldb_private;
4141

42+
char SymbolFileDWARFDebugMap::ID;
43+
4244
// Subclass lldb_private::Module so we can intercept the
4345
// "Module::GetObjectFile()" (so we can fixup the object file sections) and
4446
// also for "Module::GetSymbolFile()" (so we can fixup the symbol file id.

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ class DWARFDebugAranges;
2323
class DWARFDeclContext;
2424

2525
class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile {
26+
/// LLVM RTTI support.
27+
static char ID;
28+
2629
public:
30+
/// LLVM RTTI support.
31+
/// \{
32+
bool isA(const void *ClassID) const override {
33+
return ClassID == &ID || SymbolFile::isA(ClassID);
34+
}
35+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
36+
/// \}
37+
2738
// Static Functions
2839
static void Initialize();
2940

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using namespace lldb;
2222
using namespace lldb_private;
2323

24+
char SymbolFileDWARFDwo::ID;
25+
2426
SymbolFileDWARFDwo::SymbolFileDWARFDwo(ObjectFileSP objfile,
2527
DWARFCompileUnit &dwarf_cu)
2628
: SymbolFileDWARF(objfile, objfile->GetSectionList(

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@
1212
#include "SymbolFileDWARF.h"
1313

1414
class SymbolFileDWARFDwo : public SymbolFileDWARF {
15+
/// LLVM RTTI support.
16+
static char ID;
17+
1518
public:
19+
/// LLVM RTTI support.
20+
/// \{
21+
bool isA(const void *ClassID) const override {
22+
return ClassID == &ID || SymbolFileDWARF::isA(ClassID);
23+
}
24+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
25+
/// \}
26+
1627
SymbolFileDWARFDwo(lldb::ObjectFileSP objfile, DWARFCompileUnit &dwarf_cu);
1728

1829
~SymbolFileDWARFDwo() override = default;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
using namespace lldb;
2020
using namespace lldb_private;
2121

22+
char SymbolFileDWARFDwoDwp::ID;
23+
2224
SymbolFileDWARFDwoDwp::SymbolFileDWARFDwoDwp(SymbolFileDWARFDwp *dwp_symfile,
2325
ObjectFileSP objfile,
2426
DWARFCompileUnit &dwarf_cu,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@
1313
#include "SymbolFileDWARFDwp.h"
1414

1515
class SymbolFileDWARFDwoDwp : public SymbolFileDWARFDwo {
16+
/// LLVM RTTI support.
17+
static char ID;
18+
1619
public:
20+
/// LLVM RTTI support.
21+
/// \{
22+
bool isA(const void *ClassID) const override {
23+
return ClassID == &ID || SymbolFileDWARFDwo::isA(ClassID);
24+
}
25+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
26+
/// \}
1727
SymbolFileDWARFDwoDwp(SymbolFileDWARFDwp *dwp_symfile,
1828
lldb::ObjectFileSP objfile, DWARFCompileUnit &dwarf_cu,
1929
uint64_t dwo_id);

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ using namespace npdb;
6767
using namespace llvm::codeview;
6868
using namespace llvm::pdb;
6969

70+
char SymbolFileNativePDB::ID;
71+
7072
static lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
7173
switch (lang) {
7274
case PDB_Lang::Cpp:

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ class PdbAstBuilder;
4141
class SymbolFileNativePDB : public SymbolFile {
4242
friend class UdtRecordCompleter;
4343

44+
/// LLVM RTTI support.
45+
static char ID;
46+
4447
public:
48+
/// LLVM RTTI support.
49+
/// \{
50+
bool isA(const void *ClassID) const override {
51+
return ClassID == &ID || SymbolFile::isA(ClassID);
52+
}
53+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
54+
/// \}
55+
4556
// Static Functions
4657
static void Initialize();
4758

lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ using namespace lldb;
5858
using namespace lldb_private;
5959
using namespace llvm::pdb;
6060

61+
char SymbolFilePDB::ID;
62+
6163
namespace {
6264
lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
6365
switch (lang) {

lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@
2222
class PDBASTParser;
2323

2424
class SymbolFilePDB : public lldb_private::SymbolFile {
25+
/// LLVM RTTI support.
26+
static char ID;
27+
2528
public:
29+
/// LLVM RTTI support.
30+
/// \{
31+
bool isA(const void *ClassID) const override {
32+
return ClassID == &ID || SymbolFile::isA(ClassID);
33+
}
34+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
35+
/// \}
36+
2637
// Static Functions
2738
static void Initialize();
2839

lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
using namespace lldb;
2626
using namespace lldb_private;
2727

28+
char SymbolFileSymtab::ID;
29+
2830
void SymbolFileSymtab::Initialize() {
2931
PluginManager::RegisterPlugin(GetPluginNameStatic(),
3032
GetPluginDescriptionStatic(), CreateInstance);

lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@
1616
#include "lldb/Symbol/Symtab.h"
1717

1818
class SymbolFileSymtab : public lldb_private::SymbolFile {
19+
/// LLVM RTTI support.
20+
static char ID;
21+
1922
public:
23+
/// LLVM RTTI support.
24+
/// \{
25+
bool isA(const void *ClassID) const override {
26+
return ClassID == &ID || SymbolFile::isA(ClassID);
27+
}
28+
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
29+
/// \}
30+
2031
// Constructors and Destructors
2132
SymbolFileSymtab(lldb::ObjectFileSP objfile_sp);
2233

lldb/source/Symbol/SymbolFile.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
using namespace lldb_private;
2525
using namespace lldb;
2626

27+
char SymbolFile::ID;
28+
2729
void SymbolFile::PreloadSymbols() {
2830
// No-op for most implementations.
2931
}

0 commit comments

Comments
 (0)