[PATCH] D139185: [clang][Interp] Use placement new to construct opcode args into vector

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 11:43:17 PST 2022


aaron.ballman added a comment.

Generally looks correct to me.



================
Comment at: clang/lib/AST/Interp/PrimType.h:65
 
+constexpr bool aligned(size_t Size) { return Size == align(Size); }
+static_assert(aligned(sizeof(void *)));
----------------
I think `Size` should be something more like `Value` -- I was thrown off by the pointer-based `aligned` that was treating the pointer as an integer value for `Size`. :-D


================
Comment at: clang/lib/AST/Interp/PrimType.h:69
+static inline bool aligned(const void *P) {
+  return aligned(reinterpret_cast<size_t>(P));
+}
----------------
Pedantically, this should be casting through `uintptr_t` rather than `size_t`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139185



More information about the cfe-commits mailing list