mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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:
parent
407e47c21e
commit
8cdf54c222
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user