@@ -766,7 +766,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
766766 }
767767
768768 StringRef getMangledName (DebugTypeInfo DbgTy) {
769- if (DbgTy.IsMetadataType )
769+ if (DbgTy.isMetadataType () )
770770 return MetadataTypeDeclCache.find (DbgTy.getDecl ()->getName ().str ())
771771 ->getKey ();
772772
@@ -830,12 +830,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
830830 llvm::DINode::DIFlags Flags) {
831831 unsigned SizeOfByte = CI.getTargetInfo ().getCharWidth ();
832832 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);
836836 OffsetInBits += getSizeInBits (Ty);
837- OffsetInBits =
838- llvm::alignTo (OffsetInBits, SizeOfByte * DbgTy.align .getValue ());
837+ OffsetInBits = llvm::alignTo (OffsetInBits,
838+ SizeOfByte * DbgTy.getAlignment () .getValue ());
839839 return DITy;
840840 }
841841
@@ -930,8 +930,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
930930 // one of the raw type as long as it is large enough to hold
931931 // all enum values. Use the raw type for the debug type, but
932932 // 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 );
935936 else if (auto ArgTy = ElemDecl->getArgumentInterfaceType ()) {
936937 // A discriminated union. This should really be described as a
937938 // DW_TAG_variant_type. For now only describing the data.
@@ -942,12 +943,13 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
942943 // Discriminated union case without argument. Fallback to Int
943944 // as the element type; there is no storage here.
944945 Type IntTy = IGM.Context .getIntDecl ()->getDeclaredType ();
945- ElemDbgTy = DebugTypeInfo (IntTy, DbgTy.StorageType , Size (0 ),
946+ ElemDbgTy = DebugTypeInfo (IntTy, DbgTy.getStorageType () , Size (0 ),
946947 Alignment (1 ), true , false );
947948 }
948949 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);
951953 Elements.push_back (MTy);
952954 }
953955 return DBuilder.getOrCreateArray (Elements);
@@ -959,7 +961,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
959961 llvm::DIFile *File, unsigned Line,
960962 llvm::DINode::DIFlags Flags) {
961963 unsigned SizeOfByte = CI.getTargetInfo ().getCharWidth ();
962- unsigned SizeInBits = DbgTy.size .getValue () * SizeOfByte;
964+ unsigned SizeInBits = DbgTy.getSize () .getValue () * SizeOfByte;
963965 // Default, since Swift doesn't allow specifying a custom alignment.
964966 unsigned AlignInBits = 0 ;
965967
@@ -983,16 +985,17 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
983985 }
984986
985987 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 ());
988991 return getOrCreateType (BlandDbgTy);
989992 }
990993
991994 uint64_t getSizeOfBasicType (DebugTypeInfo DbgTy) {
992995 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 ()
996999 : IGM.DataLayout .getSmallestLegalIntType (
9971000 IGM.getLLVMContext (), BitWidth);
9981001
@@ -1210,9 +1213,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
12101213 // emitting the storage size of the struct, but it may be necessary
12111214 // to emit the (target!) size of the underlying basic type.
12121215 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;
12161220 unsigned Encoding = 0 ;
12171221 llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
12181222
@@ -1502,9 +1506,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
15021506 auto File = getOrCreateFile (L.Filename );
15031507 // For TypeAlias types, the DeclContext for the aliased type is
15041508 // 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 );
15081512 return DBuilder.createTypedef (getOrCreateType (AliasedDbgTy), MangledName,
15091513 File, L.Line , Scope);
15101514 }
@@ -2216,11 +2220,11 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
22162220 return ;
22172221
22182222 // We cannot yet represent opened existentials.
2219- if (DbgTy.Type ->hasOpenedExistential ())
2223+ if (DbgTy.getType () ->hasOpenedExistential ())
22202224 return ;
22212225
2222- if (!DbgTy.size )
2223- DbgTy.size = getStorageSize (IGM.DataLayout , Storage);
2226+ if (!DbgTy.getSize () )
2227+ DbgTy.setSize ( getStorageSize (IGM.DataLayout , Storage) );
22242228
22252229 auto *Scope = dyn_cast_or_null<llvm::DILocalScope>(getOrCreateScope (DS));
22262230 assert (Scope && " variable has no local scope" );
0 commit comments