[Runtime] Replace use of C++ new with malloc()

(cherry picked from commit d576fa30c9)
This commit is contained in:
Doug Gregor
2025-04-16 11:26:15 -07:00
parent 8504b7f584
commit e8eed435ee

View File

@@ -563,14 +563,19 @@ namespace {
ConformanceLookupResult result)
: Type(key.Type), Witness(result.witnessTable)
{
if (result.globalActorIsolationType) {
ProtoOrStorage = new ExtendedStorage{
key.Proto, result.globalActorIsolationType,
result.globalActorIsolationWitnessTable
};
} else {
if (!result.globalActorIsolationType) {
ProtoOrStorage = key.Proto;
return;
}
// Allocate extended storage.
void *memory = malloc(sizeof(ExtendedStorage));
auto storage = new (memory) ExtendedStorage{
key.Proto, result.globalActorIsolationType,
result.globalActorIsolationWitnessTable
};
ProtoOrStorage = storage;
}
bool matchesKey(const ConformanceCacheKey &key) const {