[PATCH] D156042: [clang][Interp] Implement __builtin_strlen

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 05:16:18 PDT 2023


cor3ntin accepted this revision.
cor3ntin added a comment.
This revision is now accepted and ready to land.

LGTM, modulo suggestion



================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:63-69
+  if (SizeTWidth == 64)
+    S.Stk.push<Integral<64, false>>(Integral<64, false>::from(Val));
+  else if (SizeTWidth == 32)
+    S.Stk.push<Integral<32, false>>(Integral<32, false>::from(Val));
+  else
+    llvm_unreachable("size_t isn't 64 or 32 bit?");
+}
----------------
Maybe we could have
```
pushSignedInteger(InterpState &S, unsigned bit width, int64_t Val);
pushUnsignedInteger(InterpState &S, unsigned bit width, int64_t Val)
```
to simplify pushSizeT and pushInt


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

https://reviews.llvm.org/D156042



More information about the cfe-commits mailing list