Skip to content

Commit ec92253

Browse files
authored
Merge pull request #29737 from apple/revert-29699-59238327
Revert "Emit debug info for generic type aliases. …"
2 parents 7177f4a + f53b1a7 commit ec92253

File tree

4 files changed

+15
-67
lines changed

4 files changed

+15
-67
lines changed

lib/IRGen/DebugTypeInfo.cpp

+12-17
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -3660,7 +3660,7 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
36603660
llvm::SmallVector<llvm::Value *, 8> Copy;
36613661
emitShadowCopyIfNeeded(SILVal, i->getDebugScope(), *VarInfo, IsAnonymous,
36623662
Copy);
3663-
bindArchetypes(RealTy);
3663+
bindArchetypes(DbgTy.getType());
36643664
if (!IGM.DebugInfo)
36653665
return;
36663666

@@ -3691,7 +3691,7 @@ void IRGenSILFunction::visitDebugValueAddrInst(DebugValueAddrInst *i) {
36913691

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

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

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

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

-28
This file was deleted.

test/DebugInfo/generic-typealias.swift

-19
This file was deleted.

0 commit comments

Comments
 (0)