[PATCH] D134804: [clang][Interp] Implement bitwise Not operations

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 07:34:15 PDT 2022


aaron.ballman added a comment.

LGTM aside from a question about naming.



================
Comment at: clang/lib/AST/Interp/Integral.h:228-231
+  static bool Not(Integral A, Integral *R) {
+    *R = Integral(~A.V);
+    return false;
+  }
----------------
Can we name this one `complement` instead of `not` -- when I hear `not` I think `!` and not `~`.


================
Comment at: clang/lib/AST/Interp/Interp.h:242
+/// 1) Pops the value from the stack.
+/// 2) Pushes the bitwise negated value on the stack (~V).
+template <PrimType Name, class T = typename PrimConv<Name>::T>
----------------



================
Comment at: clang/lib/AST/Interp/Interp.h:244
+template <PrimType Name, class T = typename PrimConv<Name>::T>
+bool Not(InterpState &S, CodePtr OpPC) {
+  const T &Val = S.Stk.pop<T>();
----------------
Same naming request here.


================
Comment at: clang/lib/AST/Interp/Opcodes.td:426
+// [Real] -> [Real]
+def Not: Opcode {
+  let Types = [NumberTypeClass];
----------------
Here too.


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

https://reviews.llvm.org/D134804



More information about the cfe-commits mailing list