[PATCH] D140809: [clang][Interp] Implement logical and/or operators

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 00:45:37 PST 2023


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:376
+    this->emitLabel(LabelTrue);
+    this->emitConstBool(true, E);
+    this->fallthrough(LabelEnd);
----------------
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. 


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