tbaeder added inline comments.

================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1237-1240
+    if (DiscardResult)
+      return this->emitIncPop(*T, E);
+
+    return this->emitInc(*T, E);
----------------
aaron.ballman wrote:
> Style question: should we prefer doing something like: `return DiscardResult 
> ? this->emitIncPop(*T, E) : this->emitInc(*T, E);` to discourage accidentally 
> adding code between the two increment operations? (And applying this style 
> more generally for discarded results?)
> 
> Alternatively, do we want to add a helper function to `ByteCodeExprGen` 
> called `doEmitInc()` that hides the discarded result behavior so the `Visit*` 
> functions don't have to keep doing that dance?
Yeah I think the ternary makes sense here, like it's done in the `Discard()` 
function in `VisitBinaryOperator()`.

For a function, I'll hold off for now, but it might make sense later (there's 
still a TODO comment for array initialization, which compiles to tons of code 
right now and we should use a loop there).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136423/new/

https://reviews.llvm.org/D136423

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to