Skip to content

Commit e6aa779

Browse files
committed
Let pack_count helper variables be zero-indexed.
1 parent 7324307 commit e6aa779

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3000,7 +3000,8 @@ void IRGenDebugInfoImpl::emitPackCountParameter(IRGenFunction &IGF,
30003000
if (!DS || DS->getInlinedFunction()->isTransparent())
30013001
return;
30023002

3003-
Type IntTy = IGM.Context.getIntType();
3003+
Type IntTy = BuiltinIntegerType::get(CI.getTargetInfo().getPointerWidth(0),
3004+
IGM.getSwiftModule()->getASTContext());
30043005
auto &TI = IGM.getTypeInfoForUnlowered(IntTy);
30053006
auto DbgTy = *CompletedDebugTypeInfo::getFromTypeInfo(IntTy, TI, IGM);
30063007
emitVariableDeclaration(

lib/IRGen/IRGenSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ class IRGenSILFunction :
11051105
if (PackShapeExpressions.insert(Shape).second) {
11061106
llvm::SmallString<8> Buf;
11071107
llvm::raw_svector_ostream OS(Buf);
1108-
unsigned Position = PackShapeExpressions.size();
1108+
unsigned Position = PackShapeExpressions.size() - 1;
11091109
OS << "$pack_count_" << Position;
11101110
SILDebugVariable Var(OS.str(), true, 0);
11111111
Shape = emitShadowCopyIfNeeded(Shape, getDebugScope(), Var, false,

test/DebugInfo/variadic-generics-count.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public func f4<each U, each V>(us: repeat (each U, each V)) {
3636
}
3737

3838
// CHECK-LABEL: !DICompileUnit
39-
// CHECK-DAG: [[COUNT1_1_VAR]] = !DILocalVariable(name: "$pack_count_1",{{.*}} flags: DIFlagArtificial)
40-
// CHECK-DAG: [[COUNT2_1_VAR]] = !DILocalVariable(name: "$pack_count_1",{{.*}} flags: DIFlagArtificial)
41-
// CHECK-DAG: [[COUNT2_2_VAR]] = !DILocalVariable(name: "$pack_count_2",{{.*}} flags: DIFlagArtificial)
42-
// CHECK-DAG: [[COUNT3_1_VAR]] = !DILocalVariable(name: "$pack_count_1",{{.*}} flags: DIFlagArtificial)
43-
// CHECK-DAG: [[COUNT4_1_VAR]] = !DILocalVariable(name: "$pack_count_1",{{.*}} flags: DIFlagArtificial)
39+
// CHECK-DAG: [[COUNT1_1_VAR]] = !DILocalVariable(name: "$pack_count_0",{{.*}} flags: DIFlagArtificial)
40+
// CHECK-DAG: [[COUNT2_1_VAR]] = !DILocalVariable(name: "$pack_count_0",{{.*}} flags: DIFlagArtificial)
41+
// CHECK-DAG: [[COUNT2_2_VAR]] = !DILocalVariable(name: "$pack_count_1",{{.*}} flags: DIFlagArtificial)
42+
// CHECK-DAG: [[COUNT3_1_VAR]] = !DILocalVariable(name: "$pack_count_0",{{.*}} flags: DIFlagArtificial)
43+
// CHECK-DAG: [[COUNT4_1_VAR]] = !DILocalVariable(name: "$pack_count_0",{{.*}} flags: DIFlagArtificial)
4444

0 commit comments

Comments
 (0)