[clang] [clang][bytecode][NFC] Fix getting references to local function ptrs (PR #129852)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 5 01:02:52 PST 2025


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

This is the same thing we do for globals and parameters.

>From 9f71da5ed2b6dfa7ec26b1b0b5a51a713edeee4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 5 Mar 2025 10:01:39 +0100
Subject: [PATCH] [clang][bytecode][NFC] Fix getting references to local
 function ptrs

This is the same thing we do for globals and parameters.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 394e39e99a106..281fb7e14a57d 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -6325,7 +6325,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
   if (auto It = Locals.find(D); It != Locals.end()) {
     const unsigned Offset = It->second.Offset;
     if (IsReference)
-      return this->emitGetLocal(PT_Ptr, Offset, E);
+      return this->emitGetLocal(classifyPrim(E), Offset, E);
     return this->emitGetPtrLocal(Offset, E);
   } else if (auto GlobalIndex = P.getGlobal(D)) {
     if (IsReference) {



More information about the cfe-commits mailing list