Skip to content

[lldb][NFC] Expose GetReflectionContext in SwiftLanguageRuntime's API #7658

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

Conversation

augusto2112
Copy link

This is in preparation for building type infos from DWARF, which will need access to the reflection context and it's builder.

std::recursive_mutex &mutex)
: m_reflection_ctx(reflection_ctx), m_lock(mutex, std::adopt_lock) {}

static ThreadSafeReflectionContext MakeInvalid() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrian-prantl @kastiglione I'm not really happy with this, but it's required for returning the "empty" case in the stub language runtime. If you have any ideas on how to make this better I'd be happy to listen.

} // namespace swift

namespace lldb_private {
struct SwiftMetadataCache;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format

@augusto2112 augusto2112 force-pushed the refactor-get-reflection-context branch from cd003f3 to c00b71b Compare October 20, 2023 23:18
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112 augusto2112 force-pushed the refactor-get-reflection-context branch from c00b71b to c3b8af3 Compare October 23, 2023 17:28
@augusto2112
Copy link
Author

@swift-ci test

This is in preparation for building type infos from DWARF, which will
need access to the reflection context and it's builder.
@augusto2112 augusto2112 force-pushed the refactor-get-reflection-context branch from c3b8af3 to 41a8e85 Compare October 23, 2023 23:14
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112 augusto2112 merged commit 57d6673 into swiftlang:stable/20230725 Oct 24, 2023
@tristanlabelle
Copy link

@augusto2112 I'm seeing the build fail on Windows after this change:

2023-10-24T20:31:06.4073283Z C:\a\swift-build\swift-build\SourceCache\llvm-project\lldb\source\Plugins\LanguageRuntime\Swift\SwiftLanguageRuntime.cpp(2344): error C2280: 'lldb_private::ThreadSafeReflectionContext::ThreadSafeReflectionContext(const lldb_private::ThreadSafeReflectionContext &)': attempting to reference a deleted function

I think the following implies a copy construction, which is not generated because of std::lock_guard<std::recursive_mutex> m_lock; does not have a copy constructor. I think we need an explicit move constructor on ThreadSafeReflectionContext.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants