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

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 00:53:47 PDT 2026


Author: Timm Baeder
Date: 2026-03-09T08:53:43+01:00
New Revision: b9499954205e25038accc94eea23965a23eed86a

URL: https://github.com/llvm/llvm-project/commit/b9499954205e25038accc94eea23965a23eed86a
DIFF: https://github.com/llvm/llvm-project/commit/b9499954205e25038accc94eea23965a23eed86a.diff

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

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

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/InterpBuiltin.cpp

Removed: 
    


################################################################################
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