[Lldb-commits] [lldb] 1d1ebb9 - [lldb/Initializers] Move all ObjC initializers into AppleObjCRuntime
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 21 22:26:10 PST 2020
Author: Jonas Devlieghere
Date: 2020-01-21T22:24:32-08:00
New Revision: 1d1ebb9e592bea931845296dd80a46fb46af2642
URL: https://github.com/llvm/llvm-project/commit/1d1ebb9e592bea931845296dd80a46fb46af2642
DIFF: https://github.com/llvm/llvm-project/commit/1d1ebb9e592bea931845296dd80a46fb46af2642.diff
LOG: [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
Added:
Modified:
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/tools/lldb-test/SystemInitializerTest.cpp
Removed:
################################################################################
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 6ae538045ffb..28c3b3b46a4b 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -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();
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 7076959bee97..a7cc5d042194 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -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")
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index 79ac53e1e440..d8959b4b050b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -31,6 +31,10 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
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 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
lldb::SearchFilterSP CreateExceptionSearchFilter() override;
-
+
static std::tuple<FileSpec, ConstString> GetExceptionThrowLocation();
lldb::ValueObjectSP GetExceptionObjectForThread(
@@ -97,7 +101,7 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
lldb::addr_t &cf_false);
-
+
virtual bool IsTaggedPointer (lldb::addr_t addr) { return false; }
protected:
diff --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index d6c52f54998a..5ce698e1af4d 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -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();
More information about the lldb-commits
mailing list