[clang] [clang][bytecode][NFC] Move Remove unused CheckExtern prototype (PR #223146)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 12 06:17:09 PDT 2026


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

And add an overload taking only a Block.

>From 90f0e70a2261089b32dc58be84efe63b076eb381 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sat, 12 Sep 2026 15:14:40 +0200
Subject: [PATCH] [clang][bytecode][NFC] Move Remove unused CheckExtern
 prototype

And add an overload taking only a Block.
---
 clang/lib/AST/ByteCode/Interp.cpp | 10 ++++++++--
 clang/lib/AST/ByteCode/Interp.h   |  3 ---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 160cc745c89b6..b0b8cfd7198ac 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -461,7 +461,7 @@ bool CheckActive(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
   return false;
 }
 
-bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
+static bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
   if (!Ptr.isExtern())
     return true;
 
@@ -480,6 +480,12 @@ bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
   return false;
 }
 
+static bool CheckExtern(InterpState &S, CodePtr OpPC, const Block *B) {
+  if (!B->isExtern())
+    return true;
+  return CheckExtern(S, OpPC, Pointer(const_cast<Block *>(B)));
+}
+
 bool CheckArray(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
   if (!Ptr.isUnknownSizeArray())
     return true;
@@ -874,7 +880,7 @@ static bool CheckWeak(InterpState &S, CodePtr OpPC, const Block *B) {
 bool CheckGlobalLoad(InterpState &S, CodePtr OpPC, const Block *B) {
   const auto &Desc = B->getBlockDesc<GlobalInlineDescriptor>();
   if (!B->isAccessible()) {
-    if (!CheckExtern(S, OpPC, Pointer(const_cast<Block *>(B))))
+    if (!CheckExtern(S, OpPC, B))
       return false;
     if (!CheckDummy(S, OpPC, B, AK_Read))
       return false;
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index a20a3f91dd267..7c71635561708 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -55,9 +55,6 @@ namespace interp {
 using APSInt = llvm::APSInt;
 using FixedPointSemantics = llvm::FixedPointSemantics;
 
-/// Checks if the variable has externally defined storage.
-bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
-
 /// Checks if a pointer is null.
 bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
                CheckSubobjectKind CSK);



More information about the cfe-commits mailing list