[clang] [clang][bytecode][NFC] Move local into closest scope (PR #154969)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 22 08:24:50 PDT 2025


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

None

>From 6d86a376c8a2ef7e18563cc601c41420305bfc6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 22 Aug 2025 17:16:54 +0200
Subject: [PATCH] [clang][bytecode][NFC] Move local into closest scope

---
 clang/lib/AST/ByteCode/Pointer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 7dc6b0c6d437b..38856ad256a63 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -278,10 +278,10 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
       Ptr = Ptr.getArray();
     } else {
       const Descriptor *Desc = Ptr.getFieldDesc();
-      bool IsVirtual = false;
 
       // Create a path entry for the field.
       if (const auto *BaseOrMember = Desc->asDecl()) {
+        bool IsVirtual = false;
         if (const auto *FD = dyn_cast<FieldDecl>(BaseOrMember)) {
           Ptr = Ptr.getBase();
           Offset += getFieldOffset(FD);



More information about the cfe-commits mailing list