Add a callback to swift::reflection::MemoryReader that allows LLDB to provide

swift::reflection::TypeInfo for (Clang-)imported non-Objective-C types. This is
needed to reflect on the size mixed Swift / Clang types, when no type metadata
is available for the C types.

This is a necessary ingredient for the TypeRef-based Swift context in
LLDB. Because we do not have reflection metadata for pure C types in Swift,
reflection cannot compute TypeInfo for NominalTypeRefs for those types. By
providing this callback, LLDB can supply this information for DWARF, and
reflection can compute TypeInfos for mixed Swift/C types.
This commit is contained in:
Adrian Prantl
2020-08-11 17:41:19 -07:00
parent 45be7f2192
commit 4b9cf31ba0
12 changed files with 185 additions and 114 deletions

View File

@@ -37,7 +37,8 @@ namespace remote {
class MemoryReader {
public:
/// A convenient name for the return type from readBytes.
using ReadBytesResult = std::unique_ptr<const void, std::function<void(const void *)>>;
using ReadBytesResult =
std::unique_ptr<const void, std::function<void(const void *)>>;
virtual bool queryDataLayout(DataLayoutQueryType type, void *inBuffer,
void *outBuffer) = 0;
@@ -152,9 +153,8 @@ public:
return resolvePointer(address, pointerData);
}
// Parse extra inhabitants stored in a pointer.
// Parse extra inhabitants stored in a pointer.
// Sets *extraInhabitant to -1 if the pointer at this address
// is actually a valid pointer.
// Otherwise, it sets *extraInhabitant to the inhabitant