From d5d57635baf6f3aa8d937e20f43dad75179f2cee Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 22 Sep 2016 15:55:05 +0000 Subject: Speculative fix for build failures due to consumeInteger. A recent patch added support for consumeInteger() and made getAsInteger delegate to this function. A few buildbots are failing as a result with an assertion failure. On a hunch, I tested what happens if I call getAsInteger() on an empty string, and sure enough it crashes the same way that the buildbots are crashing. I confirmed that getAsInteger() on an empty string did not crash before my patch, so I suspect this to be the cause. I also added a unit test for the empty string. llvm-svn: 282170 --- llvm/unittests/ADT/StringRefTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/unittests/ADT') diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp index 4249f231481..40ab4e038b8 100644 --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -571,7 +571,8 @@ TEST(StringRefTest, getAsInteger) { static const char* BadStrings[] = { - "18446744073709551617" // value just over max + "" // empty string + , "18446744073709551617" // value just over max , "123456789012345678901" // value way too large , "4t23v" // illegal decimal characters , "0x123W56" // illegal hex characters -- cgit v1.2.3