17#include "llvm/ADT/StringRef.h"
22 if (Candidate.empty())
25 unsigned MinPossibleEditDistance =
26 abs(
static_cast<int>(Candidate.size()) -
static_cast<int>(Typo.size()));
28 if (MinPossibleEditDistance > 0 && Typo.size() / MinPossibleEditDistance < 3)
31 unsigned EditDistance = Typo.edit_distance(
32 Candidate,
true, MaxEditDistance);
34 if (EditDistance < BestEditDistance) {
35 BestCandidate = Candidate;
36 BestEditDistance = EditDistance;
37 BestIndex = NextIndex;
45 add(StringRef(Candidate));
62 return BestEditDistance <= MaxEditDistance;
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
__DEVICE__ long long abs(long long __n)
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
std::optional< StringRef > getCorrection() const
void add(const StringRef Candidate)
unsigned getCorrectionIndex() const
bool hasCorrection() const
The JSON file list parser is used to communicate input to InstallAPI.