Skip to content

Commit 24aeaab

Browse files
Revert "Make Objective-C interoperability configurable in the runtime"
1 parent 0881177 commit 24aeaab

File tree

4 files changed

+16
-40
lines changed

4 files changed

+16
-40
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,14 @@ void SwiftLanguageRuntimeImpl::SetupReflection() {
461461

462462
auto &target = m_process.GetTarget();
463463
if (auto exe_module = target.GetExecutableModule()) {
464-
bool objc_interop = (bool)findRuntime(m_process, RuntimeKind::ObjC);
465-
const char *objc_interop_msg =
466-
objc_interop ? "with Objective-C interopability" : "Swift only";
467-
468464
auto &triple = exe_module->GetArchitecture().GetTriple();
469-
if (triple.isArch64Bit()) {
470-
LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
471-
"Initializing a 64-bit reflection context (%s) for \"%s\"",
472-
triple.str().c_str(), objc_interop_msg);
465+
if (triple.isArch64Bit())
473466
m_reflection_ctx = ReflectionContextInterface::CreateReflectionContext64(
474-
this->GetMemoryReader(), objc_interop);
475-
} else if (triple.isArch32Bit()) {
476-
LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
477-
"Initializing a 32-bit reflection context (%s) for \"%s\"",
478-
triple.str().c_str(), objc_interop_msg);
467+
this->GetMemoryReader());
468+
else if (triple.isArch32Bit())
479469
m_reflection_ctx = ReflectionContextInterface::CreateReflectionContext32(
480-
this->GetMemoryReader(), objc_interop);
481-
} else {
470+
this->GetMemoryReader());
471+
else {
482472
LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
483473
"Could not initialize reflection context for \"%s\"",
484474
triple.str().c_str());

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MemoryReader;
3434
class RemoteAddress;
3535
} // namespace remote
3636

37-
template <typename Runtime> struct External;
37+
template <typename T> struct External;
3838
template <unsigned PointerSize> struct RuntimeTarget;
3939

4040
namespace reflection {

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,12 @@ namespace {
231231

232232
/// An implementation of the generic ReflectionContextInterface that
233233
/// is templatized on target pointer width and specialized to either
234-
/// 32-bit or 64-bit pointers, with and without ObjC interoperability.
235-
template <typename ReflectionContext>
234+
/// 32-bit or 64-bit pointers.
235+
template <unsigned PointerSize>
236236
class TargetReflectionContext
237237
: public SwiftLanguageRuntimeImpl::ReflectionContextInterface {
238+
using ReflectionContext = swift::reflection::ReflectionContext<
239+
swift::External<swift::RuntimeTarget<PointerSize>>>;
238240
ReflectionContext m_reflection_ctx;
239241

240242
public:
@@ -346,30 +348,14 @@ class TargetReflectionContext
346348

347349
std::unique_ptr<SwiftLanguageRuntimeImpl::ReflectionContextInterface>
348350
SwiftLanguageRuntimeImpl::ReflectionContextInterface::CreateReflectionContext32(
349-
std::shared_ptr<swift::remote::MemoryReader> reader, bool ObjCInterop) {
350-
using ReflectionContext32ObjCInterop =
351-
TargetReflectionContext<swift::reflection::ReflectionContext<
352-
swift::External<swift::WithObjCInterop<swift::RuntimeTarget<4>>>>>;
353-
using ReflectionContext32NoObjCInterop =
354-
TargetReflectionContext<swift::reflection::ReflectionContext<
355-
swift::External<swift::NoObjCInterop<swift::RuntimeTarget<4>>>>>;
356-
if (ObjCInterop)
357-
return std::make_unique<ReflectionContext32ObjCInterop>(reader);
358-
return std::make_unique<ReflectionContext32NoObjCInterop>(reader);
351+
std::shared_ptr<swift::remote::MemoryReader> reader) {
352+
return std::make_unique<TargetReflectionContext<4>>(reader);
359353
}
360354

361355
std::unique_ptr<SwiftLanguageRuntimeImpl::ReflectionContextInterface>
362356
SwiftLanguageRuntimeImpl::ReflectionContextInterface::CreateReflectionContext64(
363-
std::shared_ptr<swift::remote::MemoryReader> reader, bool ObjCInterop) {
364-
using ReflectionContext64ObjCInterop =
365-
TargetReflectionContext<swift::reflection::ReflectionContext<
366-
swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8>>>>>;
367-
using ReflectionContext64NoObjCInterop =
368-
TargetReflectionContext<swift::reflection::ReflectionContext<
369-
swift::External<swift::NoObjCInterop<swift::RuntimeTarget<8>>>>>;
370-
if (ObjCInterop)
371-
return std::make_unique<ReflectionContext64ObjCInterop>(reader);
372-
return std::make_unique<ReflectionContext64NoObjCInterop>(reader);
357+
std::shared_ptr<swift::remote::MemoryReader> reader) {
358+
return std::make_unique<TargetReflectionContext<8>>(reader);
373359
}
374360

375361
SwiftLanguageRuntimeImpl::ReflectionContextInterface::

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ class SwiftLanguageRuntimeImpl {
200200
/// Return a 32-bit reflection context.
201201
static std::unique_ptr<ReflectionContextInterface>
202202
CreateReflectionContext32(
203-
std::shared_ptr<swift::remote::MemoryReader> reader, bool ObjCInterop);
203+
std::shared_ptr<swift::remote::MemoryReader> reader);
204204

205205
/// Return a 64-bit reflection context.
206206
static std::unique_ptr<ReflectionContextInterface>
207207
CreateReflectionContext64(
208-
std::shared_ptr<swift::remote::MemoryReader> reader, bool ObjCInterop);
208+
std::shared_ptr<swift::remote::MemoryReader> reader);
209209

210210
virtual ~ReflectionContextInterface();
211211

0 commit comments

Comments
 (0)