[PATCH] D136423: [clang][Interp] Implement inc/dec postfix and prefix operators

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 00:30:51 PDT 2022


tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This only works on integrals for now.

Add four new opcodes, `Inc`, `IncPop`, `Dec` and `DecPop`. The `*Pop` variants don't leave anything on the stack and exist because the common case is that the result is unused.

There are still a few corner cases left like floating values, pointers, and over/underflow handling.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136423

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/Interp.h
  clang/lib/AST/Interp/Opcodes.td
  clang/test/AST/Interp/arrays.cpp
  clang/test/AST/Interp/literals.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136423.469487.patch
Type: text/x-patch
Size: 8302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221021/cfcc4b0f/attachment.bin>


More information about the cfe-commits mailing list