Author: yronglin
Date: 2024-05-23T23:43:41+08:00
New Revision: 5a81db311cf8e15b7c6a33100bb5c1fb256754ce

URL: 
https://github.com/llvm/llvm-project/commit/5a81db311cf8e15b7c6a33100bb5c1fb256754ce
DIFF: 
https://github.com/llvm/llvm-project/commit/5a81db311cf8e15b7c6a33100bb5c1fb256754ce.diff

LOG: [NFC][Clang] Use `isa_and_nonnull` instead of `VD && isa<VarDecl>(VD)` 
(#93207)

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.

Signed-off-by: yronglin <yronglin...@gmail.com>

Added: 
    

Modified: 
    clang/lib/CodeGen/CGExpr.cpp

Removed: 
    


################################################################################
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;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to