Skip to content

Commit 2a32222

Browse files
authored
Fix ICE (#283)
Signed-off-by: acassagnes <acassagnes@bloomberg.net>
1 parent 9ffb96e commit 2a32222

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

clang/lib/Sema/SemaReflect.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,14 @@ class MetaActionsImpl : public MetaActions {
532532

533533
// Attach annotations as CXX26AnnotationAttr directly on the decl.
534534
for (APValue *annotVal : enumSpec->annotations) {
535+
APValue LoweredVal = annotVal->isReflectedValue()
536+
? annotVal->getReflectedValue()
537+
: annotVal->getReflectedObject();
535538
Expr *OVE = new (S.Context) OpaqueValueExpr(
536539
DefinitionLoc,
537540
annotVal->getTypeOfReflectedResult(S.Context),
538541
VK_PRValue);
539-
Expr *CE = ConstantExpr::Create(S.Context, OVE,
540-
annotVal->getReflectedValue());
542+
Expr *CE = ConstantExpr::Create(S.Context, OVE, LoweredVal);
541543

542544
AttributeFactory AttrFactory;
543545
ParsedAttributes ParsedAttrs(AttrFactory);
@@ -548,7 +550,7 @@ class MetaActionsImpl : public MetaActions {
548550
ParsedAttr::Form::Annotation(), DefinitionLoc);
549551

550552
auto *Annot = CXX26AnnotationAttr::Create(S.Context, CE, *ACI);
551-
Annot->setValue(annotVal->getReflectedValue());
553+
Annot->setValue(LoweredVal);
552554
Annot->setEqLoc(DefinitionLoc);
553555
EnumConstDecl->addAttr(Annot);
554556
}

0 commit comments

Comments
 (0)