2626using namespace swift ;
2727using namespace irgen ;
2828
29- DebugTypeInfo::DebugTypeInfo (swift::Type Ty, llvm::Type *FragmentStorageTy ,
30- Alignment Align , bool HasDefaultAlignment ,
31- bool IsMetadata, bool IsFixedBuffer,
29+ DebugTypeInfo::DebugTypeInfo (swift::Type Ty, Alignment Align ,
30+ bool HasDefaultAlignment , bool IsMetadata ,
31+ bool IsFixedBuffer,
3232 std::optional<uint32_t > NumExtraInhabitants)
33- : Type(Ty.getPointer()), FragmentStorageType(FragmentStorageTy),
34- NumExtraInhabitants(NumExtraInhabitants),
33+ : Type(Ty.getPointer()), NumExtraInhabitants(NumExtraInhabitants),
3534 Align(Align), DefaultAlignment(HasDefaultAlignment),
3635 IsMetadataType(IsMetadata), IsFixedBuffer(IsFixedBuffer) {
3736 assert (Align.getValue () != 0 );
@@ -49,15 +48,14 @@ static bool hasDefaultAlignment(swift::Type Ty) {
4948
5049DebugTypeInfo DebugTypeInfo::getFromTypeInfo (swift::Type Ty, const TypeInfo &TI,
5150 IRGenModule &IGM) {
52- llvm::Type *StorageType = TI.getStorageType ();
5351 std::optional<uint32_t > NumExtraInhabitants;
5452 if (TI.isFixedSize ()) {
5553 const FixedTypeInfo &FixTy = *cast<const FixedTypeInfo>(&TI);
5654 NumExtraInhabitants = FixTy.getFixedExtraInhabitantCount (IGM);
5755 }
5856 assert (TI.getStorageType () && " StorageType is a nullptr" );
59- return DebugTypeInfo (Ty.getPointer (), StorageType ,
60- TI. getBestKnownAlignment (), ::hasDefaultAlignment (Ty),
57+ return DebugTypeInfo (Ty.getPointer (), TI. getBestKnownAlignment () ,
58+ ::hasDefaultAlignment (Ty),
6159 /* IsMetadataType = */ false,
6260 /* IsFixedBuffer = */ false, NumExtraInhabitants);
6361}
@@ -81,25 +79,21 @@ DebugTypeInfo DebugTypeInfo::getLocalVariable(VarDecl *Decl, swift::Type Ty,
8179 return getFromTypeInfo (Type, Info, IGM);
8280}
8381
84- DebugTypeInfo DebugTypeInfo::getGlobalMetadata (swift::Type Ty,
85- llvm::Type *StorageTy, Size size,
82+ DebugTypeInfo DebugTypeInfo::getGlobalMetadata (swift::Type Ty, Size size,
8683 Alignment align) {
87- DebugTypeInfo DbgTy (Ty.getPointer (), StorageTy, align,
84+ DebugTypeInfo DbgTy (Ty.getPointer (), align,
8885 /* HasDefaultAlignment = */ true ,
8986 /* IsMetadataType = */ false );
90- assert (StorageTy && " StorageType is a nullptr" );
9187 assert (!DbgTy.isContextArchetype () &&
9288 " type metadata cannot contain an archetype" );
9389 return DbgTy;
9490}
9591
96- DebugTypeInfo DebugTypeInfo::getTypeMetadata (swift::Type Ty,
97- llvm::Type *StorageTy, Size size,
92+ DebugTypeInfo DebugTypeInfo::getTypeMetadata (swift::Type Ty, Size size,
9893 Alignment align) {
99- DebugTypeInfo DbgTy (Ty.getPointer (), StorageTy, align,
94+ DebugTypeInfo DbgTy (Ty.getPointer (), align,
10095 /* HasDefaultAlignment = */ true ,
10196 /* IsMetadataType = */ true );
102- assert (StorageTy && " StorageType is a nullptr" );
10397 assert (!DbgTy.isContextArchetype () &&
10498 " type metadata cannot contain an archetype" );
10599 return DbgTy;
@@ -111,7 +105,6 @@ DebugTypeInfo DebugTypeInfo::getForwardDecl(swift::Type Ty) {
111105}
112106
113107DebugTypeInfo DebugTypeInfo::getGlobal (SILGlobalVariable *GV,
114- llvm::Type *FragmentStorageType,
115108 IRGenModule &IGM) {
116109 // Prefer the original, potentially sugared version of the type if
117110 // the type hasn't been mucked with by an optimization pass.
@@ -124,16 +117,14 @@ DebugTypeInfo DebugTypeInfo::getGlobal(SILGlobalVariable *GV,
124117 }
125118 auto &TI = IGM.getTypeInfoForUnlowered (Type);
126119 DebugTypeInfo DbgTy = getFromTypeInfo (Type, TI, IGM);
127- assert (FragmentStorageType && " FragmentStorageType is a nullptr" );
128120 assert (!DbgTy.isContextArchetype () &&
129121 " type of global variable cannot be an archetype" );
130122 return DbgTy;
131123}
132124
133- DebugTypeInfo
134- DebugTypeInfo::getGlobalFixedBuffer (SILGlobalVariable *GV,
135- llvm::Type *FragmentStorageType,
136- Size SizeInBytes, Alignment Align) {
125+ DebugTypeInfo DebugTypeInfo::getGlobalFixedBuffer (SILGlobalVariable *GV,
126+ Size SizeInBytes,
127+ Alignment Align) {
137128 // Prefer the original, potentially sugared version of the type if
138129 // the type hasn't been mucked with by an optimization pass.
139130 auto LowTy = GV->getLoweredType ().getASTType ();
@@ -143,23 +134,18 @@ DebugTypeInfo::getGlobalFixedBuffer(SILGlobalVariable *GV,
143134 if (DeclType->isEqual (LowTy))
144135 Type = DeclType.getPointer ();
145136 }
146- DebugTypeInfo DbgTy (Type, FragmentStorageType,
147- Align, ::hasDefaultAlignment (Type),
137+ DebugTypeInfo DbgTy (Type, Align, ::hasDefaultAlignment (Type),
148138 /* IsMetadataType = */ false , /* IsFixedBuffer = */ true );
149- assert (FragmentStorageType && " FragmentStorageType is a nullptr" );
150139 assert (!DbgTy.isContextArchetype () &&
151140 " type of global variable cannot be an archetype" );
152141 return DbgTy;
153142}
154143
155- DebugTypeInfo DebugTypeInfo::getObjCClass (ClassDecl *theClass,
156- llvm::Type *FragmentStorageType,
157- Size SizeInBytes, Alignment align) {
158- DebugTypeInfo DbgTy (theClass->getInterfaceType ().getPointer (),
159- FragmentStorageType, align,
144+ DebugTypeInfo DebugTypeInfo::getObjCClass (ClassDecl *theClass, Size SizeInBytes,
145+ Alignment align) {
146+ DebugTypeInfo DbgTy (theClass->getInterfaceType ().getPointer (), align,
160147 /* HasDefaultAlignment = */ true ,
161148 /* IsMetadataType = */ false );
162- assert (FragmentStorageType && " FragmentStorageType is a nullptr" );
163149 assert (!DbgTy.isContextArchetype () &&
164150 " type of objc class cannot be an archetype" );
165151 return DbgTy;
@@ -194,7 +180,7 @@ TypeDecl *DebugTypeInfo::getDecl() const {
194180}
195181
196182bool DebugTypeInfo::isForwardDecl () const {
197- return isNull () || (!FragmentStorageType && ! isa<TypeAliasType>(getType ()));
183+ return isNull () || (!isa<TypeAliasType>(getType ()));
198184}
199185
200186#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -204,17 +190,14 @@ LLVM_DUMP_METHOD void DebugTypeInfo::dump() const {
204190 if (auto *Type = getType ())
205191 Type->dump (llvm::errs ());
206192
207- if (FragmentStorageType) {
208- llvm::errs () << " FragmentStorageType=" ;
209- FragmentStorageType->dump ();
210- }
211193 if (isForwardDecl ())
212194 llvm::errs () << " forward-declared\n " ;
213195}
214196#endif
215197
216198std::optional<CompletedDebugTypeInfo>
217- CompletedDebugTypeInfo::getFromTypeInfo (swift::Type Ty, const TypeInfo &Info, IRGenModule &IGM) {
199+ CompletedDebugTypeInfo::getFromTypeInfo (swift::Type Ty, const TypeInfo &Info,
200+ IRGenModule &IGM) {
218201 auto *StorageType = IGM.getStorageTypeForUnlowered (Ty);
219202 std::optional<uint64_t > SizeInBits;
220203 if (StorageType->isSized ())
0 commit comments