@@ -149,8 +149,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
149
149
void emitImport (ImportDecl *D);
150
150
llvm::DISubprogram *emitFunction (const SILDebugScope *DS, llvm::Function *Fn,
151
151
SILFunctionTypeRepresentation Rep,
152
- SILType Ty, DeclContext *DeclCtx = nullptr ,
153
- GenericEnvironment *GE = nullptr );
152
+ SILType Ty, DeclContext *DeclCtx = nullptr );
154
153
llvm::DISubprogram *emitFunction (SILFunction &SILFn, llvm::Function *Fn);
155
154
void emitArtificialFunction (IRBuilder &Builder, llvm::Function *Fn,
156
155
SILType SILTy);
@@ -525,11 +524,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
525
524
}
526
525
527
526
void createParameterType (llvm::SmallVectorImpl<llvm::Metadata *> &Parameters,
528
- SILType type, DeclContext *DeclCtx,
529
- GenericEnvironment *GE) {
527
+ SILType type) {
530
528
auto RealType = type.getASTType ();
531
- auto DbgTy = DebugTypeInfo::getFromTypeInfo (DeclCtx, GE, RealType,
532
- IGM.getTypeInfo (type));
529
+ auto DbgTy = DebugTypeInfo::getFromTypeInfo (RealType, IGM.getTypeInfo (type));
533
530
Parameters.push_back (getOrCreateType (DbgTy));
534
531
}
535
532
@@ -550,30 +547,25 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
550
547
}
551
548
}
552
549
553
- llvm::DITypeRefArray createParameterTypes (SILType SILTy, DeclContext *DeclCtx,
554
- GenericEnvironment *GE) {
550
+ llvm::DITypeRefArray createParameterTypes (SILType SILTy) {
555
551
if (!SILTy)
556
552
return nullptr ;
557
- return createParameterTypes (SILTy.castTo <SILFunctionType>(), DeclCtx, GE );
553
+ return createParameterTypes (SILTy.castTo <SILFunctionType>());
558
554
}
559
555
560
- llvm::DITypeRefArray createParameterTypes (CanSILFunctionType FnTy,
561
- DeclContext *DeclCtx,
562
- GenericEnvironment *GE) {
556
+ llvm::DITypeRefArray createParameterTypes (CanSILFunctionType FnTy) {
563
557
SmallVector<llvm::Metadata *, 16 > Parameters;
564
558
565
559
GenericContextScope scope (IGM, FnTy->getGenericSignature ());
566
560
567
561
// The function return type is the first element in the list.
568
- createParameterType (Parameters, getResultTypeForDebugInfo (FnTy), DeclCtx,
569
- GE);
562
+ createParameterType (Parameters, getResultTypeForDebugInfo (FnTy));
570
563
571
564
// Actually, the input type is either a single type or a tuple
572
565
// type. We currently represent a function with one n-tuple argument
573
566
// as an n-ary function.
574
567
for (auto Param : FnTy->getParameters ())
575
- createParameterType (Parameters, IGM.silConv .getSILType (Param), DeclCtx,
576
- GE);
568
+ createParameterType (Parameters, IGM.silConv .getSILType (Param));
577
569
578
570
return DBuilder.getOrCreateTypeArray (Parameters);
579
571
}
@@ -760,7 +752,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
760
752
761
753
Mangle::ASTMangler Mangler;
762
754
std::string Result = Mangler.mangleTypeForDebugger (
763
- Ty, DbgTy. getDeclContext () );
755
+ Ty, nullptr );
764
756
765
757
if (!Opts.DisableRoundTripDebugTypes ) {
766
758
// Make sure we can reconstruct mangled types for the debugger.
@@ -806,16 +798,15 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
806
798
807
799
llvm::DINodeArray
808
800
getTupleElements (TupleType *TupleTy, llvm::DIScope *Scope, llvm::DIFile *File,
809
- llvm::DINode::DIFlags Flags, DeclContext *DeclContext,
810
- GenericEnvironment *GE, unsigned &SizeInBits) {
801
+ llvm::DINode::DIFlags Flags, unsigned &SizeInBits) {
811
802
SmallVector<llvm::Metadata *, 16 > Elements;
812
803
unsigned OffsetInBits = 0 ;
813
804
auto genericSig = IGM.getSILTypes ().getCurGenericContext ();
814
805
for (auto ElemTy : TupleTy->getElementTypes ()) {
815
806
auto &elemTI = IGM.getTypeInfoForUnlowered (
816
807
AbstractionPattern (genericSig, ElemTy->getCanonicalType ()), ElemTy);
817
808
auto DbgTy =
818
- DebugTypeInfo::getFromTypeInfo (DeclContext, GE, ElemTy, elemTI);
809
+ DebugTypeInfo::getFromTypeInfo (ElemTy, elemTI);
819
810
Elements.push_back (createMemberType (DbgTy, StringRef (), OffsetInBits,
820
811
Scope, File, Flags));
821
812
}
@@ -834,8 +825,6 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
834
825
BaseTy->getTypeOfMember (IGM.getSwiftModule (), VD, nullptr );
835
826
836
827
auto DbgTy = DebugTypeInfo::getFromTypeInfo (
837
- VD->getDeclContext (),
838
- VD->getDeclContext ()->getGenericEnvironmentOfContext (),
839
828
VD->getInterfaceType (),
840
829
IGM.getTypeInfoForUnlowered (
841
830
IGM.getSILTypes ().getAbstractionPattern (VD), memberTy));
@@ -899,25 +888,20 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
899
888
// all enum values. Use the raw type for the debug type, but
900
889
// the storage size from the enum.
901
890
ElemDbgTy =
902
- DebugTypeInfo (ED, DbgTy. getGenericEnvironment (), ED ->getRawType (),
891
+ DebugTypeInfo (ED->getRawType (),
903
892
DbgTy.StorageType , DbgTy.size , DbgTy.align , true );
904
893
else if (auto ArgTy = ElemDecl->getArgumentInterfaceType ()) {
905
894
// A discriminated union. This should really be described as a
906
895
// DW_TAG_variant_type. For now only describing the data.
907
896
ArgTy = ElemDecl->getParentEnum ()->mapTypeIntoContext (ArgTy);
908
897
auto &TI = IGM.getTypeInfoForUnlowered (ArgTy);
909
- ElemDbgTy = DebugTypeInfo::getFromTypeInfo (
910
- ElemDecl->getDeclContext (),
911
- ElemDecl->getDeclContext ()->getGenericEnvironmentOfContext (), ArgTy,
912
- TI);
898
+ ElemDbgTy = DebugTypeInfo::getFromTypeInfo (ArgTy, TI);
913
899
} else {
914
900
// Discriminated union case without argument. Fallback to Int
915
901
// as the element type; there is no storage here.
916
902
Type IntTy = IGM.Context .getIntDecl ()->getDeclaredType ();
917
903
ElemDbgTy = DebugTypeInfo (
918
- ElemDecl->getDeclContext (),
919
- ElemDecl->getDeclContext ()->getGenericEnvironmentOfContext (), IntTy,
920
- DbgTy.StorageType , Size (0 ), Alignment (1 ), true );
904
+ IntTy, DbgTy.StorageType , Size (0 ), Alignment (1 ), true );
921
905
}
922
906
unsigned Offset = 0 ;
923
907
auto MTy = createMemberType (ElemDbgTy, ElemDecl->getName ().str (), Offset,
@@ -958,8 +942,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
958
942
959
943
llvm::DIType *getOrCreateDesugaredType (Type Ty, DebugTypeInfo DbgTy) {
960
944
DebugTypeInfo BlandDbgTy (
961
- DbgTy.getDeclContext (), DbgTy.getGenericEnvironment (), Ty,
962
- DbgTy.StorageType , DbgTy.size , DbgTy.align , DbgTy.DefaultAlignment );
945
+ Ty, DbgTy.StorageType , DbgTy.size , DbgTy.align , DbgTy.DefaultAlignment );
963
946
return getOrCreateType (BlandDbgTy);
964
947
}
965
948
@@ -1057,8 +1040,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1057
1040
FunTy = IGM.getLoweredType (nongenericTy).castTo <SILFunctionType>();
1058
1041
} else
1059
1042
FunTy = IGM.getLoweredType (BaseTy).castTo <SILFunctionType>();
1060
- auto Params = createParameterTypes (FunTy, DbgTy.getDeclContext (),
1061
- DbgTy.getGenericEnvironment ());
1043
+ auto Params = createParameterTypes (FunTy);
1062
1044
1063
1045
auto FnTy = DBuilder.createSubroutineType (Params, Flags);
1064
1046
llvm::DIType *DITy;
@@ -1094,9 +1076,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1094
1076
DITypeCache[DbgTy.getType ()] = llvm::TrackingMDNodeRef (FwdDecl.get ());
1095
1077
1096
1078
unsigned RealSize;
1097
- auto Elements = getTupleElements (TupleTy, Scope, MainFile, Flags,
1098
- DbgTy.getDeclContext (),
1099
- DbgTy.getGenericEnvironment (), RealSize);
1079
+ auto Elements = getTupleElements (TupleTy, Scope, MainFile, Flags, RealSize);
1100
1080
// FIXME: Handle %swift.opaque members and make this into an assertion.
1101
1081
if (!RealSize)
1102
1082
RealSize = SizeInBits;
@@ -1337,7 +1317,6 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1337
1317
auto PTy = IGM.getLoweredType (ProtocolDecl->getInterfaceType ())
1338
1318
.getASTType ();
1339
1319
auto PDbgTy = DebugTypeInfo::getFromTypeInfo (
1340
- DbgTy.getDeclContext (), DbgTy.getGenericEnvironment (),
1341
1320
ProtocolDecl->getInterfaceType (), IGM.getTypeInfoForLowered (PTy));
1342
1321
auto PDITy = getOrCreateType (PDbgTy);
1343
1322
Protocols.push_back (
@@ -1406,8 +1385,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1406
1385
auto *BuiltinVectorTy = BaseTy->castTo <BuiltinVectorType>();
1407
1386
auto ElemTy = BuiltinVectorTy->getElementType ();
1408
1387
auto ElemDbgTy = DebugTypeInfo::getFromTypeInfo (
1409
- DbgTy.getDeclContext (), DbgTy.getGenericEnvironment (), ElemTy,
1410
- IGM.getTypeInfoForUnlowered (ElemTy));
1388
+ ElemTy, IGM.getTypeInfoForUnlowered (ElemTy));
1411
1389
unsigned Count = BuiltinVectorTy->getNumElements ();
1412
1390
auto Subscript = DBuilder.getOrCreateSubrange (0 , Count ? Count : -1 );
1413
1391
return DBuilder.createVectorType (SizeInBits,
@@ -1439,7 +1417,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1439
1417
// For TypeAlias types, the DeclContext for the aliased type is
1440
1418
// in the decl of the alias type.
1441
1419
DebugTypeInfo AliasedDbgTy (
1442
- DbgTy. getDeclContext (), DbgTy. getGenericEnvironment (), AliasedTy,
1420
+ AliasedTy,
1443
1421
DbgTy.StorageType , DbgTy.size , DbgTy.align , DbgTy.DefaultAlignment );
1444
1422
return DBuilder.createTypedef (getOrCreateType (AliasedDbgTy), MangledName,
1445
1423
File, L.Line , Scope);
@@ -1915,15 +1893,13 @@ llvm::DISubprogram *IRGenDebugInfoImpl::emitFunction(SILFunction &SILFn,
1915
1893
assert (DS && " SIL function has no debug scope" );
1916
1894
(void )DS;
1917
1895
return emitFunction (SILFn.getDebugScope (), Fn, SILFn.getRepresentation (),
1918
- SILFn.getLoweredType (), SILFn.getDeclContext (),
1919
- SILFn.getGenericEnvironment ());
1896
+ SILFn.getLoweredType (), SILFn.getDeclContext ());
1920
1897
}
1921
1898
1922
1899
llvm::DISubprogram *
1923
1900
IRGenDebugInfoImpl::emitFunction (const SILDebugScope *DS, llvm::Function *Fn,
1924
1901
SILFunctionTypeRepresentation Rep,
1925
- SILType SILTy, DeclContext *DeclCtx,
1926
- GenericEnvironment *GE) {
1902
+ SILType SILTy, DeclContext *DeclCtx) {
1927
1903
auto Cached = ScopeCache.find (DS);
1928
1904
if (Cached != ScopeCache.end ()) {
1929
1905
auto SP = cast<llvm::DISubprogram>(Cached->second );
@@ -1986,7 +1962,7 @@ IRGenDebugInfoImpl::emitFunction(const SILDebugScope *DS, llvm::Function *Fn,
1986
1962
1987
1963
CanSILFunctionType FnTy = getFunctionType (SILTy);
1988
1964
auto Params = Opts.DebugInfoLevel > IRGenDebugInfoLevel::LineTables
1989
- ? createParameterTypes (SILTy, DeclCtx, GE )
1965
+ ? createParameterTypes (SILTy)
1990
1966
: nullptr ;
1991
1967
llvm::DISubroutineType *DIFnTy = DBuilder.createSubroutineType (Params);
1992
1968
llvm::DITemplateParameterArray TemplateParameters = nullptr ;
@@ -2020,7 +1996,7 @@ IRGenDebugInfoImpl::emitFunction(const SILDebugScope *DS, llvm::Function *Fn,
2020
1996
if (FnTy)
2021
1997
if (auto ErrorInfo = FnTy->getOptionalErrorResult ()) {
2022
1998
auto DTI = DebugTypeInfo::getFromTypeInfo (
2023
- nullptr , nullptr , ErrorInfo->getType (),
1999
+ ErrorInfo->getType (),
2024
2000
IGM.getTypeInfo (IGM.silConv .getSILType (*ErrorInfo)));
2025
2001
Error = DBuilder.getOrCreateArray ({getOrCreateType (DTI)}).get ();
2026
2002
}
0 commit comments