Skip to content

Commit 13e8ea5

Browse files
committed
SIL Parser: handle now-multiple attributes on AllocBoxInst
1 parent 5d7861f commit 13e8ea5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,10 +2773,18 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
27732773
case SILInstructionKind::AllocBoxInst: {
27742774
bool hasDynamicLifetime = false;
27752775
bool hasReflection = false;
2776-
if (parseSILOptional(hasDynamicLifetime, *this, "dynamic_lifetime"))
2777-
return true;
2778-
if (parseSILOptional(hasReflection, *this, "reflection"))
2779-
return true;
2776+
StringRef attrName;
2777+
SourceLoc attrLoc;
2778+
while (parseSILOptional(attrName, attrLoc, *this)) {
2779+
if (attrName.equals("dynamic_lifetime")) {
2780+
hasDynamicLifetime = true;
2781+
} else if (attrName.equals("reflection")) {
2782+
hasReflection = true;
2783+
} else {
2784+
P.diagnose(attrLoc, diag::sil_invalid_attribute_for_expected, attrName,
2785+
"dynamic_lifetime or reflection");
2786+
}
2787+
}
27802788

27812789
SILType Ty;
27822790
if (parseSILType(Ty))

0 commit comments

Comments
 (0)