Remove Resilience workarounds and describe fixed-size global resilient

variables in DWARF.

rdar://problem/48409386
This commit is contained in:
Adrian Prantl
2019-03-19 11:41:04 -07:00
parent c7a6f8a5ef
commit 0b8fc3d405
7 changed files with 50 additions and 60 deletions

View File

@@ -327,15 +327,21 @@ private:
return fail<uint64_t>(Failure::TypeHasNoSuchMember, memberName);
// Fast path: element 0 is always at offset 0.
if (targetIndex == 0) return uint64_t(0);
if (targetIndex == 0)
return uint64_t(0);
// Create an IRGen instance.
auto irgen = getIRGen();
if (!irgen) return Result<uint64_t>::emplaceFailure(Failure::Unknown);
if (!irgen)
return Result<uint64_t>::emplaceFailure(Failure::Unknown);
auto &IGM = irgen->IGM;
SILType loweredTy = IGM.getLoweredType(type);
// Only the runtime metadata knows the offsets of resilient members.
auto &typeInfo = IGM.getTypeInfo(loweredTy);
if (!isa<irgen::FixedTypeInfo>(&typeInfo))
return Result<uint64_t>::emplaceFailure(Failure::NotFixedLayout);
// If the type has a statically fixed offset, return that.
if (auto offset =
irgen::getFixedTupleElementOffset(IGM, loweredTy, targetIndex))