[clang] [clang] Replace X && isa<Y>(X) with isa_and_nonnull<Y>(X). NFC (PR #94987)

Pavel Samolysov via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 07:54:36 PDT 2024


================
@@ -302,7 +302,7 @@ void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD,
     assert((isa<NamedDecl>(DC) || isa<BlockDecl>(DC)) &&
            "expected a NamedDecl or BlockDecl");
     if (isa<BlockDecl>(DC))
-      for (; DC && isa<BlockDecl>(DC); DC = DC->getParent())
+      for (; isa_and_nonnull<BlockDecl>(DC); DC = DC->getParent())
         (void) getBlockId(cast<BlockDecl>(DC), true);
----------------
samolisov wrote:

@NagyDonat thank you for the suggestion. I can remove the check after merging this PR as a separate change.

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


More information about the cfe-commits mailing list