[clang] [NFC][Clang] Use `isa_and_nonnull` instead of `VD && isa<VarDecl>(VD)` (PR #93207)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 23 08:37:50 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-clang
Author: None (yronglin)
<details>
<summary>Changes</summary>
This issue was found in https://github.com/llvm/llvm-project/pull/86960. But I'd like to avoid mixing together a bunch of cleanups with actual changes.
---
Full diff: https://github.com/llvm/llvm-project/pull/93207.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CGExpr.cpp (+2-2)
``````````diff
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 4072025376768..d6478cc6835d8 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -317,8 +317,8 @@ pushTemporaryCleanup(CodeGenFunction &CGF, const MaterializeTemporaryExpr *M,
CleanupKind CleanupKind;
if (Lifetime == Qualifiers::OCL_Strong) {
const ValueDecl *VD = M->getExtendingDecl();
- bool Precise =
- VD && isa<VarDecl>(VD) && VD->hasAttr<ObjCPreciseLifetimeAttr>();
+ bool Precise = isa_and_nonnull<VarDecl>(VD) &&
+ VD->hasAttr<ObjCPreciseLifetimeAttr>();
CleanupKind = CGF.getARCCleanupKind();
Destroy = Precise ? &CodeGenFunction::destroyARCStrongPrecise
: &CodeGenFunction::destroyARCStrongImprecise;
``````````
</details>
https://github.com/llvm/llvm-project/pull/93207
More information about the cfe-commits
mailing list