[PATCH] D98342: [FileCheck] Fix naming of OverflowErrorStr var

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 06:15:43 PST 2021


thopre created this revision.
thopre added a reviewer: jdenny.
Herald added a subscriber: hiraditya.
thopre requested review of this revision.
Herald added a project: LLVM.

As pointed out by Joel E. Denny in D97845 <https://reviews.llvm.org/D97845>, the OverflowErrorStr variable
is misnamed because the error is raised for any parsing error. Note that
in FileCheck proper this only happens in case of (under|over)flow
because the regex will ensure a number in the correct format is matched.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98342

Files:
  llvm/lib/FileCheck/FileCheck.cpp


Index: llvm/lib/FileCheck/FileCheck.cpp
===================================================================
--- llvm/lib/FileCheck/FileCheck.cpp
+++ llvm/lib/FileCheck/FileCheck.cpp
@@ -121,12 +121,12 @@
 ExpressionFormat::valueFromStringRepr(StringRef StrVal,
                                       const SourceMgr &SM) const {
   bool ValueIsSigned = Value == Kind::Signed;
-  StringRef OverflowErrorStr = "unable to represent numeric value";
+  StringRef IntegerParseErrorStr = "unable to represent numeric value";
   if (ValueIsSigned) {
     int64_t SignedValue;
 
     if (StrVal.getAsInteger(10, SignedValue))
-      return ErrorDiagnostic::get(SM, StrVal, OverflowErrorStr);
+      return ErrorDiagnostic::get(SM, StrVal, IntegerParseErrorStr);
 
     return ExpressionValue(SignedValue);
   }
@@ -134,7 +134,7 @@
   bool Hex = Value == Kind::HexUpper || Value == Kind::HexLower;
   uint64_t UnsignedValue;
   if (StrVal.getAsInteger(Hex ? 16 : 10, UnsignedValue))
-    return ErrorDiagnostic::get(SM, StrVal, OverflowErrorStr);
+    return ErrorDiagnostic::get(SM, StrVal, IntegerParseErrorStr);
 
   return ExpressionValue(UnsignedValue);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98342.329640.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210310/247eef38/attachment.bin>


More information about the llvm-commits mailing list