[clang] [clang][bytecode][NFC] Use `Block::deref()` in `EvalEmitter` (PR #178630)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 29 02:47:52 PST 2026


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/178630

Instead of doing the casting around `Block::data()` ourselves.

>From c9faf0b1a7870c80664015a6d094fbb48e32ce3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Thu, 29 Jan 2026 11:46:35 +0100
Subject: [PATCH] Use Block::deref

---
 clang/lib/AST/ByteCode/EvalEmitter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp b/clang/lib/AST/ByteCode/EvalEmitter.cpp
index cf3cc1b17133c..7d44c32d73555 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.cpp
+++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp
@@ -293,7 +293,7 @@ bool EvalEmitter::emitGetLocal(uint32_t I, SourceInfo Info) {
   if (!CheckLocalLoad(S, OpPC, B))
     return false;
 
-  S.Stk.push<T>(*reinterpret_cast<T *>(B->data()));
+  S.Stk.push<T>(B->deref<T>());
   return true;
 }
 
@@ -305,7 +305,7 @@ bool EvalEmitter::emitSetLocal(uint32_t I, SourceInfo Info) {
   using T = typename PrimConv<OpType>::T;
 
   Block *B = getLocal(I);
-  *reinterpret_cast<T *>(B->data()) = S.Stk.pop<T>();
+  B->deref<T>() = S.Stk.pop<T>();
   auto &Desc = B->getBlockDesc<InlineDescriptor>();
   Desc.IsInitialized = true;
 



More information about the cfe-commits mailing list