[doc parsing]: So, in this patch, single character
'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
diff --git a/lib/AST/CommentCommandTraits.cpp b/lib/AST/CommentCommandTraits.cpp
index 2b5e624..dc4744a 100644
--- a/lib/AST/CommentCommandTraits.cpp
+++ b/lib/AST/CommentCommandTraits.cpp
@@ -49,10 +49,6 @@
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 &&
diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp
index b195d52..c589219 100644
--- a/lib/AST/CommentLexer.cpp
+++ b/lib/AST/CommentLexer.cpp
@@ -355,6 +355,10 @@
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),