[PATCH] D156400: [clang][Interp] Implement __builtin_offsetof
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 7 02:16:29 PDT 2023
cor3ntin added a comment.
Generally looks good but still a few unaddressed 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;
----------------
tbaeder wrote:
> 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.
I'm happy leaving that as is.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156400/new/
https://reviews.llvm.org/D156400
More information about the cfe-commits
mailing list