[Lldb-commits] [lldb] r248427 - Make the ObjCLanguageRuntimes comply with llvm-style RTTI
Enrico Granata via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 23 13:12:20 PDT 2015
Author: enrico
Date: Wed Sep 23 15:12:19 2015
New Revision: 248427
URL: http://llvm.org/viewvc/llvm-project?rev=248427&view=rev
Log:
Make the ObjCLanguageRuntimes comply with llvm-style RTTI
Modified:
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/include/lldb/lldb-private-enumerations.h
lldb/trunk/source/Expression/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Wed Sep 23 15:12:19 2015
@@ -26,6 +26,8 @@
#include "lldb/Symbol/Type.h"
#include "lldb/Target/LanguageRuntime.h"
+#include "llvm/Support/Casting.h"
+
class CommandObjectObjC_ClassTable_Dump;
namespace lldb_private {
@@ -36,6 +38,13 @@ class ObjCLanguageRuntime :
public LanguageRuntime
{
public:
+ enum class ObjCRuntimeVersions
+ {
+ eObjC_VersionUnknown = 0,
+ eAppleObjC_V1 = 1,
+ eAppleObjC_V2 = 2
+ };
+
typedef lldb::addr_t ObjCISA;
class ClassDescriptor;
@@ -293,9 +302,9 @@ public:
CreateObjectChecker (const char *) = 0;
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
}
bool
Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-private-enumerations.h Wed Sep 23 15:12:19 2015
@@ -106,13 +106,6 @@ typedef enum SortOrder
eSortOrderByName
} SortOrder;
-typedef enum ObjCRuntimeVersions {
- eObjC_VersionUnknown = 0,
- eAppleObjC_V1 = 1,
- eAppleObjC_V2 = 2
-} ObjCRuntimeVersions;
-
-
//----------------------------------------------------------------------
// LazyBool is for boolean values that need to be calculated lazily.
// Values start off set to eLazyBoolCalculate, and then they can be
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Wed Sep 23 15:12:19 2015
@@ -277,7 +277,7 @@ ClangExpressionParser::ClangExpressionPa
{
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));
Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Wed Sep 23 15:12:19 2015
@@ -624,7 +624,7 @@ SyntheticChildrenFrontEnd* lldb_private:
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;
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Wed Sep 23 15:12:19 2015
@@ -377,11 +377,11 @@ AppleObjCRuntime::GetStepThroughTrampoli
//------------------------------------------------------------------
// 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 @@ AppleObjCRuntime::GetObjCVersion (Proces
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
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Wed Sep 23 15:12:19 2015
@@ -29,6 +29,17 @@ class AppleObjCRuntime :
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();
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Wed Sep 23 15:12:19 2015
@@ -79,7 +79,7 @@ AppleObjCRuntimeV1::CreateInstance (Proc
{
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;
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Wed Sep 23 15:12:19 2015
@@ -24,6 +24,16 @@ class AppleObjCRuntimeV1 :
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 @@ public:
GetPluginVersion();
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eAppleObjC_V1;
+ return ObjCRuntimeVersions::eAppleObjC_V1;
}
virtual void
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Wed Sep 23 15:12:19 2015
@@ -438,7 +438,7 @@ AppleObjCRuntimeV2::CreateInstance (Proc
{
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;
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=248427&r1=248426&r2=248427&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Wed Sep 23 15:12:19 2015
@@ -30,6 +30,17 @@ class AppleObjCRuntimeV2 :
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 @@ public:
GetPluginVersion();
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eAppleObjC_V2;
+ return ObjCRuntimeVersions::eAppleObjC_V2;
}
virtual size_t
More information about the lldb-commits
mailing list