[clang] [clang][bytecode][NFC] Remove redundant casts (PR #213210)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 30 23:10:13 PDT 2026


https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/213210

>From 7c0849c943e553a6188b48803196af2bb3543aa2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 31 Jul 2026 07:53:02 +0200
Subject: [PATCH] [clang][bytecode][NFC] Remove redundant casts

---
 clang/lib/AST/ByteCode/Interp.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 23bdc5ea28c03..05a53187ffcd0 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -476,8 +476,8 @@ bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc,
   // If we're evaluating the initializer for a constexpr variable in C23, we may
   // only read other contexpr variables. Abort here since this one isn't
   // constexpr.
-  if (const auto *VD = dyn_cast_if_present<VarDecl>(S.EvaluatingDecl);
-      VD && VD->isConstexpr() && S.getLangOpts().C23)
+  if (const auto *VD = S.EvaluatingDecl;
+      VD->isConstexpr() && S.getLangOpts().C23)
     return Invalid(S, OpPC);
 
   QualType T = D->getType();
@@ -2283,7 +2283,7 @@ bool CallVirt(InterpState &S, CodePtr OpPC, const Function *Func,
     return false;
   assert(DynamicDecl);
 
-  const auto *StaticDecl = cast<CXXRecordDecl>(Func->getParentDecl());
+  const auto *StaticDecl = Func->getParentDecl();
   const auto *InitialFunction = cast<CXXMethodDecl>(Callee);
   const CXXMethodDecl *Overrider;
 



More information about the cfe-commits mailing list