r181517 - [doc parsing]: don't attempt to fix single character

Fariborz Jahanian fjahanian at apple.com
Thu May 9 09:22:31 PDT 2013


Author: fjahanian
Date: Thu May  9 11:22:31 2013
New Revision: 181517

URL: http://llvm.org/viewvc/llvm-project?rev=181517&view=rev
Log:
[doc parsing]: don't attempt to fix single character
commands (\t \n are common). \\ rdar://12381408 

Modified:
    cfe/trunk/lib/AST/CommentCommandTraits.cpp
    cfe/trunk/test/Sema/warn-documentation-fixits.cpp

Modified: cfe/trunk/lib/AST/CommentCommandTraits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentCommandTraits.cpp?rev=181517&r1=181516&r2=181517&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentCommandTraits.cpp (original)
+++ cfe/trunk/lib/AST/CommentCommandTraits.cpp Thu May  9 11:22:31 2013
@@ -49,6 +49,10 @@ HelperTypoCorrectCommandInfo(SmallVector
   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 &&

Modified: cfe/trunk/test/Sema/warn-documentation-fixits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation-fixits.cpp?rev=181517&r1=181516&r2=181517&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation-fixits.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation-fixits.cpp Thu May  9 11:22:31 2013
@@ -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"





More information about the cfe-commits mailing list