From e84f78412bb6cf06e7ff35cb49da60596f582aa7 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 31 Jul 2019 11:57:34 +0000 Subject: Add llvm-style RTTI to ObjectFile hierarchy Summary: On the heels of D62934, this patch uses the same approach to introduce llvm RTTI support to the ObjectFile hierarchy. It also replaces the existing uses of GetPluginName doing run-time type checks with llvm::dyn_cast and friends. This formally introduces new dependencies from some other plugins to ObjectFile plugins. However, I believe this is fine because: - these dependencies were already kind of there, and the only reason we could get away with not modeling them explicitly was because the code was relying on magically knowing what will GetPluginName() return for a particular kind of object files. - the dependencies themselves are logical (it makes sense for SymbolVendorELF to depend on ObjectFileELF), or at least don't actively get in the way (the JitLoaderGDB->MachO thing). - they don't introduce any new dependency loops as ObjectFile plugins don't depend on any other plugins Reviewers: xiaobai, JDevlieghere, espindola Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits Differential Revision: https://reviews.llvm.org/D65450 llvm-svn: 367413 --- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h') diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 6aa9eba4ec1..68ea7a7270c 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -85,6 +85,13 @@ public: static lldb::SymbolType MapSymbolType(uint16_t coff_symbol_type); + // LLVM RTTI support + static char ID; + bool isA(const void *ClassID) const override { + return ClassID == &ID || ObjectFile::isA(ClassID); + } + static bool classof(const ObjectFile *obj) { return obj->isA(&ID); } + bool ParseHeader() override; bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value, -- cgit v1.2.3