[clang] [clang][bytecode] Remove suspicious usage of local variable (PR #185360)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 8 23:58:26 PDT 2026


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

There's already already an if statement before ensuring that UseFieldDesc is false.

>From 03dbf9d601334951b4163b57701b393fa187a04a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 9 Mar 2026 07:57:20 +0100
Subject: [PATCH] [clang][bytecode] Remove suspicious usage of local variable

There's already already an if statement before ensuring that
UseFieldDesc is false.
---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index c7d3c2e500592..a2557d4128055 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -2333,12 +2333,8 @@ UnsignedOrNone evaluateBuiltinObjectSize(const ASTContext &ASTCtx,
   bool UseFieldDesc = (Kind & 1u);
   bool ReportMinimum = (Kind & 2u);
   if (!UseFieldDesc || DetermineForCompleteObject) {
-    // Lower bound, so we can't fall back to this.
-    if (ReportMinimum && UseFieldDesc && !DetermineForCompleteObject)
-      return std::nullopt;
-
     // Can't read beyond the pointer decl desc.
-    if (!UseFieldDesc && !ReportMinimum && DeclDesc->getType()->isPointerType())
+    if (!ReportMinimum && DeclDesc->getType()->isPointerType())
       return std::nullopt;
 
     if (InvalidBase)



More information about the cfe-commits mailing list