File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -690,6 +690,28 @@ class MetadataReader {
690690 RemoteAddress (StartOfValue));
691691 }
692692
693+ // / Given a known-opaque existential, discover if its value is inlined in
694+ // / the existential container.
695+ llvm::Optional<bool >
696+ isValueInlinedInExistentialContainer (RemoteAddress ExistentialAddress) {
697+ // OpaqueExistentialContainer is the layout of an opaque existential.
698+ // `Type` is the pointer to the metadata.
699+ TargetOpaqueExistentialContainer<Runtime> Container;
700+ if (!Reader->readBytes (RemoteAddress (ExistentialAddress),
701+ (uint8_t *)&Container, sizeof (Container)))
702+ return None;
703+ auto MetadataAddress = static_cast <StoredPointer>(Container.Type );
704+ auto Metadata = readMetadata (MetadataAddress);
705+ if (!Metadata)
706+ return None;
707+
708+ auto VWT = readValueWitnessTable (MetadataAddress);
709+ if (!VWT)
710+ return None;
711+
712+ return VWT->isValueInline ();
713+ }
714+
693715 // / Read a protocol from a reference to said protocol.
694716 template <typename Resolver>
695717 typename Resolver::Result readProtocol (
You can’t perform that action at this time.
0 commit comments