@@ -1089,6 +1089,20 @@ class IRGenSILFunction :
10891089 copy.push_back (Alloca.getAddress ());
10901090 }
10911091
1092+ void emitPackCountDebugVariable (llvm::Value *Shape) {
1093+ if (!PackShapeExpressions.insert (Shape).second )
1094+ return ;
1095+ llvm::SmallString<8 > Buf;
1096+ unsigned Position = PackShapeExpressions.size () - 1 ;
1097+ llvm::raw_svector_ostream (Buf) << " $pack_count_" << Position;
1098+ auto Name = IGM.Context .getIdentifier (Buf.str ());
1099+ SILDebugVariable Var (Name.str (), true , 0 );
1100+ Shape = emitShadowCopyIfNeeded (Shape, getDebugScope (), Var, false ,
1101+ false /* was move*/ );
1102+ if (IGM.DebugInfo )
1103+ IGM.DebugInfo ->emitPackCountParameter (*this , Shape, Var);
1104+ }
1105+
10921106 // / Force all archetypes referenced by the type to be bound by this point.
10931107 // / TODO: just make sure that we have a path to them that the debug info
10941108 // / can follow.
@@ -1102,17 +1116,10 @@ class IRGenSILFunction :
11021116 emitTypeMetadataRef (packArchetype);
11031117 else if (auto packtype = dyn_cast<SILPackType>(t)) {
11041118 llvm::Value *Shape = emitPackShapeExpression (t);
1105- if (PackShapeExpressions.insert (Shape).second ) {
1106- llvm::SmallString<8 > Buf;
1107- unsigned Position = PackShapeExpressions.size () - 1 ;
1108- llvm::raw_svector_ostream (Buf) << " $pack_count_" << Position;
1109- auto Name = IGM.Context .getIdentifier (Buf.str ());
1110- SILDebugVariable Var (Name.str (), true , 0 );
1111- Shape = emitShadowCopyIfNeeded (Shape, getDebugScope (), Var, false ,
1112- false /* was move*/ );
1113- if (IGM.DebugInfo )
1114- IGM.DebugInfo ->emitPackCountParameter (*this , Shape, Var);
1115- }
1119+ emitPackCountDebugVariable (Shape);
1120+ } else if (auto packtype = dyn_cast<PackType>(t)) {
1121+ llvm::Value *Shape = emitPackShapeExpression (t);
1122+ emitPackCountDebugVariable (Shape);
11161123 }
11171124 });
11181125 }
0 commit comments