[clang] [Serialization] Delete an unreachable BlockDecl check (NFC) (PR #206298)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 27 18:42:42 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Ivo Popov (ipopov)
<details>
<summary>Changes</summary>
`needsAnonymousDeclarationNumber()` takes a `const NamedDecl *`. Both `BlockDecl` and `NamedDecl` derive from `Decl`, in other words they're siblings.
* https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html
* https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html
Thus `isa<BlockDecl>(D)` is statically false.
---
Full diff: https://github.com/llvm/llvm-project/pull/206298.diff
1 Files Affected:
- (modified) clang/lib/Serialization/ASTCommon.cpp (+1-1)
``````````diff
diff --git a/clang/lib/Serialization/ASTCommon.cpp b/clang/lib/Serialization/ASTCommon.cpp
index 49e6fe8004cec..cedba86e3267d 100644
--- a/clang/lib/Serialization/ASTCommon.cpp
+++ b/clang/lib/Serialization/ASTCommon.cpp
@@ -499,7 +499,7 @@ bool serialization::needsAnonymousDeclarationNumber(const NamedDecl *D) {
if (auto *VD = dyn_cast<VarDecl>(D))
return VD->isStaticLocal();
// FIXME: What about CapturedDecls (and declarations nested within them)?
- return isa<TagDecl, BlockDecl>(D);
+ return isa<TagDecl>(D);
}
// Otherwise, we only care about anonymous class members / block-scope decls.
``````````
</details>
https://github.com/llvm/llvm-project/pull/206298
More information about the cfe-commits
mailing list