Skip to content

Revert "[lldb][NFC] Expose GetReflectionContext in SwiftLanguageRuntime's API" #7671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lldb/source/Plugins/LanguageRuntime/Swift/ReflectionContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
//
//===----------------------------------------------------------------------===//

#include "ReflectionContextInterface.h"
#include "SwiftLanguageRuntimeImpl.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
Expand All @@ -26,7 +25,7 @@ namespace {
/// 32-bit or 64-bit pointers, with and without ObjC interoperability.
template <typename ReflectionContext>
class TargetReflectionContext
: public ReflectionContextInterface {
: public SwiftLanguageRuntimeImpl::ReflectionContextInterface {
ReflectionContext m_reflection_ctx;
swift::reflection::TypeConverter m_type_converter;

Expand Down Expand Up @@ -143,9 +142,10 @@ class TargetReflectionContext
return m_reflection_ctx.getBuilder().lookupSuperclass(tr);
}

bool ForEachSuperClassType(swift::remote::TypeInfoProvider *tip,
lldb::addr_t pointer,
std::function<bool(SuperClassType)> fn) override {
bool ForEachSuperClassType(
swift::remote::TypeInfoProvider *tip, lldb::addr_t pointer,
std::function<bool(SwiftLanguageRuntimeImpl::SuperClassType)> fn)
override {
// Guard against faulty self-referential metadata.
unsigned limit = 256;
auto md_ptr = m_reflection_ctx.readMetadataFromInstance(pointer);
Expand Down Expand Up @@ -239,8 +239,8 @@ class TargetReflectionContext
} // namespace

namespace lldb_private {
std::unique_ptr<ReflectionContextInterface>
ReflectionContextInterface::CreateReflectionContext(
std::unique_ptr<SwiftLanguageRuntimeImpl::ReflectionContextInterface>
SwiftLanguageRuntimeImpl::ReflectionContextInterface::CreateReflectionContext(
uint8_t ptr_size, std::shared_ptr<swift::remote::MemoryReader> reader,
bool ObjCInterop, SwiftMetadataCache *swift_metadata_cache) {
using ReflectionContext32ObjCInterop =
Expand Down
142 changes: 0 additions & 142 deletions lldb/source/Plugins/LanguageRuntime/Swift/ReflectionContextInterface.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include "SwiftLanguageRuntime.h"
#include "Plugins/LanguageRuntime/Swift/LLDBMemoryReader.h"
#include "ReflectionContextInterface.h"
#include "SwiftLanguageRuntimeImpl.h"
#include "SwiftMetadataCache.h"

Expand Down Expand Up @@ -234,11 +233,6 @@ class SwiftLanguageRuntimeStub {
assert(false && "called into swift language runtime stub"); \
} while (0)

ThreadSafeReflectionContext GetReflectionContext() {
STUB_LOG();
return ThreadSafeReflectionContext::MakeInvalid();
}

bool GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Expand Down Expand Up @@ -451,7 +445,7 @@ static bool HasReflectionInfo(ObjectFile *obj_file) {
return hasReflectionSection;
}

ThreadSafeReflectionContext
SwiftLanguageRuntimeImpl::ThreadSafeReflectionContext
SwiftLanguageRuntimeImpl::GetReflectionContext() {
m_reflection_ctx_mutex.lock();
SetupReflection();
Expand Down Expand Up @@ -2339,11 +2333,6 @@ void SwiftLanguageRuntime::Terminate() {
assert(m_impl || m_stub); \
return m_impl ? m_impl->METHOD(__VA_ARGS__) : m_stub->METHOD(__VA_ARGS__);

ThreadSafeReflectionContext
SwiftLanguageRuntime::GetReflectionContext() {
FORWARD(GetReflectionContext);
}

bool SwiftLanguageRuntime::GetDynamicTypeAndAddress(
ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#define liblldb_SwiftLanguageRuntime_h_

#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/LanguageRuntime/Swift/SwiftMetadataCache.h"
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
#include "lldb/Breakpoint/BreakpointPrecondition.h"
#include "lldb/Core/PluginInterface.h"
Expand Down Expand Up @@ -51,7 +50,6 @@ class TypeBase;
} // namespace swift

namespace lldb_private {
struct ThreadSafeReflectionContext;

/// Statically cast a CompilerType to a Swift type.
swift::Type GetSwiftType(CompilerType type);
Expand All @@ -60,7 +58,6 @@ swift::CanType GetCanonicalSwiftType(CompilerType type);

class SwiftLanguageRuntimeStub;
class SwiftLanguageRuntimeImpl;
class ReflectionContextInterface;

class SwiftLanguageRuntime : public LanguageRuntime {
protected:
Expand All @@ -76,7 +73,6 @@ class SwiftLanguageRuntime : public LanguageRuntime {
std::unique_ptr<SwiftLanguageRuntimeImpl> m_impl;

public:
ThreadSafeReflectionContext GetReflectionContext();
static char ID;

bool isA(const void *ClassID) const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//

#include "LLDBMemoryReader.h"
#include "ReflectionContextInterface.h"
#include "SwiftLanguageRuntime.h"
#include "SwiftLanguageRuntimeImpl.h"
#include "SwiftMetadataCache.h"
Expand Down Expand Up @@ -221,6 +220,9 @@ lldb::addr_t SwiftLanguageRuntime::MaybeMaskNonTrivialReferencePointer(
return addr & ~mask;
}

SwiftLanguageRuntimeImpl::ReflectionContextInterface::
~ReflectionContextInterface() {}

const CompilerType &SwiftLanguageRuntimeImpl::GetBoxMetadataType() {
if (m_box_metadata_type.IsValid())
return m_box_metadata_type;
Expand Down
Loading