[llvm-commits] [llvm] r79356 - in /llvm/trunk: include/llvm/ADT/StringRef.h unittests/ADT/StringRefTest.cpp
Daniel Dunbar
daniel at zuster.org
Tue Aug 18 11:34:23 PDT 2009
Author: ddunbar
Date: Tue Aug 18 13:34:22 2009
New Revision: 79356
URL: http://llvm.org/viewvc/llvm-project?rev=79356&view=rev
Log:
Fix pasto in StringRef::count(char)
Modified:
llvm/trunk/include/llvm/ADT/StringRef.h
llvm/trunk/unittests/ADT/StringRefTest.cpp
Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=79356&r1=79355&r2=79356&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Tue Aug 18 13:34:22 2009
@@ -177,7 +177,7 @@
size_t Count = 0;
for (size_t i = 0, e = Length; i != e; ++i)
if (Data[i] == C)
- return i;
+ ++Count;
return Count;
}
Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=79356&r1=79355&r2=79356&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/StringRefTest.cpp (original)
+++ llvm/trunk/unittests/ADT/StringRefTest.cpp Tue Aug 18 13:34:22 2009
@@ -96,6 +96,7 @@
EXPECT_TRUE(Str.find("zz") == StringRef::npos);
EXPECT_TRUE(Str.count('l') == 2);
+ EXPECT_TRUE(Str.count('o') == 1);
EXPECT_TRUE(Str.count('z') == 0);
EXPECT_TRUE(Str.count("helloworld") == 0);
EXPECT_TRUE(Str.count("hello") == 1);
More information about the llvm-commits
mailing list