@@ -60,25 +60,20 @@ DebugTypeInfo DebugTypeInfo::getFromTypeInfo(swift::Type Ty,
60
60
61
61
DebugTypeInfo DebugTypeInfo::getLocalVariable (VarDecl *Decl, swift::Type Ty,
62
62
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
+
63
72
// Prefer the original, potentially sugared version of the type if
64
73
// 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);
82
77
}
83
78
84
79
DebugTypeInfo DebugTypeInfo::getMetadata (swift::Type Ty, llvm::Type *StorageTy,
0 commit comments