[clang] [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124391)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 19:49:06 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/124391
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect DeclOrIterator to be nonnull.
>From 01d9c2775ff0156f2010c6a14a0e6d934c661f6d Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 24 Jan 2025 09:24:14 -0800
Subject: [PATCH] [Sema] Migrate away from PointerUnion::dyn_cast (NFC)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect DeclOrIterator to be nonnull.
---
clang/lib/Sema/SemaCodeComplete.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 58f3efbe0daf89..bc0f6a9435f958 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -678,7 +678,7 @@ class ResultBuilder::ShadowMapEntry::iterator {
}*/
reference operator*() const {
- if (const NamedDecl *ND = DeclOrIterator.dyn_cast<const NamedDecl *>())
+ if (const NamedDecl *ND = dyn_cast<const NamedDecl *>(DeclOrIterator))
return reference(ND, SingleDeclIndex);
return *cast<const DeclIndexPair *>(DeclOrIterator);
More information about the cfe-commits
mailing list