Skip to content

Commit 227485b

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 93896b5 + ec92253 commit 227485b

File tree

4 files changed

+15
-67
lines changed

4 files changed

+15
-67
lines changed

lib/IRGen/DebugTypeInfo.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,20 @@ DebugTypeInfo DebugTypeInfo::getFromTypeInfo(swift::Type Ty,
6060

6161
DebugTypeInfo DebugTypeInfo::getLocalVariable(VarDecl *Decl, swift::Type Ty,
6262
const TypeInfo &Info) {
63+
64+
auto DeclType = Decl->getInterfaceType();
65+
auto RealType = Ty;
66+
67+
// DynamicSelfType is also sugar as far as debug info is concerned.
68+
auto Sugared = DeclType;
69+
if (auto DynSelfTy = DeclType->getAs<DynamicSelfType>())
70+
Sugared = DynSelfTy->getSelfType();
71+
6372
// Prefer the original, potentially sugared version of the type if
6473
// the type hasn't been mucked with by an optimization pass.
65-
swift::Type DeclType = Decl->getInterfaceType();
66-
swift::Type RealType = Ty;
67-
68-
swift::Type DebugType;
69-
if (auto DynSelfTy = DeclType->getAs<DynamicSelfType>()) {
70-
// DynamicSelfType is also sugar as far as debug info is concerned.
71-
auto DesugaredSelf = DynSelfTy->getSelfType();
72-
DebugType = DesugaredSelf->isEqual(RealType) ? DynSelfTy : RealType;
73-
} else {
74-
// Map the sugared type into the context to resolve bound generics and
75-
// generic type aliases.
76-
DeclContext *DeclCtx = Decl->getDeclContext();
77-
swift::Type Sugared =
78-
DeclCtx ? DeclCtx->mapTypeIntoContext(DeclType) : DeclType;
79-
DebugType = Sugared->isEqual(RealType) ? Sugared : RealType;
80-
}
81-
return getFromTypeInfo(DebugType, Info);
74+
auto *Type = Sugared->isEqual(RealType) ? DeclType.getPointer()
75+
: RealType.getPointer();
76+
return getFromTypeInfo(Type, Info);
8277
}
8378

8479
DebugTypeInfo DebugTypeInfo::getMetadata(swift::Type Ty, llvm::Type *StorageTy,

lib/IRGen/IRGenSIL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3659,7 +3659,7 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
36593659
llvm::SmallVector<llvm::Value *, 8> Copy;
36603660
emitShadowCopyIfNeeded(SILVal, i->getDebugScope(), *VarInfo, IsAnonymous,
36613661
Copy);
3662-
bindArchetypes(RealTy);
3662+
bindArchetypes(DbgTy.getType());
36633663
if (!IGM.DebugInfo)
36643664
return;
36653665

@@ -3690,7 +3690,7 @@ void IRGenSILFunction::visitDebugValueAddrInst(DebugValueAddrInst *i) {
36903690

36913691
auto DbgTy = DebugTypeInfo::getLocalVariable(
36923692
Decl, RealType, getTypeInfo(SILVal->getType()));
3693-
bindArchetypes(RealType);
3693+
bindArchetypes(DbgTy.getType());
36943694
if (!IGM.DebugInfo)
36953695
return;
36963696

@@ -3990,7 +3990,7 @@ void IRGenSILFunction::emitDebugInfoForAllocStack(AllocStackInst *i,
39903990
auto RealType = SILTy.getASTType();
39913991
auto DbgTy = DebugTypeInfo::getLocalVariable(Decl, RealType, type);
39923992

3993-
bindArchetypes(RealType);
3993+
bindArchetypes(DbgTy.getType());
39943994
if (IGM.DebugInfo)
39953995
emitDebugVariableDeclaration(addr, DbgTy, SILTy, DS, Decl, *VarInfo,
39963996
Indirection);

test/DebugInfo/bound-generic-struct-extension.swift

Lines changed: 0 additions & 28 deletions
This file was deleted.

test/DebugInfo/generic-typealias.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)