'commands' will not go through typo fixit logic,
preserving the old behavior (no typo, no diagnostics).
// rdar://
12381408
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181521
91177308-0d34-0410-b5e6-
96231b3b80d8
const unsigned MaxEditDistance = 1;
unsigned BestEditDistance = MaxEditDistance + 1;
StringRef Name = Command->Name;
- // Don't attempt trying to typo fix single character commands.
- // \t and \n are very common
- if (Name.size() <= 1)
- return;
unsigned MinPossibleEditDistance = abs((int)Name.size() - (int)Typo.size());
if (MinPossibleEditDistance > 0 &&
if (!Info) {
formTokenWithChars(T, TokenPtr, tok::unknown_command);
T.setUnknownCommandName(CommandName);
+ // single character command impostures, such as \t or \n must not go
+ // through the fixit logic.
+ if (CommandName.size() <= 1)
+ return;
if ((Info = Traits.getTypoCorrectCommandInfo(CommandName))) {
StringRef CorrectedName = Info->Name;
SourceRange CommandRange(T.getLocation().getLocWithOffset(1),