Skip to content

Commit a16d33e

Browse files
committed
[clang][Interp][NFC] Don't invoke block dtor on uninitialized globals
That can't ever work.
1 parent 3388c5a commit a16d33e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/AST/Interp/Program.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class Program final {
4545
// but primitive arrays might have an InitMap* heap allocated and
4646
// that needs to be freed.
4747
for (Global *G : Globals)
48-
G->block()->invokeDtor();
48+
if (Block *B = G->block(); B->isInitialized())
49+
B->invokeDtor();
4950

5051
// Records might actually allocate memory themselves, but they
5152
// are allocated using a BumpPtrAllocator. Call their desctructors

0 commit comments

Comments
 (0)