[clang] [clang][NFC] Clean up Expr::isTemporaryObject() (PR #140229)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 02:44:22 PDT 2025
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/140229
None
>From ed50778c68265d3e77f853b1d0409ef795512c7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 16 May 2025 11:42:53 +0200
Subject: [PATCH] [clang][NFC] Clean up Expr::isTemporaryObject()
---
clang/lib/AST/Expr.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 8557c3b82ca39..0ad73360dc0ff 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -3263,8 +3263,8 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const {
// refer to temporaries of that type:
// - implicit derived-to-base conversions
- if (isa<ImplicitCastExpr>(E)) {
- switch (cast<ImplicitCastExpr>(E)->getCastKind()) {
+ if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E))
+ switch (ICE->getCastKind()) {
case CK_DerivedToBase:
case CK_UncheckedDerivedToBase:
return false;
@@ -3277,7 +3277,7 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const {
if (isa<MemberExpr>(E))
return false;
- if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(E))
+ if (const auto *BO = dyn_cast<BinaryOperator>(E))
if (BO->isPtrMemOp())
return false;
More information about the cfe-commits
mailing list