Make the ObjCLanguageRuntimes comply with llvm-style RTTI
llvm-svn: 248427
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp
index 6f6a0b7..432ddbb 100644
--- a/lldb/source/Expression/ClangExpressionParser.cpp
+++ b/lldb/source/Expression/ClangExpressionParser.cpp
@@ -277,7 +277,7 @@
{
if (process_sp->GetObjCLanguageRuntime())
{
- if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() == eAppleObjC_V2)
+ if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() == ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2)
m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::MacOSX, VersionTuple(10, 7));
else
m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::FragileMacOSX, VersionTuple(10, 7));
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index c6db27e..a851699 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -624,7 +624,7 @@
lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
if (!process_sp)
return NULL;
- AppleObjCRuntime *runtime = (AppleObjCRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
+ AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(process_sp->GetObjCLanguageRuntime());
if (!runtime)
return NULL;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index b84bae6..9b27f43 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -377,11 +377,11 @@
//------------------------------------------------------------------
// Static Functions
//------------------------------------------------------------------
-enum ObjCRuntimeVersions
+ObjCLanguageRuntime::ObjCRuntimeVersions
AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
{
if (!process)
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
Target &target = process->GetTarget();
const ModuleList &target_modules = target.GetImages();
@@ -401,21 +401,21 @@
objc_module_sp = module_sp;
ObjectFile *ofile = module_sp->GetObjectFile();
if (!ofile)
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
SectionList *sections = module_sp->GetSectionList();
if (!sections)
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
SectionSP v1_telltale_section_sp = sections->FindSectionByName(ConstString ("__OBJC"));
if (v1_telltale_section_sp)
{
- return eAppleObjC_V1;
+ return ObjCRuntimeVersions::eAppleObjC_V1;
}
- return eAppleObjC_V2;
+ return ObjCRuntimeVersions::eAppleObjC_V2;
}
}
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
}
void
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index 397d874..9ec15cf 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -29,6 +29,17 @@
public lldb_private::ObjCLanguageRuntime
{
public:
+ static bool classof(const ObjCLanguageRuntime* runtime)
+ {
+ switch (runtime->GetRuntimeVersion())
+ {
+ case ObjCRuntimeVersions::eAppleObjC_V1:
+ case ObjCRuntimeVersions::eAppleObjC_V2:
+ return true;
+ default:
+ return false;
+ }
+ }
virtual ~AppleObjCRuntime();
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index 4de5c2e..59b28b6 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -79,7 +79,7 @@
{
ModuleSP objc_module_sp;
- if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == eAppleObjC_V1)
+ if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == ObjCRuntimeVersions::eAppleObjC_V1)
return new AppleObjCRuntimeV1 (process);
else
return NULL;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
index 714caa4..fda4559 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
@@ -24,6 +24,16 @@
public AppleObjCRuntime
{
public:
+ static bool classof(const ObjCLanguageRuntime* runtime)
+ {
+ switch (runtime->GetRuntimeVersion())
+ {
+ case ObjCRuntimeVersions::eAppleObjC_V1:
+ return true;
+ default:
+ return false;
+ }
+ }
class ClassDescriptorV1 : public ObjCLanguageRuntime::ClassDescriptor
{
@@ -131,9 +141,9 @@
GetPluginVersion();
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eAppleObjC_V1;
+ return ObjCRuntimeVersions::eAppleObjC_V1;
}
virtual void
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 2dcac87..4baf607 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -438,7 +438,7 @@
{
ModuleSP objc_module_sp;
- if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == eAppleObjC_V2)
+ if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == ObjCRuntimeVersions::eAppleObjC_V2)
return new AppleObjCRuntimeV2 (process, objc_module_sp);
else
return NULL;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
index d483323..2c0c346 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -30,6 +30,17 @@
public AppleObjCRuntime
{
public:
+ static bool classof(const ObjCLanguageRuntime* runtime)
+ {
+ switch (runtime->GetRuntimeVersion())
+ {
+ case ObjCRuntimeVersions::eAppleObjC_V2:
+ return true;
+ default:
+ return false;
+ }
+ }
+
virtual ~AppleObjCRuntimeV2();
// These are generic runtime functions:
@@ -69,9 +80,9 @@
GetPluginVersion();
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eAppleObjC_V2;
+ return ObjCRuntimeVersions::eAppleObjC_V2;
}
virtual size_t