We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c990d94 commit 293ae0bCopy full SHA for 293ae0b
clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -634,8 +634,14 @@ bool ByteCodeExprGen<Emitter>::VisitSubstNonTypeTemplateParmExpr(
634
635
template <class Emitter>
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.
+ // Try to emit the APValue directly, without visiting the subexpr.
+ // 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
+
645
return this->delegate(E->getSubExpr());
646
}
647
0 commit comments