[llvm] f581d19 - [AArch64] AArch64AsmParser::tryParseImmRange - don't directly dereference pointers from dyn_cast
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 08:07:29 PDT 2024
Author: Simon Pilgrim
Date: 2024-06-21T16:07:04+01:00
New Revision: f581d197b7f9896f1a64922ef9928be911c96f4e
URL: https://github.com/llvm/llvm-project/commit/f581d197b7f9896f1a64922ef9928be911c96f4e
DIFF: https://github.com/llvm/llvm-project/commit/f581d197b7f9896f1a64922ef9928be911c96f4e.diff
LOG: [AArch64] AArch64AsmParser::tryParseImmRange - don't directly dereference pointers from dyn_cast
Static analysis was reporting that dyn_cast<> can return null on failure - use cast<> instead
Added:
Modified:
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 57e4f6d298d8d..5e17ed40df8ab 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -8094,8 +8094,8 @@ ParseStatus AArch64AsmParser::tryParseImmRange(OperandVector &Operands) {
if (getParser().parseExpression(ImmL))
return ParseStatus::NoMatch;
- unsigned ImmFVal = dyn_cast<MCConstantExpr>(ImmF)->getValue();
- unsigned ImmLVal = dyn_cast<MCConstantExpr>(ImmL)->getValue();
+ unsigned ImmFVal = cast<MCConstantExpr>(ImmF)->getValue();
+ unsigned ImmLVal = cast<MCConstantExpr>(ImmL)->getValue();
Operands.push_back(
AArch64Operand::CreateImmRange(ImmFVal, ImmLVal, S, E, getContext()));
More information about the llvm-commits
mailing list