FileCheck: Switch "possible match" calculation to use StringRef::edit_distance.

- Thanks Doug, who is obviously less lazy than me!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94795 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-01-29 03:22:19 +00:00
parent 407e47c21e
commit 8cdf54c222

View File

@ -340,12 +340,7 @@ unsigned Pattern::ComputeMatchDistance(StringRef Buffer,
if (ExampleString.empty())
ExampleString = RegExStr;
unsigned Distance = 0;
for (unsigned i = 0, e = ExampleString.size(); i != e; ++i)
if (Buffer.substr(i, 1) != ExampleString.substr(i, 1))
++Distance;
return Distance;
return Buffer.substr(0, ExampleString.size()).edit_distance(ExampleString);
}
void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer,