From: Simon Pilgrim Date: Wed, 2 Feb 2022 15:35:46 +0000 (+0000) Subject: [llvm-rc] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr X-Git-Tag: upstream/15.0.7~18082 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9031e5113c47b41eb265f954d53efcef5ec626be;p=platform%2Fupstream%2Fllvm.git [llvm-rc] 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 --- diff --git a/llvm/tools/llvm-rc/ResourceFileWriter.cpp b/llvm/tools/llvm-rc/ResourceFileWriter.cpp index 60287a37..8662320 100644 --- a/llvm/tools/llvm-rc/ResourceFileWriter.cpp +++ b/llvm/tools/llvm-rc/ResourceFileWriter.cpp @@ -875,7 +875,7 @@ Error ResourceFileWriter::visitIconOrCursorResource(const RCResource *Base) { FileStr = IconRes->IconLoc; Type = IconCursorGroupType::Icon; } else { - auto *CursorRes = dyn_cast(Base); + auto *CursorRes = cast(Base); FileStr = CursorRes->CursorLoc; Type = IconCursorGroupType::Cursor; }