[clang] 62bd217 - [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#124391)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 25 01:16:21 PST 2025
Author: Kazu Hirata
Date: 2025-01-25T01:16:17-08:00
New Revision: 62bd217b5a1cf6b231b2413b5522533986d4e5df
URL: https://github.com/llvm/llvm-project/commit/62bd217b5a1cf6b231b2413b5522533986d4e5df
DIFF: https://github.com/llvm/llvm-project/commit/62bd217b5a1cf6b231b2413b5522533986d4e5df.diff
LOG: [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#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.
Added:
Modified:
clang/lib/Sema/SemaCodeComplete.cpp
Removed:
################################################################################
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