[lldb/Initializers] Move all ObjC initializers into AppleObjCRuntime

AppleObjCRuntime is the main entry point to the plugin with the same
name. This is part of a greater refactoring to auto generate the
initializers. NFC.

Differential revision: https://reviews.llvm.org/D73121
This commit is contained in:
Jonas Devlieghere 2020-01-21 22:20:48 -08:00
parent 7bdc83f340
commit 1d1ebb9e59
4 changed files with 29 additions and 22 deletions

View File

@ -63,8 +63,7 @@
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
@ -244,8 +243,7 @@ llvm::Error SystemInitializerFull::Initialize() {
SymbolFileDWARFDebugMap::Initialize();
ItaniumABILanguageRuntime::Initialize();
AppleObjCRuntimeV2::Initialize();
AppleObjCRuntimeV1::Initialize();
AppleObjCRuntime::Initialize();
SystemRuntimeMacOSX::Initialize();
RenderScriptRuntime::Initialize();
@ -338,8 +336,7 @@ void SystemInitializerFull::Terminate() {
SymbolFileDWARFDebugMap::Terminate();
ItaniumABILanguageRuntime::Terminate();
AppleObjCRuntimeV2::Terminate();
AppleObjCRuntimeV1::Terminate();
AppleObjCRuntime::Terminate();
SystemRuntimeMacOSX::Terminate();
RenderScriptRuntime::Terminate();

View File

@ -8,10 +8,12 @@
//===----------------------------------------------------------------------===//
#include "AppleObjCRuntime.h"
#include "AppleObjCRuntimeV1.h"
#include "AppleObjCRuntimeV2.h"
#include "AppleObjCTrampolineHandler.h"
#include "clang/AST/Type.h"
#include "Plugins/Language/ObjC/NSString.h"
#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
#include "Plugins/Process/Utility/HistoryThread.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
@ -35,10 +37,7 @@
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "Plugins/Process/Utility/HistoryThread.h"
#include "Plugins/Language/ObjC/NSString.h"
#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
#include "clang/AST/Type.h"
#include <vector>
@ -55,6 +54,16 @@ AppleObjCRuntime::AppleObjCRuntime(Process *process)
ReadObjCLibraryIfNeeded(process->GetTarget().GetImages());
}
void AppleObjCRuntime::Initialize() {
AppleObjCRuntimeV2::Initialize();
AppleObjCRuntimeV1::Initialize();
}
void AppleObjCRuntime::Terminate() {
AppleObjCRuntimeV2::Terminate();
AppleObjCRuntimeV1::Terminate();
}
bool AppleObjCRuntime::GetObjectDescription(Stream &str, ValueObject &valobj) {
CompilerType compiler_type(valobj.GetCompilerType());
bool is_signed;
@ -479,7 +488,7 @@ ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread(
auto descriptor = GetClassDescriptor(*cpp_exception);
if (!descriptor || !descriptor->IsValid()) return ValueObjectSP();
while (descriptor) {
ConstString class_name(descriptor->GetClassName());
if (class_name == "NSException")

View File

@ -31,6 +31,10 @@ public:
static char ID;
static void Initialize();
static void Terminate();
bool isA(const void *ClassID) const override {
return ClassID == &ID || ObjCLanguageRuntime::isA(ClassID);
}
@ -84,7 +88,7 @@ public:
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
lldb::SearchFilterSP CreateExceptionSearchFilter() override;
static std::tuple<FileSpec, ConstString> GetExceptionThrowLocation();
lldb::ValueObjectSP GetExceptionObjectForThread(
@ -97,7 +101,7 @@ public:
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
lldb::addr_t &cf_false);
virtual bool IsTaggedPointer (lldb::addr_t addr) { return false; }
protected:

View File

@ -53,8 +53,7 @@
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
@ -215,8 +214,7 @@ llvm::Error SystemInitializerTest::Initialize() {
SymbolFileDWARFDebugMap::Initialize();
ItaniumABILanguageRuntime::Initialize();
AppleObjCRuntimeV2::Initialize();
AppleObjCRuntimeV1::Initialize();
AppleObjCRuntime::Initialize();
SystemRuntimeMacOSX::Initialize();
RenderScriptRuntime::Initialize();
@ -308,8 +306,7 @@ void SystemInitializerTest::Terminate() {
SymbolFileDWARFDebugMap::Terminate();
ItaniumABILanguageRuntime::Terminate();
AppleObjCRuntimeV2::Terminate();
AppleObjCRuntimeV1::Terminate();
AppleObjCRuntime::Terminate();
SystemRuntimeMacOSX::Terminate();
RenderScriptRuntime::Terminate();