Skip to content

Commit 4635942

Browse files
committed
[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
1 parent 6af7c13 commit 4635942

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ class MembersBuilder {
364364
"'%s': format not supported",
365365
Member.MemberName.data());
366366

367-
auto *O = dyn_cast<MachOObjectFile>(ObjOrErr->get());
367+
auto *O = cast<MachOObjectFile>(ObjOrErr->get());
368368
uint32_t FileCPUType, FileCPUSubtype;
369369
std::tie(FileCPUType, FileCPUSubtype) = MachO::getCPUTypeFromArchitecture(
370370
MachO::getArchitectureFromName(O->getArchTriple().getArchName()));

0 commit comments

Comments
 (0)