File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -417,7 +417,20 @@ namespace {
417
417
IGF.IGM .getMetadataLayout (TheStruct.getStructOrBoundGenericStruct ());
418
418
auto offset =
419
419
structLayout.getFieldOffsetVectorOffset ().offsetBy (IGF, Size (index));
420
- return offset.getAsValue (IGF);
420
+
421
+ llvm::Value *metadata = IGF.emitTypeMetadataRefForLayout (TheStruct);
422
+ Address fieldVector = emitAddressOfFieldOffsetVector (IGF, metadata,
423
+ TheStruct.getStructOrBoundGenericStruct ());
424
+ fieldVector = IGF.Builder .CreateConstArrayGEP (fieldVector, index,
425
+ IGF.IGM .getPointerSize ());
426
+ auto oldRet = IGF.Builder .CreateLoad (fieldVector);
427
+ auto newRet = offset.getAsValue (IGF);
428
+
429
+ auto assertEq = IGF.IGM .Module .getFunction (" __swift_assert_equal" );
430
+ IGF.Builder .CreateCall (assertEq->getFunctionType (),
431
+ assertEq, {oldRet, newRet});
432
+
433
+ return newRet;
421
434
}
422
435
423
436
MemberAccessStrategy getFieldAccessStrategy (IRGenModule &IGM,
You can’t perform that action at this time.
0 commit comments