[llvm-commits] [llvm] r112189 - in /llvm/trunk: lib/Support/StringRef.cpp unittests/ADT/StringRefTest.cpp
Benjamin Kramer
benny.kra at googlemail.com
Thu Aug 26 08:25:35 PDT 2010
Author: d0k
Date: Thu Aug 26 10:25:35 2010
New Revision: 112189
URL: http://llvm.org/viewvc/llvm-project?rev=112189&view=rev
Log:
StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
Modified:
llvm/trunk/lib/Support/StringRef.cpp
llvm/trunk/unittests/ADT/StringRefTest.cpp
Modified: llvm/trunk/lib/Support/StringRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=112189&r1=112188&r2=112189&view=diff
==============================================================================
--- llvm/trunk/lib/Support/StringRef.cpp (original)
+++ llvm/trunk/lib/Support/StringRef.cpp Thu Aug 26 10:25:35 2010
@@ -59,7 +59,7 @@
break;
}
}
- return Data[I] < RHS.Data[I] ? -1 : 1;
+ return (unsigned char)Data[I] < (unsigned char)RHS.Data[I] ? -1 : 1;
}
if (Length == RHS.Length)
return 0;
Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=112189&r1=112188&r2=112189&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/StringRefTest.cpp (original)
+++ llvm/trunk/unittests/ADT/StringRefTest.cpp Thu Aug 26 10:25:35 2010
@@ -72,6 +72,7 @@
EXPECT_EQ( 0, StringRef("10a").compare_numeric("10a"));
EXPECT_EQ( 1, StringRef("2").compare_numeric("1"));
EXPECT_EQ( 0, StringRef("llvm_v1i64_ty").compare_numeric("llvm_v1i64_ty"));
+ EXPECT_EQ( 1, StringRef("\xFF").compare_numeric("\1"));
}
TEST(StringRefTest, Operators) {
More information about the llvm-commits
mailing list