15#include "clang/AST/CommentCommandInfo.inc" 
   19    : NextID(
std::size(Commands)), Allocator(Allocator) {
 
 
   25  for (CommentOptions::BlockCommandNamesTy::const_iterator
 
 
   36  return getRegisteredCommandInfo(Name);
 
 
   42  return getRegisteredCommandInfo(CommandID);
 
 
   53  const unsigned MaxEditDistance = 1;
 
   55  unsigned BestEditDistance = MaxEditDistance;
 
   58  auto ConsiderCorrection = [&](
const CommandInfo *Command) {
 
   59    StringRef Name = Command->Name;
 
   61    unsigned MinPossibleEditDistance = 
abs((
int)Name.size() - (
int)Typo.size());
 
   62    if (MinPossibleEditDistance <= BestEditDistance) {
 
   63      unsigned EditDistance = Typo.edit_distance(Name, 
true, BestEditDistance);
 
   64      if (EditDistance < BestEditDistance) {
 
   65        BestEditDistance = EditDistance;
 
   68      if (EditDistance == BestEditDistance)
 
   69        BestCommand.push_back(Command);
 
   73  for (
const auto &Command : Commands)
 
   74    ConsiderCorrection(&Command);
 
   76  for (
const auto *Command : RegisteredCommands)
 
   77    if (!Command->IsUnknownCommand)
 
   78      ConsiderCorrection(Command);
 
   80  return BestCommand.size() == 1 ? BestCommand[0] : 
nullptr;
 
 
   83CommandInfo *CommandTraits::createCommandInfoWithName(StringRef CommandName) {
 
   84  char *Name = Allocator.Allocate<
char>(CommandName.size() + 1);
 
   85  memcpy(Name, CommandName.data(), CommandName.size());
 
   86  Name[CommandName.size()] = 
'\0';
 
   94         && 
"Too many commands. We have limited bits for the command ID.");
 
   97  RegisteredCommands.push_back(Info);
 
  103                                                  StringRef CommandName) {
 
  104  CommandInfo *Info = createCommandInfoWithName(CommandName);
 
 
  110  CommandInfo *Info = createCommandInfoWithName(CommandName);
 
 
  116                                                  unsigned CommandID) {
 
  117  if (CommandID < std::size(Commands))
 
  118    return &Commands[CommandID];
 
 
  122const CommandInfo *CommandTraits::getRegisteredCommandInfo(
 
  123                                                  StringRef Name)
 const {
 
  124  for (
unsigned i = 0, e = RegisteredCommands.size(); i != e; ++i) {
 
  125    if (RegisteredCommands[i]->Name == Name)
 
  126      return RegisteredCommands[i];
 
  131const CommandInfo *CommandTraits::getRegisteredCommandInfo(
 
  132                                                  unsigned CommandID)
 const {
 
  133  return RegisteredCommands[CommandID - std::size(Commands)];
 
__DEVICE__ long long abs(long long __n)
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
The JSON file list parser is used to communicate input to InstallAPI.