diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp --- a/llvm/lib/FileCheck/FileCheck.cpp +++ b/llvm/lib/FileCheck/FileCheck.cpp @@ -150,10 +150,9 @@ (void)MissingFormPrefix; assert(!MissingFormPrefix && "missing alternate form prefix"); APInt ResultValue; - bool ParseFailure = StrVal.getAsInteger(Hex ? 16 : 10, ResultValue); - if (ParseFailure) - return ErrorDiagnostic::get(SM, StrVal, - "unable to represent numeric value"); + [[maybe_unused]] bool ParseFailure = + StrVal.getAsInteger(Hex ? 16 : 10, ResultValue); + assert(!ParseFailure && "unable to represent numeric value"); return toSigned(ResultValue, Negative); } diff --git a/llvm/unittests/FileCheck/FileCheckTest.cpp b/llvm/unittests/FileCheck/FileCheckTest.cpp --- a/llvm/unittests/FileCheck/FileCheckTest.cpp +++ b/llvm/unittests/FileCheck/FileCheckTest.cpp @@ -321,7 +321,10 @@ // Wrong casing is not tested because valueFromStringRepr() relies on // StringRef's getAsInteger() which does not allow to restrict casing. - checkValueFromStringReprFailure(addBasePrefix("G")); + + // Likewise, wrong letter digit for hex value is not tested because it is + // only caught by an assert in FileCheck due to getWildcardRegex() + // guaranteeing only valid letter digits are used. } TEST_P(ExpressionFormatParameterisedFixture, FormatBoolOperator) {