Skip to content

Revert "Emit debug info for generic type aliases. …" #29737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions lib/IRGen/DebugTypeInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,20 @@ DebugTypeInfo DebugTypeInfo::getFromTypeInfo(swift::Type Ty,

DebugTypeInfo DebugTypeInfo::getLocalVariable(VarDecl *Decl, swift::Type Ty,
const TypeInfo &Info) {

auto DeclType = Decl->getInterfaceType();
auto RealType = Ty;

// DynamicSelfType is also sugar as far as debug info is concerned.
auto Sugared = DeclType;
if (auto DynSelfTy = DeclType->getAs<DynamicSelfType>())
Sugared = DynSelfTy->getSelfType();

// Prefer the original, potentially sugared version of the type if
// the type hasn't been mucked with by an optimization pass.
swift::Type DeclType = Decl->getInterfaceType();
swift::Type RealType = Ty;

swift::Type DebugType;
if (auto DynSelfTy = DeclType->getAs<DynamicSelfType>()) {
// DynamicSelfType is also sugar as far as debug info is concerned.
auto DesugaredSelf = DynSelfTy->getSelfType();
DebugType = DesugaredSelf->isEqual(RealType) ? DynSelfTy : RealType;
} else {
// Map the sugared type into the context to resolve bound generics and
// generic type aliases.
DeclContext *DeclCtx = Decl->getDeclContext();
swift::Type Sugared =
DeclCtx ? DeclCtx->mapTypeIntoContext(DeclType) : DeclType;
DebugType = Sugared->isEqual(RealType) ? Sugared : RealType;
}
return getFromTypeInfo(DebugType, Info);
auto *Type = Sugared->isEqual(RealType) ? DeclType.getPointer()
: RealType.getPointer();
return getFromTypeInfo(Type, Info);
}

DebugTypeInfo DebugTypeInfo::getMetadata(swift::Type Ty, llvm::Type *StorageTy,
Expand Down
6 changes: 3 additions & 3 deletions lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3660,7 +3660,7 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
llvm::SmallVector<llvm::Value *, 8> Copy;
emitShadowCopyIfNeeded(SILVal, i->getDebugScope(), *VarInfo, IsAnonymous,
Copy);
bindArchetypes(RealTy);
bindArchetypes(DbgTy.getType());
if (!IGM.DebugInfo)
return;

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

auto DbgTy = DebugTypeInfo::getLocalVariable(
Decl, RealType, getTypeInfo(SILVal->getType()));
bindArchetypes(RealType);
bindArchetypes(DbgTy.getType());
if (!IGM.DebugInfo)
return;

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

bindArchetypes(RealType);
bindArchetypes(DbgTy.getType());
if (IGM.DebugInfo)
emitDebugVariableDeclaration(addr, DbgTy, SILTy, DS, Decl, *VarInfo,
Indirection);
Expand Down
28 changes: 0 additions & 28 deletions test/DebugInfo/bound-generic-struct-extension.swift

This file was deleted.

19 changes: 0 additions & 19 deletions test/DebugInfo/generic-typealias.swift

This file was deleted.