[clang] [clang][bytecode] Remove suspicious usage of local variable (PR #185360)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 8 23:58:56 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
There's already already an if statement before ensuring that UseFieldDesc is false.
---
Full diff: https://github.com/llvm/llvm-project/pull/185360.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+1-5)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/185360
More information about the cfe-commits
mailing list