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

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 19:37:20 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Pavel Samolysov (samolisov)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/95071.diff


1 Files Affected:

- (modified) clang/lib/AST/Mangle.cpp (+2-3) 


``````````diff
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))

``````````

</details>


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


More information about the cfe-commits mailing list