aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/StringRef.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-19 22:13:48 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-19 22:13:48 +0000
commit5ee568ac2704d7302017d42ad162d4b53d076cbc (patch)
treed311ee0f4b361b87b9d7069daecbbe34ed0975ae /include/llvm/ADT/StringRef.h
parent8155ea4c3a656d32b0ddd93de6e7bbca4ace867a (diff)
downloadexternal_llvm-5ee568ac2704d7302017d42ad162d4b53d076cbc.tar.gz
external_llvm-5ee568ac2704d7302017d42ad162d4b53d076cbc.tar.bz2
external_llvm-5ee568ac2704d7302017d42ad162d4b53d076cbc.zip
Extend StringRef's edit-distance algorithm to permit an upper bound on the allowed edit distance
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringRef.h')
-rw-r--r--include/llvm/ADT/StringRef.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 8386d3ee42..ccf8ca9a66 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -142,11 +142,16 @@ namespace llvm {
/// operation, rather than as two operations (an insertion and a
/// removal).
///
+ /// \param MaxEditDistance If non-zero, the maximum edit distance that
+ /// this routine is allowed to compute. If the edit distance will exceed
+ /// that maximum, returns \c MaxEditDistance+1.
+ ///
/// \returns the minimum number of character insertions, removals,
/// or (if \p AllowReplacements is \c true) replacements needed to
/// transform one of the given strings into the other. If zero,
/// the strings are identical.
- unsigned edit_distance(StringRef Other, bool AllowReplacements = true);
+ unsigned edit_distance(StringRef Other, bool AllowReplacements = true,
+ unsigned MaxEditDistance = 0);
/// str - Get the contents as an std::string.
std::string str() const {