Skip to content

Commit ec4f1fd

Browse files
committed
Use external but native runtime target template for SwiftRemoteMirror
Although the SwiftRemoteMirror library targets a specific architecture, it's still an external runtime, so treat it as such. The InProcess template argument is reserved for truly in-process reflection in the Runtime.
1 parent 9863e49 commit ec4f1fd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
using namespace swift;
55
using namespace reflection;
66

7+
using NativeReflectionContext
8+
= ReflectionContext<External<RuntimeTarget<sizeof(uintptr_t)>>>;
9+
710
SwiftReflectionContextRef
811
swift_reflection_createReflectionContext(PointerSizeFunction getPointerSize,
912
SizeSizeFunction getSizeSize,
@@ -19,7 +22,8 @@ swift_reflection_createReflectionContext(PointerSizeFunction getPointerSize,
1922
};
2023

2124
auto Reader = std::make_shared<CMemoryReader>(ReaderImpl);
22-
auto Context = new ReflectionContext<InProcess>(Reader);
25+
auto Context
26+
= new ReflectionContext<External<RuntimeTarget<sizeof(uintptr_t)>>>(Reader);
2327
return reinterpret_cast<SwiftReflectionContextRef>(Context);
2428
}
2529

@@ -42,11 +46,12 @@ swift_reflection_addReflectionInfo(SwiftReflectionContextRef ContextRef,
4246
GenericSection(reflstr.Begin, reflstr.End),
4347
GenericSection(typeref.Begin, typeref.End)
4448
};
45-
auto Context = reinterpret_cast<ReflectionContext<InProcess> *>(ContextRef);
49+
auto Context = reinterpret_cast<NativeReflectionContext *>(ContextRef);
4650
Context->addReflectionInfo(Info);
4751
}
4852

4953
void swift_reflection_clearCaches(SwiftReflectionContextRef ContextRef) {
50-
auto Context = reinterpret_cast<ReflectionContext<InProcess> *>(ContextRef);
54+
auto Context = reinterpret_cast<NativeReflectionContext *>(ContextRef);
5155
Context->clear();
5256
}
57+

0 commit comments

Comments
 (0)