[cfe-commits] r166130 - in /cfe/trunk: bindings/xml/comment-xml-schema.rng include/clang/AST/Comment.h include/clang/AST/PrettyPrinter.h lib/AST/Comment.cpp lib/AST/DeclPrinter.cpp test/Index/annotate-comments-availability-attrs.cpp test/Index/an

Dmitri Gribenko gribozavr at gmail.com
Thu Oct 18 09:36:11 PDT 2012


On Thu, Oct 18, 2012 at 7:22 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Oct 18, 2012, at 4:42 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>
>> On Thu, Oct 18, 2012 at 12:58 AM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>>> Modified: cfe/trunk/include/clang/AST/Comment.h
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Comment.h?rev=166130&r1=166129&r2=166130&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/AST/Comment.h (original)
>>> +++ cfe/trunk/include/clang/AST/Comment.h Wed Oct 17 16:58:03 2012
>>> @@ -905,9 +905,9 @@
>>>   /// Declaration the comment is attached to.  Should not be NULL.
>>>   const Decl *CommentDecl;
>>>
>>> -  /// Location of this declaration. Not necessarily same as location of
>>> -  /// CommentDecl.
>>> -  SourceLocation Loc;
>>> +  /// CurrentDecl is the declaration for which comment is being put into an XML comment.
>>> +  /// Not necessarily same as CommentDecl.
>>> +  const Decl *CurrentDecl;
>>
>> I think that this "CurrentDecl" variable represents (or should
>> represent) some bigger concept than what is stated in the comment.  It
>> should not be related with XML output at all.  And, I don't see (in
>> current code) how it can be different from CommentDecl.
>
> I hope my other message explained it. However, the comment needs to be improved to describe this. Fariborz?

Oh, now I get it -- first CurrentDecl is set to CommentDecl, but after
that CommentDecl gets changed.  That was subtle.

So CommentDecl is the original Decl that the programmer attached the
comment to and CurrentDecl is the same one or some other related Decl?

Maybe some renaming would help?

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list