r181521 - [doc parsing]: So, in this patch, single character

Jordan Rose jordan_rose at apple.com
Thu May 9 10:19:39 PDT 2013


On May 9, 2013, at 10:15 , Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Thu, May 9, 2013 at 8:03 PM, jahanian <fjahanian at apple.com> wrote:
>> 
>> On May 9, 2013, at 10:01 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> 
>> On Thu, May 9, 2013 at 7:44 PM, Fariborz Jahanian <fjahanian at apple.com>
>> wrote:
>> 
>> Author: fjahanian
>> Date: Thu May  9 11:44:02 2013
>> New Revision: 181521
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=181521&view=rev
>> Log:
>> [doc parsing]: So, in this patch, single character
>> 'commands' will not go through typo fixit logic,
>> preserving the old behavior (no typo, no diagnostics).
>> // rdar://12381408
>> 
>> Modified:
>>   cfe/trunk/lib/AST/CommentCommandTraits.cpp
>>   cfe/trunk/lib/AST/CommentLexer.cpp
>> 
>> Modified: cfe/trunk/lib/AST/CommentCommandTraits.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentCommandTraits.cpp?rev=181521&r1=181520&r2=181521&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/CommentCommandTraits.cpp (original)
>> +++ cfe/trunk/lib/AST/CommentCommandTraits.cpp Thu May  9 11:44:02 2013
>> @@ -49,10 +49,6 @@ 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/lib/AST/CommentLexer.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentLexer.cpp?rev=181521&r1=181520&r2=181521&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/CommentLexer.cpp (original)
>> +++ cfe/trunk/lib/AST/CommentLexer.cpp Thu May  9 11:44:02 2013
>> @@ -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;
>> 
>> 
>> But it should still get a pedantic
>> diag::warn_unknown_comment_command_name diagnostic.
>> 
>> 
>> Are you sure. I intentionally left it out. It is going to be noisy with
>> pedantic.
> 
> Pedantic is going to be noisy anyway, because it will warn even if
> there is no typo correction available.  Pedantic should be, erm,
> pedantic, and warn about everything suspect -- that's the intent.  It
> is feasible to be pedantic-clean when starting a new project (like
> clang codebase does), but for an existing project it will be noisy,
> and that's why it is off by default.

I definitely agree with Dmitri that pedantic has to really be pedantic, just like the regular -pedantic. If we're worried about noise we could add Yet Another Warning Flag under pedantic: -Wdocumentation-unknown-single-char-command or something.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130509/3d1af77a/attachment.html>


More information about the cfe-commits mailing list