[clang] [clang][bytecode][NFC] Use RetPC in InterpFrame::getExpr() as well (PR #125200)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 31 03:12:45 PST 2025


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

Both getLocation() and getRange() use the RetPC if the current function doesn't have a usable body. Using PC here was just a typo.

>From 07af7276f1bebc995d26d0c2c24d22e7554a734d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 31 Jan 2025 12:11:13 +0100
Subject: [PATCH] [clang][bytecode][NFC] Use RetPC in InterpFrame::getExpr() as
 well

Both getLocation() and getRange() use the RetPC if the current
function doesn't have a usable body. Using PC here was just a typo.
---
 clang/lib/AST/ByteCode/InterpFrame.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/InterpFrame.cpp b/clang/lib/AST/ByteCode/InterpFrame.cpp
index 20f67d9b1fd425..48a3db055c6c9b 100644
--- a/clang/lib/AST/ByteCode/InterpFrame.cpp
+++ b/clang/lib/AST/ByteCode/InterpFrame.cpp
@@ -244,7 +244,7 @@ SourceInfo InterpFrame::getSource(CodePtr PC) const {
 
 const Expr *InterpFrame::getExpr(CodePtr PC) const {
   if (Func && !funcHasUsableBody(Func) && Caller)
-    return Caller->getExpr(PC);
+    return Caller->getExpr(RetPC);
 
   return S.getExpr(Func, PC);
 }



More information about the cfe-commits mailing list