[llvm] ae95f29 - [AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 25 03:23:41 PDT 2022
Author: Simon Pilgrim
Date: 2022-03-25T10:23:30Z
New Revision: ae95f291e8d92bb7396219839efc0012a13378e1
URL: https://github.com/llvm/llvm-project/commit/ae95f291e8d92bb7396219839efc0012a13378e1
DIFF: https://github.com/llvm/llvm-project/commit/ae95f291e8d92bb7396219839efc0012a13378e1.diff
LOG: [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
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
index 5d06670f2b532..f179c0af1313a 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<GlobalValue>(F.getPersonalityFn()->stripPointerCasts());
+ const auto *Per =
+ cast<GlobalValue>(F.getPersonalityFn()->stripPointerCasts());
const MCSymbol *PerSym = Asm->TM.getSymbol(Per);
emitExceptionInfoTable(LSDALabel, PerSym);
More information about the llvm-commits
mailing list