[llvm-commits] [llvm] r94795 - /llvm/trunk/utils/FileCheck/FileCheck.cpp
Daniel Dunbar
daniel at zuster.org
Thu Jan 28 19:22:20 PST 2010
Author: ddunbar
Date: Thu Jan 28 21:22:19 2010
New Revision: 94795
URL: http://llvm.org/viewvc/llvm-project?rev=94795&view=rev
Log:
FileCheck: Switch "possible match" calculation to use StringRef::edit_distance.
- Thanks Doug, who is obviously less lazy than me!
Modified:
llvm/trunk/utils/FileCheck/FileCheck.cpp
Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=94795&r1=94794&r2=94795&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Thu Jan 28 21:22:19 2010
@@ -340,12 +340,7 @@
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,
More information about the llvm-commits
mailing list