[PATCH] D156400: [clang][Interp] Implement __builtin_offsetof

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 23:28:35 PDT 2023


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1536-1537
+      // Cast to Sint64.
+      if (IndexT != PT_Sint64) {
+        if (!this->emitCast(IndexT, PT_Sint64, E))
+          return false;
----------------
cor3ntin wrote:
> Shouldn't that be size_t?
The point of the conversion is that we later know the type, i.e. it will be an int64 and we can count on that in `OffsetOf()`. If we don't do this, we'd have to `classify()` while interpreting, which is also a possibility.


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

https://reviews.llvm.org/D156400



More information about the cfe-commits mailing list