From: Simon Pilgrim Date: Fri, 25 Mar 2022 10:23:22 +0000 (+0000) Subject: [AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid... X-Git-Tag: upstream/15.0.7~12347 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae95f291e8d92bb7396219839efc0012a13378e1;p=platform%2Fupstream%2Fllvm.git [AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointer is used immediately inside the getSymbol() call, so assert the cast is correct instead of returning nullptr --- diff --git a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp index 5d06670..f179c0a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp @@ -73,8 +73,8 @@ void AIXException::endFunction(const MachineFunction *MF) { const Function &F = MF->getFunction(); assert(F.hasPersonalityFn() && "Landingpads are presented, but no personality routine is found."); - const GlobalValue *Per = - dyn_cast(F.getPersonalityFn()->stripPointerCasts()); + const auto *Per = + cast(F.getPersonalityFn()->stripPointerCasts()); const MCSymbol *PerSym = Asm->TM.getSymbol(Per); emitExceptionInfoTable(LSDALabel, PerSym);