@@ -1089,6 +1089,20 @@ class IRGenSILFunction :
1089
1089
copy.push_back (Alloca.getAddress ());
1090
1090
}
1091
1091
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
+
1092
1106
// / Force all archetypes referenced by the type to be bound by this point.
1093
1107
// / TODO: just make sure that we have a path to them that the debug info
1094
1108
// / can follow.
@@ -1102,17 +1116,10 @@ class IRGenSILFunction :
1102
1116
emitTypeMetadataRef (packArchetype);
1103
1117
else if (auto packtype = dyn_cast<SILPackType>(t)) {
1104
1118
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);
1116
1123
}
1117
1124
});
1118
1125
}
0 commit comments