aboutsummaryrefslogtreecommitdiffstats
path: root/utils/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/FileCheck/FileCheck.cpp')
-rw-r--r--utils/FileCheck/FileCheck.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp
index 078028a..440d7d7 100644
--- a/utils/FileCheck/FileCheck.cpp
+++ b/utils/FileCheck/FileCheck.cpp
@@ -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,