Skip to content

Commit 1f5b8ae

Browse files
committed
SIL Parser: Preserve [reflection] bit on alloc_box
1 parent 01c295d commit 1f5b8ae

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
27952795
if (parseSILDebugLocation(InstLoc, B))
27962796
return true;
27972797
ResultVal = B.createAllocBox(InstLoc, Ty.castTo<SILBoxType>(), VarInfo,
2798-
hasDynamicLifetime);
2798+
hasDynamicLifetime, hasReflection);
27992799
break;
28002800
}
28012801
case SILInstructionKind::ApplyInst:

test/SIL/Parser/boxes.sil

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,21 @@ sil [ossa] @address_of_box : $@convention(thin) (@in { var Int }, @in <T> { let
8989
entry(%0 : $*{ var Int }, %1 : $*<T> { let T } <Int>):
9090
unreachable
9191
}
92+
93+
// CHECK-LABEL: sil [ossa] @alloc_box_attrs
94+
sil [ossa] @alloc_box_attrs : $@convention(thin) () -> () {
95+
entry:
96+
// CHECK: %0 = alloc_box $
97+
%0 = alloc_box ${ let Int }
98+
// CHECK: %1 = alloc_box [dynamic_lifetime] $
99+
%1 = alloc_box [dynamic_lifetime] ${ let Int }
100+
// CHECK: %2 = alloc_box [reflection] $
101+
%2 = alloc_box [reflection] ${ let Int }
102+
// CHECK: %3 = alloc_box [dynamic_lifetime] [reflection] $
103+
%3 = alloc_box [dynamic_lifetime] [reflection] ${ let Int }
104+
dealloc_box %3: ${ let Int }
105+
dealloc_box %2: ${ let Int }
106+
dealloc_box %1: ${ let Int }
107+
dealloc_box %0: ${ let Int }
108+
return undef : $()
109+
}

0 commit comments

Comments
 (0)