[PATCH] D140809: [clang][Interp] Implement logical and/or operators
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 06:27:23 PST 2023
aaron.ballman accepted this revision.
aaron.ballman added inline comments.
================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:376
+ this->emitLabel(LabelTrue);
+ this->emitConstBool(true, E);
+ this->fallthrough(LabelEnd);
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > Am I correct in understanding that the reason we don't need to emit a const bool for `false` is because visiting the RHS already pushes either `true` or `false` onto the stack because it's already been converted to a bool result?
> Both LHS and RHS push a bool result to the stack, but the `jumpTrue`will `pop()` the result of the LHS, so we need to push a true again if we want to use it later as the result of the binary operator.
Thank you for the confirmation, that makes sense to me. LGTM!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140809/new/
https://reviews.llvm.org/D140809
More information about the cfe-commits
mailing list