Author: Kazu Hirata Date: 2025-01-29T07:48:25-08:00 New Revision: 7ab8f286b8e43a98dc5c0404f80d719c49446875
URL: https://github.com/llvm/llvm-project/commit/7ab8f286b8e43a98dc5c0404f80d719c49446875 DIFF: https://github.com/llvm/llvm-project/commit/7ab8f286b8e43a98dc5c0404f80d719c49446875.diff LOG: [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#124883) 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> This patch migrates the use of PointerUnion::dyn_cast to dyn_cast_if_present because ShadowMapEntry::Add starts with: if (DeclOrVector.isNull()) { implying that DeclOrVector is not guaranteed 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 bc0f6a9435f958..f10f7f4768f8e8 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -137,7 +137,7 @@ class ResultBuilder { ~ShadowMapEntry() { if (DeclIndexPairVector *Vec = - DeclOrVector.dyn_cast<DeclIndexPairVector *>()) { + dyn_cast_if_present<DeclIndexPairVector *>(DeclOrVector)) { delete Vec; DeclOrVector = ((NamedDecl *)nullptr); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits