r180629 - document parsing. When a sub-class (c++ Objective-C) missing

jahanian fjahanian at apple.com
Fri Apr 26 15:24:13 PDT 2013


On Apr 26, 2013, at 3:06 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Fri, Apr 26, 2013 at 11:55 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> Added: cfe/trunk/test/Misc/ast-dump-subclass-comment.mm
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-subclass-comment.mm?rev=180629&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/Misc/ast-dump-subclass-comment.mm (added)
>> +++ cfe/trunk/test/Misc/ast-dump-subclass-comment.mm Fri Apr 26 15:55:38 2013
>> @@ -0,0 +1,101 @@
>> +// RUN: %clang_cc1 -x objective-c++ -Wdocumentation -ast-dump %s | FileCheck %s
>> +// rdar://13647476
>> +
>> +//! NSObject is root of all.
>> + at interface NSObject
>> + at end
>> +// CHECK: ObjCInterfaceDecl{{.*}}NSObject
>> +// CHECK-NEXT:   FullComment 0x{{[^ ]*}} <line:[[@LINE-4]]:4, col:28>
>> +// CHECK-NEXT:     ParagraphComment{{.*}} <col:4, col:28>
>> +// CHECK-NEXT:       TextComment{{.*}} <col:4, col:28> Text=" NSObject is root of all."
> 
> Hi Fariborz,
> 
> Why does this test use -ast-dump?  Usually c-index-test is used to
> test if comment is attached to something.  There are fewer CHECK lines
> that way.

OK. I will add a c-index test (without removing the existing one which took quite time
to get it right :).

> 
> Also, about the approach this patch implements -- while it makes sense
> in some cases, it can be confusing in most other situations.  For
> example:
> 
> /// A window.
> class Window {};
> class Door {};
> 
> class House : Window, Door {};
> 
> 'House' will pick up the 'Window' comment, which is probably not what
> the user wants.

You are right. There are cases which will not make sense. But, not knowing that, we pick the first
one we see (which meets our user requirements). Generally, Important classes must have their own 
comments.

- Fariborz

> 
> 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>*/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130426/1f3b201f/attachment.html>


More information about the cfe-commits mailing list