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

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 09:59:59 PDT 2022


shafik accepted this revision.
shafik added a comment.

LGTM



================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1258
+  }
+  case UO_PreDec: { // --x
+    if (!this->visit(SubExpr))
----------------
You could combine this with `UO_PreInc` and just use a `bool` flag to determine whether to call `emitAdd` or `emitSub` . Although maybe that it too clever.


================
Comment at: clang/test/AST/Interp/literals.cpp:364
 };
+
+#if __cplusplus > 201402L
----------------
Fun tests

```
+[](){};
+'a';
```

The action will really be done by the casts but the `+` is still technically having that affect.


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

https://reviews.llvm.org/D136423



More information about the cfe-commits mailing list