HexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantExpr> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MCConstantExpr> directly and if not assert will fire for us.

llvm-svn: 372956
This commit is contained in:
Simon Pilgrim 2019-09-26 10:35:19 +00:00
parent fc82c7a1b0
commit 39e3b7062a
1 changed files with 1 additions and 1 deletions

View File

@ -702,7 +702,7 @@ bool HexagonAsmParser::ParseDirectiveFalign(unsigned Size, SMLoc L) {
// Make sure we have a number (false is returned if expression is a number) // Make sure we have a number (false is returned if expression is a number)
if (!getParser().parseExpression(Value)) { if (!getParser().parseExpression(Value)) {
// Make sure this is a number that is in range // Make sure this is a number that is in range
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value); auto *MCE = cast<MCConstantExpr>(Value);
uint64_t IntValue = MCE->getValue(); uint64_t IntValue = MCE->getValue();
if (!isUIntN(Size, IntValue) && !isIntN(Size, IntValue)) if (!isUIntN(Size, IntValue) && !isIntN(Size, IntValue))
return Error(ExprLoc, "literal value out of range (256) for falign"); return Error(ExprLoc, "literal value out of range (256) for falign");