Author: Kazu Hirata Date: 2025-01-24T01:12:30-08:00 New Revision: b4ef11d0e20b8263012613697503533fbb2119d6
URL: https://github.com/llvm/llvm-project/commit/b4ef11d0e20b8263012613697503533fbb2119d6 DIFF: https://github.com/llvm/llvm-project/commit/b4ef11d0e20b8263012613697503533fbb2119d6.diff LOG: [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#124228) 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 Source to be nonnull. Added: Modified: clang/lib/AST/ByteCode/Descriptor.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Descriptor.cpp b/clang/lib/AST/ByteCode/Descriptor.cpp index 437b9f1bab2d6a..1c16c2022dd028 100644 --- a/clang/lib/AST/ByteCode/Descriptor.cpp +++ b/clang/lib/AST/ByteCode/Descriptor.cpp @@ -428,17 +428,17 @@ QualType Descriptor::getElemQualType() const { } SourceLocation Descriptor::getLocation() const { - if (auto *D = Source.dyn_cast<const Decl *>()) + if (auto *D = dyn_cast<const Decl *>(Source)) return D->getLocation(); - if (auto *E = Source.dyn_cast<const Expr *>()) + if (auto *E = dyn_cast<const Expr *>(Source)) return E->getExprLoc(); llvm_unreachable("Invalid descriptor type"); } SourceInfo Descriptor::getLoc() const { - if (const auto *D = Source.dyn_cast<const Decl *>()) + if (const auto *D = dyn_cast<const Decl *>(Source)) return SourceInfo(D); - if (const auto *E = Source.dyn_cast<const Expr *>()) + if (const auto *E = dyn_cast<const Expr *>(Source)) return SourceInfo(E); llvm_unreachable("Invalid descriptor type"); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits