[clang] [clang][bytecode][NFC] Remove unneeded isLive() checks (PR #241943)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 23:54:56 PST 2026
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/241943
>From fee2f64b56c9d24e7ab56ef22e83f2ddc8c842f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Thu, 12 Nov 2026 16:51:31 +0100
Subject: [PATCH] [clang][bytecode][NFC] Remove unneeded isLive() checks
---
clang/lib/AST/ByteCode/EvaluationResult.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/clang/lib/AST/ByteCode/EvaluationResult.cpp b/clang/lib/AST/ByteCode/EvaluationResult.cpp
index d6dbd8c80f32f..d44239545e5b4 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.cpp
+++ b/clang/lib/AST/ByteCode/EvaluationResult.cpp
@@ -455,6 +455,7 @@ static bool lvalFields(InterpState &S, const ASTContext &Ctx, PtrView Ptr,
QualType PtrType, SourceInfo Info,
ConstantExprKind ConstexprKind,
llvm::SmallPtrSet<const Block *, 4> &CheckedBlocks) {
+ assert(Ptr.isLive());
const Descriptor *FieldDesc = Ptr.getFieldDesc();
if (const Record *R = Ptr.getRecord()) {
if (!R->hasPtrField())
@@ -476,9 +477,6 @@ static bool lvalFields(InterpState &S, const ASTContext &Ctx, PtrView Ptr,
continue;
if (F.Desc->isPrimitive() && F.Desc->getPrimType() == PT_Ptr) {
- if (!FieldPtr.isLive())
- return false;
-
Pointer Pointee = FieldPtr.deref<Pointer>();
if (!Pointee.isBlockPointer() ||
CheckedBlocks.insert(Pointee.block()).second) {
@@ -507,8 +505,6 @@ static bool lvalFields(InterpState &S, const ASTContext &Ctx, PtrView Ptr,
if (FieldDesc->isPrimitiveArray() && FieldDesc->getPrimType() == PT_Ptr) {
for (unsigned I = 0; I != FieldDesc->getNumElems(); ++I) {
- if (!Ptr.isLive())
- return false;
Pointer Pointee = Ptr.elem<Pointer>(I);
if (!Pointee.isBlockPointer() ||
More information about the cfe-commits
mailing list