26
26
using namespace swift ;
27
27
using namespace irgen ;
28
28
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,
32
32
std::optional<uint32_t > NumExtraInhabitants)
33
- : Type(Ty.getPointer()), FragmentStorageType(FragmentStorageTy),
34
- NumExtraInhabitants(NumExtraInhabitants),
33
+ : Type(Ty.getPointer()), NumExtraInhabitants(NumExtraInhabitants),
35
34
Align(Align), DefaultAlignment(HasDefaultAlignment),
36
35
IsMetadataType(IsMetadata), IsFixedBuffer(IsFixedBuffer) {
37
36
assert (Align.getValue () != 0 );
@@ -49,15 +48,14 @@ static bool hasDefaultAlignment(swift::Type Ty) {
49
48
50
49
DebugTypeInfo DebugTypeInfo::getFromTypeInfo (swift::Type Ty, const TypeInfo &TI,
51
50
IRGenModule &IGM) {
52
- llvm::Type *StorageType = TI.getStorageType ();
53
51
std::optional<uint32_t > NumExtraInhabitants;
54
52
if (TI.isFixedSize ()) {
55
53
const FixedTypeInfo &FixTy = *cast<const FixedTypeInfo>(&TI);
56
54
NumExtraInhabitants = FixTy.getFixedExtraInhabitantCount (IGM);
57
55
}
58
56
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),
61
59
/* IsMetadataType = */ false,
62
60
/* IsFixedBuffer = */ false, NumExtraInhabitants);
63
61
}
@@ -81,25 +79,21 @@ DebugTypeInfo DebugTypeInfo::getLocalVariable(VarDecl *Decl, swift::Type Ty,
81
79
return getFromTypeInfo (Type, Info, IGM);
82
80
}
83
81
84
- DebugTypeInfo DebugTypeInfo::getGlobalMetadata (swift::Type Ty,
85
- llvm::Type *StorageTy, Size size,
82
+ DebugTypeInfo DebugTypeInfo::getGlobalMetadata (swift::Type Ty, Size size,
86
83
Alignment align) {
87
- DebugTypeInfo DbgTy (Ty.getPointer (), StorageTy, align,
84
+ DebugTypeInfo DbgTy (Ty.getPointer (), align,
88
85
/* HasDefaultAlignment = */ true ,
89
86
/* IsMetadataType = */ false );
90
- assert (StorageTy && " StorageType is a nullptr" );
91
87
assert (!DbgTy.isContextArchetype () &&
92
88
" type metadata cannot contain an archetype" );
93
89
return DbgTy;
94
90
}
95
91
96
- DebugTypeInfo DebugTypeInfo::getTypeMetadata (swift::Type Ty,
97
- llvm::Type *StorageTy, Size size,
92
+ DebugTypeInfo DebugTypeInfo::getTypeMetadata (swift::Type Ty, Size size,
98
93
Alignment align) {
99
- DebugTypeInfo DbgTy (Ty.getPointer (), StorageTy, align,
94
+ DebugTypeInfo DbgTy (Ty.getPointer (), align,
100
95
/* HasDefaultAlignment = */ true ,
101
96
/* IsMetadataType = */ true );
102
- assert (StorageTy && " StorageType is a nullptr" );
103
97
assert (!DbgTy.isContextArchetype () &&
104
98
" type metadata cannot contain an archetype" );
105
99
return DbgTy;
@@ -111,7 +105,6 @@ DebugTypeInfo DebugTypeInfo::getForwardDecl(swift::Type Ty) {
111
105
}
112
106
113
107
DebugTypeInfo DebugTypeInfo::getGlobal (SILGlobalVariable *GV,
114
- llvm::Type *FragmentStorageType,
115
108
IRGenModule &IGM) {
116
109
// Prefer the original, potentially sugared version of the type if
117
110
// the type hasn't been mucked with by an optimization pass.
@@ -124,16 +117,14 @@ DebugTypeInfo DebugTypeInfo::getGlobal(SILGlobalVariable *GV,
124
117
}
125
118
auto &TI = IGM.getTypeInfoForUnlowered (Type);
126
119
DebugTypeInfo DbgTy = getFromTypeInfo (Type, TI, IGM);
127
- assert (FragmentStorageType && " FragmentStorageType is a nullptr" );
128
120
assert (!DbgTy.isContextArchetype () &&
129
121
" type of global variable cannot be an archetype" );
130
122
return DbgTy;
131
123
}
132
124
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) {
137
128
// Prefer the original, potentially sugared version of the type if
138
129
// the type hasn't been mucked with by an optimization pass.
139
130
auto LowTy = GV->getLoweredType ().getASTType ();
@@ -143,23 +134,18 @@ DebugTypeInfo::getGlobalFixedBuffer(SILGlobalVariable *GV,
143
134
if (DeclType->isEqual (LowTy))
144
135
Type = DeclType.getPointer ();
145
136
}
146
- DebugTypeInfo DbgTy (Type, FragmentStorageType,
147
- Align, ::hasDefaultAlignment (Type),
137
+ DebugTypeInfo DbgTy (Type, Align, ::hasDefaultAlignment (Type),
148
138
/* IsMetadataType = */ false , /* IsFixedBuffer = */ true );
149
- assert (FragmentStorageType && " FragmentStorageType is a nullptr" );
150
139
assert (!DbgTy.isContextArchetype () &&
151
140
" type of global variable cannot be an archetype" );
152
141
return DbgTy;
153
142
}
154
143
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,
160
147
/* HasDefaultAlignment = */ true ,
161
148
/* IsMetadataType = */ false );
162
- assert (FragmentStorageType && " FragmentStorageType is a nullptr" );
163
149
assert (!DbgTy.isContextArchetype () &&
164
150
" type of objc class cannot be an archetype" );
165
151
return DbgTy;
@@ -194,7 +180,7 @@ TypeDecl *DebugTypeInfo::getDecl() const {
194
180
}
195
181
196
182
bool DebugTypeInfo::isForwardDecl () const {
197
- return isNull () || (!FragmentStorageType && ! isa<TypeAliasType>(getType ()));
183
+ return isNull () || (!isa<TypeAliasType>(getType ()));
198
184
}
199
185
200
186
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -204,17 +190,14 @@ LLVM_DUMP_METHOD void DebugTypeInfo::dump() const {
204
190
if (auto *Type = getType ())
205
191
Type->dump (llvm::errs ());
206
192
207
- if (FragmentStorageType) {
208
- llvm::errs () << " FragmentStorageType=" ;
209
- FragmentStorageType->dump ();
210
- }
211
193
if (isForwardDecl ())
212
194
llvm::errs () << " forward-declared\n " ;
213
195
}
214
196
#endif
215
197
216
198
std::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) {
218
201
auto *StorageType = IGM.getStorageTypeForUnlowered (Ty);
219
202
std::optional<uint64_t > SizeInBits;
220
203
if (StorageType->isSized ())
0 commit comments