[llvm-commits] [PATCH] Add function for computing the edit distance of two arrays.

Kaelyn Uhrain rikka at google.com
Tue Feb 14 15:50:18 PST 2012


I noticed and fixed the spacing issue in the function arguments (lines 44
and 45) shortly after mailing the patch.

What I'm mainly looking for is approval on the organizational/style aspects
of the patch such as the name and location of the header file, etc. The
body of llvm::ComputeEditDistance is just the original body of
StringRef::edit_distance, modified to use two ArrayRef arguments instead of
one StringRef argument and *this. I've verified the patch does not break
any llvm or clang unit tests.

The motivation behind this patch is that in clang's typo correction code, I
want to compute the "edit distance" of something that is not a string
(specifically, the sets of IdentifierInfo pointers that make up two C++
nested name specifiers) and did not want to simply duplicate the body of
StringRef::edit_distance in a local function. ;)

Cheers,
Kaelyn

On Tue, Feb 14, 2012 at 3:39 PM, Kaelyn Uhrain <rikka at google.com> wrote:

>
> Accomplished by moving the body of StringRef::edit_distance into
> a separate function that accepts two ArrayRefs, and making
> StringRef::edit_distance a wrapper around the new function.
> ---
>  include/llvm/ADT/edit_distance.h |  101
> ++++++++++++++++++++++++++++++++++++++
>  lib/Support/StringRef.cpp        |   56 ++-------------------
>  2 files changed, 106 insertions(+), 51 deletions(-)
>  create mode 100644 include/llvm/ADT/edit_distance.h
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120214/68f43f04/attachment.html>


More information about the llvm-commits mailing list