[PATCH] D149133: [clang][Interp] BaseToDerived casts

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 01:21:41 PDT 2023


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

  We can implement these similarly to DerivedToBase casts. We just have to
  walk the class hierarchy, sum the base offsets and subtract it from the
  current base offset of the pointer.

As a side-effect, this also changes the `BaseToDerived` casts to only emit //one// opcode instead of one per base cast.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149133

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeExprGen.h
  clang/lib/AST/Interp/Interp.cpp
  clang/lib/AST/Interp/Interp.h
  clang/lib/AST/Interp/Opcodes.td
  clang/lib/AST/Interp/Pointer.h
  clang/test/AST/Interp/records.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149133.516700.patch
Type: text/x-patch
Size: 8297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230425/25b507b2/attachment.bin>


More information about the cfe-commits mailing list