From 46359424bb2d6eb04508227d6c8ba433298b0ab9 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 10 Feb 2022 20:44:19 +0000 Subject: [llvm-libtool-darwin] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr --- llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp') diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index 0c429c0..591a884 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -364,7 +364,7 @@ private: "'%s': format not supported", Member.MemberName.data()); - auto *O = dyn_cast(ObjOrErr->get()); + auto *O = cast(ObjOrErr->get()); uint32_t FileCPUType, FileCPUSubtype; std::tie(FileCPUType, FileCPUSubtype) = MachO::getCPUTypeFromArchitecture( MachO::getArchitectureFromName(O->getArchTriple().getArchName())); -- cgit v1.1