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

Remove the call to D->hasGlobalStorage(), since we never reach this point for 
local variables.

>From 39bd7c5dff416b3ae4c156835aa27aadcaea704c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com>
Date: Fri, 11 Jul 2025 11:09:08 +0200
Subject: [PATCH] [clang][bytecode] Remove needless global check

Remove the call to D->hasGlobalStorage(), since we never reach this
point for local variables.
---
 clang/lib/AST/ByteCode/Interp.cpp | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index be77657acabcc..49063cf755cc0 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -445,13 +445,7 @@ bool CheckConstant(InterpState &S, CodePtr OpPC, const 
Descriptor *Desc) {
   assert(Desc);
 
   const auto *D = Desc->asVarDecl();
-  if (!D || !D->hasGlobalStorage())
-    return true;
-
-  if (D == S.EvaluatingDecl)
-    return true;
-
-  if (D->isConstexpr())
+  if (!D || D == S.EvaluatingDecl || D->isConstexpr())
     return true;
 
   // If we're evaluating the initializer for a constexpr variable in C23, we 
may

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to