[clang][bytecode] Only override constant-context state if we have an EvalEmitter (#211475)

This does not make sense when emitting bytecode, as the bytecode would
just contain a `PushCC`/`PopCC` pair with nothing in between.
This commit is contained in:
Timm Baeder 2026-07-26 08:14:28 +02:00 committed by GitHub
parent 6cdc7bd8c9
commit 3fd07e3235
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8276,12 +8276,16 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
bool IsConstexprUnknown = true) -> bool {
llvm::SaveAndRestore CURS(this->VariablesAreConstexprUnknown,
IsConstexprUnknown);
if (!this->emitPushCC(VD->hasConstantInitialization(), E))
return false;
if constexpr (std::is_same_v<Emitter, EvalEmitter>) {
if (!this->emitPushCC(VD->hasConstantInitialization(), E))
return false;
}
auto VarState = this->visitDecl(VD);
if (!this->emitPopCC(E))
return false;
if constexpr (std::is_same_v<Emitter, EvalEmitter>) {
if (!this->emitPopCC(E))
return false;
}
if (VarState.notCreated())
return true;