From 9d6b1cb173998c82783c1751b8ce88d3d7243dc3 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 9 May 2013 16:22:31 +0000 Subject: [PATCH] [doc parsing]: don't attempt to fix single character 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 | 4 ++++ test/Sema/warn-documentation-fixits.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/AST/CommentCommandTraits.cpp b/lib/AST/CommentCommandTraits.cpp index dc4744a53c..2b5e624fb7 100644 --- a/lib/AST/CommentCommandTraits.cpp +++ b/lib/AST/CommentCommandTraits.cpp @@ -49,6 +49,10 @@ HelperTypoCorrectCommandInfo(SmallVectorImpl &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 && diff --git a/test/Sema/warn-documentation-fixits.cpp b/test/Sema/warn-documentation-fixits.cpp index 707ecb362f..a5a477f66d 100644 --- a/test/Sema/warn-documentation-fixits.cpp +++ b/test/Sema/warn-documentation-fixits.cpp @@ -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" -- 2.40.0