File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -634,8 +634,14 @@ bool ByteCodeExprGen<Emitter>::VisitSubstNonTypeTemplateParmExpr(
634
634
635
635
template <class Emitter >
636
636
bool ByteCodeExprGen<Emitter>::VisitConstantExpr(const ConstantExpr *E) {
637
- // TODO: Check if the ConstantExpr already has a value set and if so,
638
- // use that instead of evaluating it again.
637
+ // Try to emit the APValue directly, without visiting the subexpr.
638
+ // This will only fail if we can't emit the APValue, so won't emit any
639
+ // diagnostics or any double values.
640
+ std::optional<PrimType> T = classify (E->getType ());
641
+ if (T && E->hasAPValueResult () &&
642
+ this ->visitAPValue (E->getAPValueResult (), *T, E))
643
+ return true ;
644
+
639
645
return this ->delegate (E->getSubExpr ());
640
646
}
641
647
You can’t perform that action at this time.
0 commit comments