]> granicus.if.org Git - clang/commitdiff
[doc parsing]: So, in this patch, single character
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 9 May 2013 16:44:02 +0000 (16:44 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 9 May 2013 16:44:02 +0000 (16:44 +0000)
'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

lib/AST/CommentCommandTraits.cpp
lib/AST/CommentLexer.cpp

index 2b5e624fb71aad985a09bc51b2216299476d4aaf..dc4744a53c59a28703ba4308c2a1d73c500a6db8 100644 (file)
@@ -49,10 +49,6 @@ HelperTypoCorrectCommandInfo(SmallVectorImpl<const CommandInfo *> &BestCommand,
   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 &&
index b195d52e8ef1cab4657e71d3f9eda4466c5b94e9..c589219f06ffafea6467f851100603f556320c63 100644 (file)
@@ -355,6 +355,10 @@ void Lexer::lexCommentText(Token &T) {
         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),