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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 23 01:17:04 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:101-112
+  for (;;) {
+    const Pointer &ElemPtr = StrPtr.atIndex(I);
+
+    if (!CheckRange(S, OpPC, ElemPtr, AK_Read))
+      return false;
+
+    uint8_t Val = ElemPtr.deref<uint8_t>();
----------------
maybe a do while would be cleaner


================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:114
+
+  // TODO: Push platform-dependent size_t.
+  S.Stk.push<Integral<64, false>>(Integral<64, false>::from(Len));
----------------
Why not do that in this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156042



More information about the cfe-commits mailing list