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

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 27 00:52:08 PDT 2023


tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, shafik, cor3ntin.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Put all the index expressions on the stack and cast them to `SInt64`. Then add a new `OffsetOf` opcode so we can evaluate the index expressions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156400

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeExprGen.h
  clang/lib/AST/Interp/Interp.h
  clang/lib/AST/Interp/InterpBuiltin.cpp
  clang/lib/AST/Interp/Opcodes.td
  clang/test/AST/Interp/class-layout.cpp
  clang/test/AST/Interp/literals.cpp
  clang/test/Sema/offsetof-64.c
  clang/test/SemaCXX/class-layout.cpp
  clang/test/SemaCXX/offsetof-0x.cpp
  clang/test/SemaCXX/offsetof.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156400.544637.patch
Type: text/x-patch
Size: 26940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230727/d05ef511/attachment-0001.bin>


More information about the cfe-commits mailing list