[clang] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast_if_present (NFC) (PR #233191)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 17 23:03:31 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present. This patch replaces the
former with llvm::dyn_cast_if_present in
FriendTemplateDecl::getFriendDecl.
This is the only place under clang/ where migrating to llvm::dyn_cast
would trigger an assertion failure during check-clang.
Assisted-by: Antigravity
---
Full diff: https://github.com/llvm/llvm-project/pull/233191.diff
1 Files Affected:
- (modified) clang/include/clang/AST/DeclTemplate.h (+1-1)
``````````diff
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 575ca86155742..5724645602d9b 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -2529,7 +2529,7 @@ class FriendTemplateDecl final
}
NamedDecl *getFriendDecl() const override {
- if (NamedDecl *ND = Friend.dyn_cast<NamedDecl *>())
+ if (NamedDecl *ND = dyn_cast_if_present<NamedDecl *>(Friend))
return ND;
return Template.getAsTemplateDecl();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/233191
More information about the cfe-commits
mailing list