mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Remove Resilience workarounds and describe fixed-size global resilient
variables in DWARF. rdar://problem/48409386
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user