r181523 - [doc parsing]: make single character command impostures

Fariborz Jahanian fjahanian at apple.com
Thu May 9 10:18:52 PDT 2013


Author: fjahanian
Date: Thu May  9 12:18:52 2013
New Revision: 181523

URL: http://llvm.org/viewvc/llvm-project?rev=181523&view=rev
Log:
[doc parsing]: make single character command impostures
warn in pedantic mode.

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

Modified: cfe/trunk/lib/AST/CommentCommandTraits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentCommandTraits.cpp?rev=181523&r1=181522&r2=181523&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentCommandTraits.cpp (original)
+++ cfe/trunk/lib/AST/CommentCommandTraits.cpp Thu May  9 12:18:52 2013
@@ -68,6 +68,11 @@ HelperTypoCorrectCommandInfo(SmallVector
 
 const CommandInfo *
 CommandTraits::getTypoCorrectCommandInfo(StringRef Typo) const {
+  // single character command impostures, such as \t or \n must not go
+  // through the fixit logic.
+  if (Typo.size() <= 1)
+    return NULL;
+  
   SmallVector<const CommandInfo *, 2> BestCommand;
   
   int NumOfCommands = sizeof(Commands) / sizeof(CommandInfo);

Modified: cfe/trunk/lib/AST/CommentLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentLexer.cpp?rev=181523&r1=181522&r2=181523&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentLexer.cpp (original)
+++ cfe/trunk/lib/AST/CommentLexer.cpp Thu May  9 12:18:52 2013
@@ -355,10 +355,6 @@ 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),

Modified: cfe/trunk/test/Sema/warn-documentation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.m?rev=181523&r1=181522&r2=181523&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.m (original)
+++ cfe/trunk/test/Sema/warn-documentation.m Thu May  9 12:18:52 2013
@@ -172,3 +172,7 @@ struct S;
   @struct S1 THIS IS IT
 */
 @interface S1 @end
+
+// expected-warning at +1 {{unknown command tag name}}
+/// \t bbb IS_DOXYGEN_END
+int FooBar();





More information about the cfe-commits mailing list