]> granicus.if.org Git - clang/commitdiff
[doc parsing]: don't attempt to fix single character
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 9 May 2013 16:22:31 +0000 (16:22 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 9 May 2013 16:22:31 +0000 (16:22 +0000)
commands (\t \n are common). \\ rdar://12381408

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181517 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/CommentCommandTraits.cpp
test/Sema/warn-documentation-fixits.cpp

index dc4744a53c59a28703ba4308c2a1d73c500a6db8..2b5e624fb71aad985a09bc51b2216299476d4aaf 100644 (file)
@@ -49,6 +49,10 @@ 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 707ecb362f86743f50422a14fd4dc1590bf2914b..a5a477f66d6d91401455f18589692a2edc021f9a 100644 (file)
@@ -67,6 +67,9 @@ int FooBar();
 /// \fooba bbb IS_DOXYGEN_END
 int gorf();
 
+/// \t bbb IS_DOXYGEN_END
+int Bar();
+
 // CHECK: fix-it:"{{.*}}":{5:12-5:22}:"a"
 // CHECK: fix-it:"{{.*}}":{9:12-9:15}:"aaa"
 // CHECK: fix-it:"{{.*}}":{13:13-13:23}:"T"