[clang] [clang] Remove a redundant check in Mangle. NFC (PR #95071)

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


https://github.com/samolisov created https://github.com/llvm/llvm-project/pull/95071

This addresses a review comment for PR #94987 Because that PR is a big automatic change, this change was moved in a separate one.

>From c0e810f0a8d17ce222ad0775874539e09a90eb33 Mon Sep 17 00:00:00 2001
From: Pavel Samolysov <samolisov at gmail.com>
Date: Mon, 10 Jun 2024 20:29:16 +0300
Subject: [PATCH] [clang] Remove a redundant check in Mangle. NFC

This addresses a review comment for PR #94987 Because that PR is a big
automatic change, this change was moved in a separate one.
---
 clang/lib/AST/Mangle.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp
index 4af4d7c00c5cb..4fbf0e3b42dbc 100644
--- a/clang/lib/AST/Mangle.cpp
+++ b/clang/lib/AST/Mangle.cpp
@@ -301,9 +301,8 @@ void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD,
   } else {
     assert((isa<NamedDecl>(DC) || isa<BlockDecl>(DC)) &&
            "expected a NamedDecl or BlockDecl");
-    if (isa<BlockDecl>(DC))
-      for (; isa_and_nonnull<BlockDecl>(DC); DC = DC->getParent())
-        (void) getBlockId(cast<BlockDecl>(DC), true);
+    for (; isa_and_nonnull<BlockDecl>(DC); DC = DC->getParent())
+      (void)getBlockId(cast<BlockDecl>(DC), true);
     assert((isa<TranslationUnitDecl>(DC) || isa<NamedDecl>(DC)) &&
            "expected a TranslationUnitDecl or a NamedDecl");
     if (const auto *CD = dyn_cast<CXXConstructorDecl>(DC))



More information about the cfe-commits mailing list