Fix pasto in StringRef::count(char)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-08-18 18:34:22 +00:00
parent 4d91943889
commit 323a3e6533
2 changed files with 2 additions and 1 deletions

View File

@ -177,7 +177,7 @@ namespace llvm {
size_t Count = 0;
for (size_t i = 0, e = Length; i != e; ++i)
if (Data[i] == C)
return i;
++Count;
return Count;
}

View File

@ -96,6 +96,7 @@ TEST(StringRefTest, Utilities) {
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);