@@ -766,7 +766,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
766
766
}
767
767
768
768
StringRef getMangledName (DebugTypeInfo DbgTy) {
769
- if (DbgTy.IsMetadataType )
769
+ if (DbgTy.isMetadataType () )
770
770
return MetadataTypeDeclCache.find (DbgTy.getDecl ()->getName ().str ())
771
771
->getKey ();
772
772
@@ -830,12 +830,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
830
830
llvm::DINode::DIFlags Flags) {
831
831
unsigned SizeOfByte = CI.getTargetInfo ().getCharWidth ();
832
832
auto *Ty = getOrCreateType (DbgTy);
833
- auto *DITy = DBuilder.createMemberType (Scope, Name, File, 0 ,
834
- SizeOfByte * DbgTy.size .getValue (),
835
- 0 , OffsetInBits, Flags, Ty);
833
+ auto *DITy = DBuilder.createMemberType (
834
+ Scope, Name, File, 0 , SizeOfByte * DbgTy.getSize () .getValue (), 0 ,
835
+ OffsetInBits, Flags, Ty);
836
836
OffsetInBits += getSizeInBits (Ty);
837
- OffsetInBits =
838
- llvm::alignTo (OffsetInBits, SizeOfByte * DbgTy.align .getValue ());
837
+ OffsetInBits = llvm::alignTo (OffsetInBits,
838
+ SizeOfByte * DbgTy.getAlignment () .getValue ());
839
839
return DITy;
840
840
}
841
841
@@ -930,8 +930,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
930
930
// one of the raw type as long as it is large enough to hold
931
931
// all enum values. Use the raw type for the debug type, but
932
932
// the storage size from the enum.
933
- ElemDbgTy = DebugTypeInfo (ED->getRawType (), DbgTy.StorageType ,
934
- DbgTy.size , DbgTy.align , true , false );
933
+ ElemDbgTy =
934
+ DebugTypeInfo (ED->getRawType (), DbgTy.getStorageType (),
935
+ DbgTy.getSize (), DbgTy.getAlignment (), true , false );
935
936
else if (auto ArgTy = ElemDecl->getArgumentInterfaceType ()) {
936
937
// A discriminated union. This should really be described as a
937
938
// DW_TAG_variant_type. For now only describing the data.
@@ -942,12 +943,13 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
942
943
// Discriminated union case without argument. Fallback to Int
943
944
// as the element type; there is no storage here.
944
945
Type IntTy = IGM.Context .getIntDecl ()->getDeclaredType ();
945
- ElemDbgTy = DebugTypeInfo (IntTy, DbgTy.StorageType , Size (0 ),
946
+ ElemDbgTy = DebugTypeInfo (IntTy, DbgTy.getStorageType () , Size (0 ),
946
947
Alignment (1 ), true , false );
947
948
}
948
949
unsigned Offset = 0 ;
949
- auto MTy = createMemberType (ElemDbgTy, ElemDecl->getBaseIdentifier ().str (),
950
- Offset, Scope, File, Flags);
950
+ auto MTy =
951
+ createMemberType (ElemDbgTy, ElemDecl->getBaseIdentifier ().str (),
952
+ Offset, Scope, File, Flags);
951
953
Elements.push_back (MTy);
952
954
}
953
955
return DBuilder.getOrCreateArray (Elements);
@@ -959,7 +961,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
959
961
llvm::DIFile *File, unsigned Line,
960
962
llvm::DINode::DIFlags Flags) {
961
963
unsigned SizeOfByte = CI.getTargetInfo ().getCharWidth ();
962
- unsigned SizeInBits = DbgTy.size .getValue () * SizeOfByte;
964
+ unsigned SizeInBits = DbgTy.getSize () .getValue () * SizeOfByte;
963
965
// Default, since Swift doesn't allow specifying a custom alignment.
964
966
unsigned AlignInBits = 0 ;
965
967
@@ -983,16 +985,17 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
983
985
}
984
986
985
987
llvm::DIType *getOrCreateDesugaredType (Type Ty, DebugTypeInfo DbgTy) {
986
- DebugTypeInfo BlandDbgTy (Ty, DbgTy.StorageType , DbgTy.size , DbgTy.align ,
987
- DbgTy.DefaultAlignment , DbgTy.IsMetadataType );
988
+ DebugTypeInfo BlandDbgTy (Ty, DbgTy.getStorageType (), DbgTy.getSize (),
989
+ DbgTy.getAlignment (), DbgTy.hasDefaultAlignment (),
990
+ DbgTy.isMetadataType ());
988
991
return getOrCreateType (BlandDbgTy);
989
992
}
990
993
991
994
uint64_t getSizeOfBasicType (DebugTypeInfo DbgTy) {
992
995
uint64_t SizeOfByte = CI.getTargetInfo ().getCharWidth ();
993
- uint64_t BitWidth = DbgTy.size .getValue () * SizeOfByte;
994
- llvm::Type *StorageType = DbgTy.StorageType
995
- ? DbgTy.StorageType
996
+ uint64_t BitWidth = DbgTy.getSize () .getValue () * SizeOfByte;
997
+ llvm::Type *StorageType = DbgTy.getStorageType ()
998
+ ? DbgTy.getStorageType ()
996
999
: IGM.DataLayout .getSmallestLegalIntType (
997
1000
IGM.getLLVMContext (), BitWidth);
998
1001
@@ -1210,9 +1213,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1210
1213
// emitting the storage size of the struct, but it may be necessary
1211
1214
// to emit the (target!) size of the underlying basic type.
1212
1215
uint64_t SizeOfByte = CI.getTargetInfo ().getCharWidth ();
1213
- uint64_t SizeInBits = DbgTy.size .getValue () * SizeOfByte;
1214
- unsigned AlignInBits =
1215
- DbgTy.DefaultAlignment ? 0 : DbgTy.align .getValue () * SizeOfByte;
1216
+ uint64_t SizeInBits = DbgTy.getSize ().getValue () * SizeOfByte;
1217
+ unsigned AlignInBits = DbgTy.hasDefaultAlignment ()
1218
+ ? 0
1219
+ : DbgTy.getAlignment ().getValue () * SizeOfByte;
1216
1220
unsigned Encoding = 0 ;
1217
1221
llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
1218
1222
@@ -1502,9 +1506,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1502
1506
auto File = getOrCreateFile (L.Filename );
1503
1507
// For TypeAlias types, the DeclContext for the aliased type is
1504
1508
// in the decl of the alias type.
1505
- DebugTypeInfo AliasedDbgTy (AliasedTy, DbgTy.StorageType , DbgTy. size ,
1506
- DbgTy.align , DbgTy.DefaultAlignment ,
1507
- false );
1509
+ DebugTypeInfo AliasedDbgTy (AliasedTy, DbgTy.getStorageType () ,
1510
+ DbgTy.getSize () , DbgTy.getAlignment () ,
1511
+ DbgTy. hasDefaultAlignment (), false );
1508
1512
return DBuilder.createTypedef (getOrCreateType (AliasedDbgTy), MangledName,
1509
1513
File, L.Line , Scope);
1510
1514
}
@@ -2216,11 +2220,11 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
2216
2220
return ;
2217
2221
2218
2222
// We cannot yet represent opened existentials.
2219
- if (DbgTy.Type ->hasOpenedExistential ())
2223
+ if (DbgTy.getType () ->hasOpenedExistential ())
2220
2224
return ;
2221
2225
2222
- if (!DbgTy.size )
2223
- DbgTy.size = getStorageSize (IGM.DataLayout , Storage);
2226
+ if (!DbgTy.getSize () )
2227
+ DbgTy.setSize ( getStorageSize (IGM.DataLayout , Storage) );
2224
2228
2225
2229
auto *Scope = dyn_cast_or_null<llvm::DILocalScope>(getOrCreateScope (DS));
2226
2230
assert (Scope && " variable has no local scope" );
0 commit comments