Skip to content

Commit 7c5c548

Browse files
committed
[silgen] Fix PartialDestroyPackCleanup dumping output to handle LimitWithinComponent to be nullptr.
1 parent 543063e commit 7c5c548

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/SILGen/SILGenPack.cpp

+13-8
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ class DestroyPackCleanup : public Cleanup {
7272
class PartialDestroyPackCleanup : public Cleanup {
7373
SILValue Addr;
7474
unsigned PackComponentIndex;
75+
76+
/// NOTE: It is expected that LimitWithinComponent maybe an empty SILValue.
7577
SILValue LimitWithinComponent;
7678
CanPackType FormalPackType;
7779
public:
78-
PartialDestroyPackCleanup(SILValue addr,
79-
CanPackType formalPackType,
80+
PartialDestroyPackCleanup(SILValue addr, CanPackType formalPackType,
8081
unsigned packComponentIndex,
8182
SILValue limitWithinComponent)
82-
: Addr(addr), PackComponentIndex(packComponentIndex),
83-
LimitWithinComponent(limitWithinComponent),
84-
FormalPackType(formalPackType) {}
83+
: Addr(addr), PackComponentIndex(packComponentIndex),
84+
LimitWithinComponent(limitWithinComponent),
85+
FormalPackType(formalPackType) {}
8586

8687
void emit(SILGenFunction &SGF, CleanupLocation l,
8788
ForUnwind_t forUnwind) override {
@@ -93,10 +94,14 @@ class PartialDestroyPackCleanup : public Cleanup {
9394
#ifndef NDEBUG
9495
llvm::errs() << "PartialDestroyPackCleanup\n"
9596
<< "State:" << getState() << "\n"
96-
<< "Addr:" << Addr << "\n"
97-
<< "FormalPackType:" << FormalPackType << "\n"
97+
<< "Addr:" << Addr << "FormalPackType:" << FormalPackType
98+
<< "\n"
9899
<< "ComponentIndex:" << PackComponentIndex << "\n"
99-
<< "LimitWithinComponent:" << LimitWithinComponent << "\n";
100+
<< "LimitWithinComponent: ";
101+
if (LimitWithinComponent)
102+
llvm::errs() << LimitWithinComponent;
103+
else
104+
llvm::errs() << "None\n";
100105
#endif
101106
}
102107
};

0 commit comments

Comments
 (0)