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

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 30 22:57:45 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/213210.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.cpp (+3-3) 


``````````diff
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;
 

``````````

</details>


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


More information about the cfe-commits mailing list