[PATCH] D142617: [clang][Interp] Check This pointer without creating InterpFrame

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 06:25:26 PST 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/InterpStack.h:70-72
+  template <typename T> T &peek(size_t Offset) const {
+    return *reinterpret_cast<T *>(peek(Offset));
+  }
----------------
Ooofda, this only differs from `peek()` on line 97 because this function has a templated return type, but otherwise the signatures only differ based on return type. This doesn't feel like the most clean overload set...

Also, should this be worrying about alignment of `T` compared to the offset we find it at? (Should there be an assert that the offset is sensible for a `T`?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142617



More information about the cfe-commits mailing list